]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoAllow setting access-width for UART registers.
br [Mon, 27 Feb 2017 20:08:42 +0000 (20:08 +0000)]
Allow setting access-width for UART registers.

This is required for FDT's standard "reg-io-width" property
(similar to "reg-shift" property) found in many DTS files.

This fixes operation on Altera Arria 10 SOC Development Kit,
where standard ns8250 uart allows 4-byte access only.

Reviewed by: kan, marcel
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9785

7 years agoRevert r314212 as it break Allwinner boards.
br [Mon, 27 Feb 2017 19:46:27 +0000 (19:46 +0000)]
Revert r314212 as it break Allwinner boards.

Reported by: manu

7 years agoAdd sysctl to control auto resize of the GEOM metadata.
oshogbo [Mon, 27 Feb 2017 17:54:01 +0000 (17:54 +0000)]
Add sysctl to control auto resize of the GEOM metadata.

Reviewed by: AllanJude
Differential Revision: https://reviews.freebsd.org/D9603

7 years agoAnnounce that sbp_targ(4) does not support initiator mode.
mav [Mon, 27 Feb 2017 17:50:38 +0000 (17:50 +0000)]
Announce that sbp_targ(4) does not support initiator mode.

MFC after: 1 week

7 years agofix lvt_mode: edge-triggered interrupt mode is set by clearing APIC_LVT_TM
avg [Mon, 27 Feb 2017 17:36:31 +0000 (17:36 +0000)]
fix lvt_mode: edge-triggered interrupt mode is set by clearing APIC_LVT_TM

The fixed is used only to fix up buggy MPTable information and the
trigger mode is probably ignored for the relevant interrupt types
anyway.  Still, it's better to be standards compliant and have the code
do what it says it does.

Discussed with: jhb
MFC after: 5 days

7 years agoallwinner: Correct some clocks name for H3 CCU.
manu [Mon, 27 Feb 2017 17:12:17 +0000 (17:12 +0000)]
allwinner: Correct some clocks name for H3 CCU.

7 years agoAdd ID for NEC uPD720202 xHCI controller.
bms [Mon, 27 Feb 2017 17:04:35 +0000 (17:04 +0000)]
Add ID for NEC uPD720202 xHCI controller.

MFC after: 1 month

7 years agoReturn EINVAL when an invalid file descriptor specified.
dchagin [Mon, 27 Feb 2017 16:55:09 +0000 (16:55 +0000)]
Return EINVAL when an invalid file descriptor specified.

MFC after: 1 month

7 years agoUnify eventfd ioctl method and use it for other similar interfaces.
dchagin [Mon, 27 Feb 2017 16:53:52 +0000 (16:53 +0000)]
Unify eventfd ioctl method and use it for other similar interfaces.

MFC after: 1 month

7 years agobhyve: document virtio-console in the manpage
novel [Mon, 27 Feb 2017 15:37:38 +0000 (15:37 +0000)]
bhyve: document virtio-console in the manpage

Reviewed by: bcr, wblock, jceel
Approved by: grehan
Differential Revision: https://reviews.freebsd.org/D9564

7 years agoUpdate devd.conf for ports change 421360
asomers [Mon, 27 Feb 2017 15:32:56 +0000 (15:32 +0000)]
Update devd.conf for ports change 421360

Ports change 421360 changed the name and UID of the postgres user

Reviewed by: trasz, imp, girgen
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9746

7 years agoxen/gntdev: prevent unsynchronized accesses to the map entry
royger [Mon, 27 Feb 2017 15:31:15 +0000 (15:31 +0000)]
xen/gntdev: prevent unsynchronized accesses to the map entry

vm_map_lookup_done should only be called when the gntdev has finished poking at
the entry.

Reported by: alc
Reviewed by: alc
MFC after: 1 week
Sponsored by: Citrix Systems R&D

7 years agoDocument that the size of AH ICV for HMAC-SHA2-NNN should be half of
ae [Mon, 27 Feb 2017 15:30:27 +0000 (15:30 +0000)]
Document that the size of AH ICV for HMAC-SHA2-NNN should be half of
NNN bits as described in RFC4868.

PR: 215978

7 years agoPolish handling of different reset flavours.
mav [Mon, 27 Feb 2017 14:59:00 +0000 (14:59 +0000)]
Polish handling of different reset flavours.

The biggest change is that ctl_remove_initiator() now generates I_T NEXUS
LOSS event, cleaning part of LUs state related to the initiator.

MFC after: 2 weeks

7 years agoImplement more bit operation functions in the LinuxKPI.
hselasky [Mon, 27 Feb 2017 14:38:17 +0000 (14:38 +0000)]
Implement more bit operation functions in the LinuxKPI.
Some minor whitespace nits while at it.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoDefine __sum16 type in the LinuxKPI.
hselasky [Mon, 27 Feb 2017 13:59:02 +0000 (13:59 +0000)]
Define __sum16 type in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoallwinner: Order clocks by offset rather than by type for H3 ccu.
manu [Mon, 27 Feb 2017 11:10:36 +0000 (11:10 +0000)]
allwinner: Order clocks by offset rather than by type for H3 ccu.

Also add a few more supported gates and add comments for which clocks
are missing.

7 years agoallwinner: Add support for lock and fractional mode on NM clock
manu [Mon, 27 Feb 2017 08:58:27 +0000 (08:58 +0000)]
allwinner: Add support for lock and fractional mode on NM clock

Some PLL have a fractional mode and a lock bit.
Add support for it on the NM clock and export the clocks in the clkdom.

7 years agoFix startup race initialising ACPI CM battery structures on MacBookPro.
hselasky [Mon, 27 Feb 2017 08:36:51 +0000 (08:36 +0000)]
Fix startup race initialising ACPI CM battery structures on MacBookPro.

During acpi_cmbat_attach() the acpi_cmbat_init_battery() notification
handler is registered. It has been observed this notification handler
can be called instantly, before the attach routine has returned. In
the notification handler there is a call to device_is_attached() which
returns false. Because the softc is set we know an attach is in
progress and the fix is simply to wait and try again in this case.

Reviewed by: avg @
MFC after: 1 week

7 years agoSend TERMINATE to firmware when aborting active ATIO.
mav [Mon, 27 Feb 2017 08:20:28 +0000 (08:20 +0000)]
Send TERMINATE to firmware when aborting active ATIO.

MFC after: 2 weeks

7 years agolibrss: simplify some NULL checks.
pfg [Mon, 27 Feb 2017 00:10:00 +0000 (00:10 +0000)]
librss: simplify some NULL checks.

MFC after: 1 week

7 years agodc(1): Merge minor changes from OpenBSD.
pfg [Sun, 26 Feb 2017 22:17:06 +0000 (22:17 +0000)]
dc(1): Merge minor changes from OpenBSD.

Prefer setvbuf() to setlinebuf() for portability.
Some style(9) and redundant tests for NULL.

These are only meant to ease up merging newer changes but we are skipping
changes done in order to accomodate OpenBSD's pledge support.

Obtained from: OpenBSD
MFC after: 2 weeks

7 years agoRemove unneeded variable initialization from r314319.
oshogbo [Sun, 26 Feb 2017 22:15:39 +0000 (22:15 +0000)]
Remove unneeded variable initialization from r314319.

Pointed out by: kib

7 years agoDon't try to open devices in the gettc() function which will always
oshogbo [Sun, 26 Feb 2017 22:07:26 +0000 (22:07 +0000)]
Don't try to open devices in the gettc() function  which will always
fail in the Capability mode. Instead silently fallback to the syscall
method, which is done for example in the gettimeofday(2) function.

Reviewed by: kib

7 years agoEnable pl011 UART FIFOs
jchandra [Sun, 26 Feb 2017 22:05:22 +0000 (22:05 +0000)]
Enable pl011 UART FIFOs

The pl011 UART has a 16 entry Tx FIFO and a 16 entry Rx FIFO that
have not been used so far. Update the driver to enable the FIFOs
and use them in transmit and receive.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D8819

7 years agoInclude pcib_private.h for prototypes.
imp [Sun, 26 Feb 2017 21:33:18 +0000 (21:33 +0000)]
Include pcib_private.h for prototypes.

Noticed by: rpokala@
Sponsored by: Netflix

7 years agodc(1): Catch up with OpenBSD tag.
pfg [Sun, 26 Feb 2017 21:24:35 +0000 (21:24 +0000)]
dc(1): Catch up with OpenBSD tag.

OpenBSD rev 1.12 corresponds to our SVN r275162. Update the tag to make
easier future updates. No functional change.

MFC after: 3 days

7 years agonet80211 drivers: fix rate setup for EAPOL frames, obtain Tx parameters
avos [Sun, 26 Feb 2017 20:49:35 +0000 (20:49 +0000)]
net80211 drivers: fix rate setup for EAPOL frames, obtain Tx parameters
directly from the node.

- Use ni_txparms directly instead of calculating them manually every time
- Move M_EAPOL flag check upper; otherwise it may be skipped due to
'ucastrate' / 'mcastrate' check
- Use 'mgtrate' for control frames too (see ifconfig(8), mgtrate parameter)
- Add few more M_EAPOL checks where it was missing (zyd(4), ural(4),
urtw(4))
- Few unrelated cleanups

Tested with:
 - Intel 6205 (iwn(4)), STA mode;
 - WUSB54GC (rum(4)), HOSTAP mode + RTL8188EU (rtwn(4)), STA mode.

Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D9811

7 years agoReturn EINVAL in case when an invalid size of signal mask specified.
dchagin [Sun, 26 Feb 2017 20:01:58 +0000 (20:01 +0000)]
Return EINVAL in case when an invalid size of signal mask specified.

MFC after: 1 month

7 years agoRegen for r314312 (Linux epoll_pwait).
dchagin [Sun, 26 Feb 2017 19:59:28 +0000 (19:59 +0000)]
Regen for r314312 (Linux epoll_pwait).

MFC after: 1 month

7 years agoChange Linux epoll_pwait syscall definition to match Linux actual one.
dchagin [Sun, 26 Feb 2017 19:57:18 +0000 (19:57 +0000)]
Change Linux epoll_pwait syscall definition to match Linux actual one.

MFC after: 1 month

7 years agoRestore signal mask in epoll_pwait.
dchagin [Sun, 26 Feb 2017 19:54:17 +0000 (19:54 +0000)]
Restore signal mask in epoll_pwait.

MFC after: 1 month

7 years agoRefine the fix from r312954. Specifically, add a new PDE-only flag,
alc [Sun, 26 Feb 2017 19:54:02 +0000 (19:54 +0000)]
Refine the fix from r312954.  Specifically, add a new PDE-only flag,
PG_PROMOTED, that indicates whether lingering 4KB page mappings might
need to be flushed on a PDE change that restricts or destroys a 2MB
page mapping.  This flag allows the pmap to avoid range invalidations
that are both unnecessary and costly.

Reviewed by: kib, markj
MFC after: 6 weeks
Differential Revision: https://reviews.freebsd.org/D9665

7 years agoReturn EINVAL when an invalid file descriptor is specified.
dchagin [Sun, 26 Feb 2017 19:51:44 +0000 (19:51 +0000)]
Return EINVAL when an invalid file descriptor is specified.

MFC after: 1 month

7 years agoFix LUN enabling on wildcard target, as done by CTL.
mav [Sun, 26 Feb 2017 19:25:33 +0000 (19:25 +0000)]
Fix LUN enabling on wildcard target, as done by CTL.

MFC after: 2 weeks

7 years agoAdd support for SIMs without autosense.
mav [Sun, 26 Feb 2017 19:23:03 +0000 (19:23 +0000)]
Add support for SIMs without autosense.

If we asked to send sense data by setting CAM_SEND_SENSE, but SIM didn't
confirm transmission by setting CAM_SENT_SENSE, assume it was not sent.
Queue the I/O back to CTL for later REQUEST SENSE with ctl_queue_sense().
This is needed for error reporting on SPI HBAs like ahc(4)/ahd(4).

MFC after: 2 weeks

7 years agoAvoid picking up MIT Kerberos from ports (if installed).
des [Sun, 26 Feb 2017 19:00:55 +0000 (19:00 +0000)]
Avoid picking up MIT Kerberos from ports (if installed).

7 years agoFix amusingly harmless mis-merge.
des [Sun, 26 Feb 2017 16:34:58 +0000 (16:34 +0000)]
Fix amusingly harmless mis-merge.

7 years agoAdd clkng driver for Allwinner SoC
manu [Sun, 26 Feb 2017 16:00:20 +0000 (16:00 +0000)]
Add clkng driver for Allwinner SoC

Since Linux 4.9-4.10 DTS doesn't have clocks under /clocks but only a ccu node.
Currently only H3 is supported with almost the same state as HEAD.
(video pll aren't supported for now but we don't support video).
This driver and clocks will also be used for other SoC (A64, A31, H5, H2 etc ...)

Reviewed by: jmcneill
Differential Revision: https://reviews.freebsd.org/D9517

7 years agoReturn better error code in case of too long CDB.
mav [Sun, 26 Feb 2017 14:29:09 +0000 (14:29 +0000)]
Return better error code in case of too long CDB.

Its more important for SPI HBAs, as they don't support CDBs above 12 bytes.
The new error code makes CAM to fall back to alternative commands.

MFC after: 2 weeks

7 years agoFix the acpi idle support on i386 which was broken by r312910.
nyan [Sun, 26 Feb 2017 13:25:56 +0000 (13:25 +0000)]
Fix the acpi idle support on i386 which was broken by r312910.

The ifdefs were '#if !defined(__i386__) || !defined(PC98)' previously,
so cpu_idle_acpi was enabled both i386 and amd64 except PC98.

I was obfuscated by '#if !defined(__i386__)' condition.

Submitted by: bde
Reported by: bde

7 years agoUse resid field of CTIO to detect under/overruns.
mav [Sun, 26 Feb 2017 12:54:27 +0000 (12:54 +0000)]
Use resid field of CTIO to detect under/overruns.

MFC after: 2 weeks

7 years agoFix residual length reporting in target mode.
mav [Sun, 26 Feb 2017 12:52:44 +0000 (12:52 +0000)]
Fix residual length reporting in target mode.

This allows to properly handle cases when target wants to receive or send
more data then initiator wants to send or receive.  Previously in such
cases isp(4) returned CAM_DATA_RUN_ERR, while now it returns resid > 0.

MFC after: 2 weeks

7 years agoImplement timerfd family syscalls.
dchagin [Sun, 26 Feb 2017 09:48:18 +0000 (09:48 +0000)]
Implement timerfd family syscalls.

MFC after: 1 month

7 years agoNostly style(9) changes, replace unused eventfd_truncate()
dchagin [Sun, 26 Feb 2017 09:42:34 +0000 (09:42 +0000)]
Nostly style(9) changes, replace unused eventfd_truncate()
by default invfo_truncate() method.

MFC after: 1 month

7 years agoReturn EOVERFLOW error in case then the size of tv_sec field of struct timespec
dchagin [Sun, 26 Feb 2017 09:40:42 +0000 (09:40 +0000)]
Return EOVERFLOW error in case then the size of tv_sec field of struct timespec
in COMPAT_LINUX32 Linuxulator's not equal to the size of native tv_sec.

MFC after: 1 month

7 years agoRegen after r314291 (timerfd definition).
dchagin [Sun, 26 Feb 2017 09:37:25 +0000 (09:37 +0000)]
Regen after r314291 (timerfd definition).

MFC after: 1 month

7 years agoChange Linuxulator timerfd syscalls definition to match actual Linux one.
dchagin [Sun, 26 Feb 2017 09:35:44 +0000 (09:35 +0000)]
Change Linuxulator timerfd syscalls definition to match actual Linux one.

MFC after: 1 month

7 years agoImplement use of multiple transfers per I/O.
mav [Sun, 26 Feb 2017 06:25:55 +0000 (06:25 +0000)]
Implement use of multiple transfers per I/O.

This change removes limitation of single S/G list entry and limitation on
maximal I/O size, using multiple data transfers per I/O if needed.  Also
it removes code duplication between send and receive paths, which are now
completely equal.

7 years agospelling fix
alfred [Sun, 26 Feb 2017 06:05:29 +0000 (06:05 +0000)]
spelling fix

Submitted by: adamw

7 years agoMore FreeBSD tips for fortune(6)
alfred [Sun, 26 Feb 2017 04:41:37 +0000 (04:41 +0000)]
More FreeBSD tips for fortune(6)

Submitted by: lme
PR: 192373

7 years agoiwn: stop all watchdogs on device shutdown.
avos [Sun, 26 Feb 2017 01:05:27 +0000 (01:05 +0000)]
iwn: stop all watchdogs on device shutdown.

Tested with Intel 6205, STA mode.

MFC after: 5 days

7 years agoDo some minimal work to better conform to the 802.3ad (LACP) standard.
jtl [Sun, 26 Feb 2017 00:19:02 +0000 (00:19 +0000)]
Do some minimal work to better conform to the 802.3ad (LACP) standard.
In particular, don't set the synchronized bit for the peer unless it truly
appears to be synchronized to us. Also, don't set our own synchronized bit
unless we have actually seen a remote system.

Prior to this change, we were seeing some strange behavior, such as:

1. We send an advertisement with the Activity, Aggregation, and Default
flags, followed by an advertisement with the Activity, Aggregation,
Synchronization, and Default flags. However, we hadn't seen an
advertisement from another peer and were still advertising the default
(NULL) peer. A closer examination of the in-kernel data structures (using
kgdb) showed that the system had added the default (NULL) peer as a valid
aggregator for the segment.
2. We were receiving an advertisement from a peer that included the
default (NULL) peer instead of including our system information. However,
we responded with an advertisement that included the Synchronization flag
for both our system and the peer. (Since the peer's advertisement did not
include our system information, we shouldn't add the synchronization bit
for the peer.)

This patch corrects those two items.

Reviewed by: smh
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D9485

7 years agoMove inclusion of opt_printf.h around so that we can compile all the
imp [Sat, 25 Feb 2017 22:11:10 +0000 (22:11 +0000)]
Move inclusion of opt_printf.h around so that we can compile all the
SCSI modules outside of a sub-build from the kernel.

Differential Revision: https://reviews.freebsd.org/D9653
Sponsored by: Netflix

7 years agoFix linux_fstatfs() to return proper value for f_frsize. Without it,
trasz [Sat, 25 Feb 2017 20:32:37 +0000 (20:32 +0000)]
Fix linux_fstatfs() to return proper value for f_frsize. Without it,
linux df(1) binary from Xenial shows garbage.

Reviewed by: dchagin
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9692

7 years agoMFV 314276
jpaetzel [Sat, 25 Feb 2017 20:01:17 +0000 (20:01 +0000)]
MFV 314276

7570 tunable to allow zvol SCSI unmap to return on commit of txn to ZIL

illumos/illumos-gate@1c9272b861cd640a8342f4407da026ed98615517
https://github.com/illumos/illumos-gate/commit/1c9272b861cd640a8342f4407da026ed98615517

https://www.illumos.org/issues/7570

  Based on the discovery that every unmap waits for the commit of the txn to the ZIL,
  introducing a very high latency to unmap commands, this behavior was made into a
  tunable zvol_unmap_sync_enabled and set to false. The net impact of this change is
  that by default SCSI unmap commands will result in space being freed within the zvol
  (today they are ignored and returned with good status). However, unlike the code
  today, instead of 18+ms per unmap, they take about 30us.

  With the testing done on NTFS against a Win2k12 target, the new behavior should work
  seamlessly. Files on the zvol that have already been set with the zfree application
  will continue to write 0's when deleted, and any new files created since zvol
  creation will send unmap commands when deleted. This behavior exists today, but with
  this change the unmap commands will be processed and result in reclaim of space.

Author: Stephen Blinick <stephen.blinick@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Approved by: Robert Mustacchi <rm@joyent.com>

7 years agoRemove unused macro from common/drv.c.
oshogbo [Sat, 25 Feb 2017 18:14:32 +0000 (18:14 +0000)]
Remove unused macro from common/drv.c.

When we was compering it to code from boot2 it also looks like
this code is buggy and boot2 was never updated to use this code.
USE_XREAD flag is unused in boot2, and common/drv.c was never
build with that flag.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D9780

7 years agol2arc: try to fix write size calculation broken by Compressed ARC commit
avg [Sat, 25 Feb 2017 17:03:48 +0000 (17:03 +0000)]
l2arc: try to fix write size calculation broken by Compressed ARC commit

While there, make a change to not evict a first buffer outside the
requested eviciton range.

To do:
- give more consistent names to the size variables
- upstream to OpenZFS

PR: 216178
Reported by: lev
Tested by: lev
MFC after: 2 weeks

7 years agozfs: call spa_deadman on a taskqueue thread
avg [Sat, 25 Feb 2017 16:45:53 +0000 (16:45 +0000)]
zfs: call spa_deadman on a taskqueue thread

callout(9) prohibits callout functions from sleeping.
illumos mutexes are emulated using sx(9).
spa_deadman() calls vdev_deadman() and the latter acquires vq_lock.

As a result we can get a more confusing panic instead of a specific
panic or no panic:
sleepq_add: td 0xfffff80019669960 to sleep on wchan 0xfffff8001cff4d88 with sleeping prohibited

This change adds another level of indirection where the deadman
callout schedules spa_deadman() to be executed on taskqueue_thread.

While there, use callout_schedule(0 instead of callout_reset()
in spa_sync().

Discussed with: mav
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9762

7 years agocall vm_lowmem hook in uma_reclaim_worker
avg [Sat, 25 Feb 2017 16:39:21 +0000 (16:39 +0000)]
call vm_lowmem hook in uma_reclaim_worker

A comment near kmem_reclaim() implies that we already did that.
Calling the hook is useful, because some handlers, e.g. ARC,
might be able to release significant amounts of KVA.

Now that we have more than one place where vm_lowmem hook is called,
use this change as an opportunity to introduce flags that describe
a reason for calling the hook.  No handler makes use of the flags yet.

Reviewed by: markj, kib
MFC after: 1 week
Sponsored by: Panzura
Differential Revision: https://reviews.freebsd.org/D9764

7 years agochromebook_platform: catch up with ig4iic -> ig4iic_pci in r310621
avg [Sat, 25 Feb 2017 15:55:46 +0000 (15:55 +0000)]
chromebook_platform: catch up with ig4iic -> ig4iic_pci in r310621

Reported by: Wolfgang Zenker <wolfgang@lyxys.ka.sub.org>
Tested by: Wolfgang Zenker <wolfgang@lyxys.ka.sub.org>
MFC after: 5 days

7 years agoadd chromebook_platform.4 to the list of manual pages
avg [Sat, 25 Feb 2017 14:50:53 +0000 (14:50 +0000)]
add chromebook_platform.4 to the list of manual pages

Reported by: Wolfgang Zenker <wolfgang@lyxys.ka.sub.org>
Pointyhat to: avg
MFC after: 5 days

7 years agoMFV 314243
jpaetzel [Sat, 25 Feb 2017 14:45:54 +0000 (14:45 +0000)]
MFV 314243

6676 Race between unique_insert() and unique_remove() causes ZFS fsid change

illumos/illumos-gate@40510e8eba18690b9a9843b26393725eeb0f1dac
https://github.com/illumos/illumos-gate/commit/40510e8eba18690b9a9843b26393725eeb0f1dac

https://www.illumos.org/issues/6676

  The fsid of zfs filesystems might change after reboot or remount. The problem seems to
  be caused by a race between unique_insert() and unique_remove(). The unique_remove()
  is called from dsl_dataset_evict() which is now an asynchronous thread. In a case the
  dsl_dataset_evict() thread is very slow and calls unique_remove() too late we will end
  up with changed fsid on zfs mount.

  This problem is very likely caused by #5056.

  Steps to Reproduce
  Note: I'm able to reproduce this always on a single core (virtual) machine. On multicore
  machines it is not so easy to reproduce.

# uname -a
SunOS openindiana 5.11 illumos-633aa80 i86pc i386 i86pc Solaris
# zfs create rpool/TEST
# FS=$(echo ::fsinfo | mdb -k | grep TEST | awk '{print $1}')
# echo $FS::print vfs_t vfs_fsid | mdb -k
vfs_fsid = {
    vfs_fsid.val = [ 0x54d7028a, 0x70311508 ]
}
# zfs umount rpool/TEST
# zfs mount rpool/TEST
# FS=$(echo ::fsinfo | mdb -k | grep TEST | awk '{print $1}')
# echo $FS::print vfs_t vfs_fsid | mdb -k
vfs_fsid = {
    vfs_fsid.val = [ 0xd9454e49, 0x6b36d08 ]
}
#

  Impact
  The persistent fsid (filesystem id) is essential for proper NFS functionality.
  If the fsid of a filesystem changes on remount (or after reboot) the NFS
  clients might not be able to automatically recover from such event and the
  manual remount of the NFS filesystems on every NFS client might be needed.

Author: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Dan Vatca <dan.vatca@gmail.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>

7 years agoAdd reporting SAS protocol, in case we ever have one.
mav [Sat, 25 Feb 2017 14:36:24 +0000 (14:36 +0000)]
Add reporting SAS protocol, in case we ever have one.

MFC after: 2 weeks

7 years agoUse ctl_queue_sense() to implement sense data reporting.
mav [Sat, 25 Feb 2017 14:24:29 +0000 (14:24 +0000)]
Use ctl_queue_sense() to implement sense data reporting.

USB MS BBB transport does not support autosense, so we have to queue any
sense data back to CTL for later fetching via REQUEST SENSE.

7 years agoReenable CTL_WITH_CA, optimizing it for lower memory usage.
mav [Sat, 25 Feb 2017 14:20:30 +0000 (14:20 +0000)]
Reenable CTL_WITH_CA, optimizing it for lower memory usage.

This code was disabled due to its high memory usage.  But now we need this
functionality for cfumass(4) frontend, since USB MS BBB transport does not
support autosense.

MFC after: 2 weeks

7 years agoUpdate kern_data_resid according to r312291.
mav [Sat, 25 Feb 2017 12:11:07 +0000 (12:11 +0000)]
Update kern_data_resid according to r312291.

This now mandatory for correct operation.

7 years agoDo not leak mount references for dying threads.
kib [Sat, 25 Feb 2017 10:38:18 +0000 (10:38 +0000)]
Do not leak mount references for dying threads.

Thread might create a condition for delayed SU cleanup, which creates
a reference to the mount point in td_su, but exit without returning
through userret(), e.g. when terminating due to single-threading or
process exit.  In this case, td_su reference is not dropped and mount
point cannot be freed.

Handle the situation by clearing td_su also in the thread destructor
and in exit1().  softdep_ast_cleanup() has to receive the thread as
argument, since e.g. thread destructor is executed in different
context.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoDo not use ULL suffix. Cast to uint64_t where the suffix is needed,
kib [Sat, 25 Feb 2017 10:32:49 +0000 (10:32 +0000)]
Do not use ULL suffix.  Cast to uint64_t where the suffix is needed,
and just remove it in another place.

Requested by: bde
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoConvert PCIe Hot Plug to using pci_request_feature
imp [Sat, 25 Feb 2017 06:11:59 +0000 (06:11 +0000)]
Convert PCIe Hot Plug to using pci_request_feature

Convert PCIe hot plug support over to asking the firmware, if any, for
permission to use the HotPlug hardware. Implement pci_request_feature
for ACPI. All other host pci connections to allowing all valid feature
requests.

Sponsored by: Netflix

7 years agoRename pci_pcie_intr to pci_pcie_intr_hotplug.
imp [Sat, 25 Feb 2017 06:11:50 +0000 (06:11 +0000)]
Rename pci_pcie_intr to pci_pcie_intr_hotplug.

Sponsored by: Netflix

7 years agoCreate pcib_request_feature.
imp [Sat, 25 Feb 2017 06:11:36 +0000 (06:11 +0000)]
Create pcib_request_feature.

pcib_request_feature allows drivers to request the firmware (ACPI)
release certain features it may be using. ACPI normally manages things
like hot plug, advanced error reporting and other features until the
OS requests ACPI to relenquish control since it is taking over.

Sponsored by: Netflix

7 years agoAxe out some forever disabled questionable functionality.
mav [Sat, 25 Feb 2017 04:24:51 +0000 (04:24 +0000)]
Axe out some forever disabled questionable functionality.

This code is complicated enough even in its base shape.

MFC after: 2 weeks

7 years agoImprove CAM target frontend reference counting.
mav [Sat, 25 Feb 2017 04:04:11 +0000 (04:04 +0000)]
Improve CAM target frontend reference counting.

Before this change it was possible to trigger some use-after-free panics
by disabling LUNs/ports under heavy load.

MFC after: 2 weeks

7 years agoFill MK_LIBTHR as far as lib/libthr is concerned
ngie [Sat, 25 Feb 2017 03:44:51 +0000 (03:44 +0000)]
Fill MK_LIBTHR as far as lib/libthr is concerned

There are other areas of the tree that will need to be evaluated for sanity
if they're supposed to be conditionally compiled out of the build/install,
like libzpool

MFC after: 1 month
Relnotes: yes (this might break someone's system if have the knob set)
Sponsored by: Dell EMC Isilon

7 years agoRemove MK_OBJC block
ngie [Sat, 25 Feb 2017 03:35:26 +0000 (03:35 +0000)]
Remove MK_OBJC block

It is no longer represented via src.conf(5)

MFC after: 3 days
Sponsored by: Dell EMC Isilon

7 years agoRemove MK_CRYPT stub
ngie [Sat, 25 Feb 2017 03:33:09 +0000 (03:33 +0000)]
Remove MK_CRYPT stub

It doesn't directly control what gets installed today; it indirectly
pulls other knobs (like MK_KERBEROS, etc).

MFC after: 1 weeks
Sponsored by: Dell EMC Isilon

7 years agoFill in MK_RESCUE by finding paths in ${DESTDIR}/rescue and adding
ngie [Sat, 25 Feb 2017 03:28:49 +0000 (03:28 +0000)]
Fill in MK_RESCUE by finding paths in ${DESTDIR}/rescue and adding
them to OLD_FILES/OLD_DIRS, as necessary.

MFC after: 1 month
Sponsored by: Dell EMC Isilon

7 years agoConditionally compile certain programs into rescue(8) if requested
ngie [Sat, 25 Feb 2017 03:23:11 +0000 (03:23 +0000)]
Conditionally compile certain programs into rescue(8) if requested

MK_CCD - ccdconfig
MK_ROUTED - routed, rtquery

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoAdd shutdown/poweroff support to rescue(8)
ngie [Sat, 25 Feb 2017 03:11:08 +0000 (03:11 +0000)]
Add shutdown/poweroff support to rescue(8)

shutdown is a safer way to power off than reboot (in general), because of
the added shutdown process that it executes via /etc/rc.shutdown . It was
odd that it was missing from rescue(8) since reboot and friends were
added in past commits.

While here, alias poweroff to shutdown for parity with sbin/shutdown/Makefile

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoiwn: some initialization / RF switch state change fixes.
avos [Sat, 25 Feb 2017 00:40:50 +0000 (00:40 +0000)]
iwn: some initialization / RF switch state change fixes.

- Check return code from initialization path; otherwise, vap state
may be wrong after an error.
- Do not try to run iwn_stop() / iwn_init() multiple times.
- Merge iwn_radio_on/off() and move RFKILL bit check into the task.
- Try to handle possible RF switch state change in S3 state (PR 181694).

PR: 181694
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D9797

7 years agoParameterize out the length of struct filed->f_lasttime as `MAXDATELEN`
ngie [Sat, 25 Feb 2017 00:12:29 +0000 (00:12 +0000)]
Parameterize out the length of struct filed->f_lasttime as `MAXDATELEN`

This removes the hardcoded value for the field (16) and the equivalent
hardcoded lengths in logmsg(..).

This change is being done to help stage future work to add RFC5424/RFC5434
support to syslogd(8).

Obtained from: Isilon OneFS (dcd33d13da) (as part of a larger change)
Submitted by: John Bauman <john.bauman@isilon.com>
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoExit when we can't print a variable.
imp [Sat, 25 Feb 2017 00:09:26 +0000 (00:09 +0000)]
Exit when we can't print a variable.

Exit after printing a message on stderr when we can't get a
message. This is slightly different than linux, but keeps shell
scripts from thinking the value of the variable is the error message
and so is a net win.

Sponsored by: Netflix

7 years agoDon't convert ENOENT to nothing for individual lookup, just for the
imp [Sat, 25 Feb 2017 00:09:21 +0000 (00:09 +0000)]
Don't convert ENOENT to nothing for individual lookup, just for the
iterative get_next interface. This prevents efivar(3) from printing 4k
of 0's when a variable isn't set.

Sponsored by: Netflix

7 years agoMake nvmecontrol logpage -p help list known pages.
imp [Sat, 25 Feb 2017 00:09:16 +0000 (00:09 +0000)]
Make nvmecontrol logpage -p help list known pages.

Make -p help and -v help list all the pages we know about.
Add -v to usage.
Update the man page.

Sponsored by: Netflix

7 years agoExit with usage if argv[1] is NULL in dispatch. This fixes core dumps
imp [Sat, 25 Feb 2017 00:09:12 +0000 (00:09 +0000)]
Exit with usage if argv[1] is NULL in dispatch. This fixes core dumps
when a command has subcommands, but the user doesn't give the
parameters on the command line.

Sponsored by: Netflix

7 years agoFix typos in output.
imp [Sat, 25 Feb 2017 00:09:02 +0000 (00:09 +0000)]
Fix typos in output.

Sponsored by: Netflix

7 years agoUse SRCTOP instead of .CURDIR relative paths with ".."
ngie [Fri, 24 Feb 2017 21:35:59 +0000 (21:35 +0000)]
Use SRCTOP instead of .CURDIR relative paths with ".."

This simplifies pathing in make/displayed output

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoAdd linux_preadv() and linux_pwritev() syscalls to Linuxulator.
mmokhi [Fri, 24 Feb 2017 20:04:02 +0000 (20:04 +0000)]
Add linux_preadv() and linux_pwritev() syscalls to Linuxulator.

Reviewed by: dchagin
Approved by: dchagin, trasz (src committers)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9722

7 years agoRevert r314217. Commit is not match that I have approved.
dchagin [Fri, 24 Feb 2017 19:47:27 +0000 (19:47 +0000)]
Revert r314217. Commit is not match that I have approved.

7 years agoAdd linux_preadv() and linux_pwritev() syscalls to Linuxulator.
mmokhi [Fri, 24 Feb 2017 19:22:17 +0000 (19:22 +0000)]
Add linux_preadv() and linux_pwritev() syscalls to Linuxulator.

Reviewed by: dchagin
Approved by: dchagin, trasz (src committers)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9722

7 years agoWe have seen several cases recently where we appear to get a double-fault:
jtl [Fri, 24 Feb 2017 18:56:00 +0000 (18:56 +0000)]
We have seen several cases recently where we appear to get a double-fault:
We have an original panic. Then, instead of writing the core to the dump
device, the kernel has a second panic: "smp_targeted_tlb_shootdown:
interrupts disabled". This change is an attempt to fix that second panic.

When the other CPUs are stopped, we can't notify them of the TLB shootdown,
so we skip that operation. However, when the CPUs come back up, we
invalidate the TLB to ensure they correctly observe any changes to the
page mappings.

Reviewed by: kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D9786

7 years agoImplement more string functions in the LinuxKPI.
hselasky [Fri, 24 Feb 2017 17:36:55 +0000 (17:36 +0000)]
Implement more string functions in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoPrototype device structure to ensure LinuxKPI header file can be
hselasky [Fri, 24 Feb 2017 17:03:14 +0000 (17:03 +0000)]
Prototype device structure to ensure LinuxKPI header file can be
included standalone.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoRemove control+r handling from geliboot's pwgets()
allanjude [Fri, 24 Feb 2017 16:52:57 +0000 (16:52 +0000)]
Remove control+r handling from geliboot's pwgets()

pwgets() is based on ngets() from libstand, which includes a feature
that is not wanted in a very of the function designed for password
handling.

Pressing control+r echos out the entered string

This commit removes that feature from pwgets()

PR: 217298
Reported by: ehaupt
Reviewed by: kristof, tsoome, ehaupt
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D9782

7 years agoUse correct macro for Synopsys UART driver declaration.
br [Fri, 24 Feb 2017 16:37:35 +0000 (16:37 +0000)]
Use correct macro for Synopsys UART driver declaration.

7 years agoRemove cpu_deepest_sleep variable.
kib [Fri, 24 Feb 2017 16:11:55 +0000 (16:11 +0000)]
Remove cpu_deepest_sleep variable.

On Core2 and older Intel CPUs, where TSC stops in C2, system does not
allow C2 entrance if timecounter hardware is TSC.  This is done by
tc_windup() which tests for TC_FLAGS_C2STOP flag of the new
timecounter and increases cpu_disable_c2_sleep if flag is set.  Right
now init_TSC_tc() only sets the flag if cpu_deepest_sleep >= 2, but
TSC is initialized too early for this variable to be set by
acpi_cpu.c.

There is no reason to require that ACPI reported C2 and deeper states
to set TC_FLAGS_C2STOP, so remove cpu_deepest_sleep test from
init_TSC_tc() condition.  And since this is the only use of the
variable, remove it at all.

Reported and submitted by: Jia-Shiun Li <jiashiun@gmail.com>
Suggested by: jhb
MFC after: 2 weeks

7 years ago[iwm] add if_iwm_fw.c.
adrian [Fri, 24 Feb 2017 15:17:43 +0000 (15:17 +0000)]
[iwm] add if_iwm_fw.c.

7 years agoRespecting r314204 tighten ATIO cleanup requirements.
mav [Fri, 24 Feb 2017 14:48:17 +0000 (14:48 +0000)]
Respecting r314204 tighten ATIO cleanup requirements.

Every ATIO must complete with either successfully sent status or XPT_ABORT.

MFC after: 2 weeks

7 years agoImplement srcu_dereference() macro in the LinuxKPI.
hselasky [Fri, 24 Feb 2017 14:40:15 +0000 (14:40 +0000)]
Implement srcu_dereference() macro in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies