]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoInclude pcib_private.h for prototypes.
Warner Losh [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.
Pedro F. Giffuni [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
Andriy Voskoboinyk [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.
Dmitry Chagin [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).
Dmitry Chagin [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.
Dmitry Chagin [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.
Dmitry Chagin [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,
Alan Cox [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.
Dmitry Chagin [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.
Alexander Motin [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.
Alexander Motin [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).
Dag-Erling Smørgrav [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.
Dag-Erling Smørgrav [Sun, 26 Feb 2017 16:34:58 +0000 (16:34 +0000)]
Fix amusingly harmless mis-merge.

7 years agoAdd clkng driver for Allwinner SoC
Emmanuel Vadot [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.
Alexander Motin [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.
Yoshihiro Takahashi [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.
Alexander Motin [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.
Alexander Motin [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.
Dmitry Chagin [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()
Dmitry Chagin [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
Dmitry Chagin [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).
Dmitry Chagin [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.
Dmitry Chagin [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.
Alexander Motin [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 Perlstein [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 Perlstein [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.
Andriy Voskoboinyk [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.
Jonathan T. Looney [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
Warner Losh [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,
Edward Tomasz Napierala [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
Josh Paetzel [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 ago7570 tunable to allow zvol SCSI unmap to return on commit of txn to ZIL
Josh Paetzel [Sat, 25 Feb 2017 19:16:20 +0000 (19:16 +0000)]
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.
Mariusz Zaborski [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
Andriy Gapon [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
Andriy Gapon [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
Andriy Gapon [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
Andriy Gapon [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
Andriy Gapon [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
Josh Paetzel [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.
Alexander Motin [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.
Alexander Motin [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.
Alexander Motin [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.
Alexander Motin [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.
Konstantin Belousov [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,
Konstantin Belousov [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
Warner Losh [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.
Warner Losh [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.
Warner Losh [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.
Alexander Motin [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.
Alexander Motin [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
Enji Cooper [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
Enji Cooper [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 ago6676 Race between unique_insert() and unique_remove() causes ZFS fsid change
Josh Paetzel [Sat, 25 Feb 2017 03:34:22 +0000 (03:34 +0000)]
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 agoRemove MK_CRYPT stub
Enji Cooper [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
Enji Cooper [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
Enji Cooper [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)
Enji Cooper [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.
Andriy Voskoboinyk [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`
Enji Cooper [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.
Warner Losh [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
Warner Losh [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.
Warner Losh [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
Warner Losh [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.
Warner Losh [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 ".."
Enji Cooper [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.
Mahdi Mokhtari [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.
Dmitry Chagin [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.
Mahdi Mokhtari [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:
Jonathan T. Looney [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.
Hans Petter Selasky [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
Hans Petter Selasky [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()
Allan Jude [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.
Ruslan Bukin [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.
Konstantin Belousov [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 Chadd [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.
Alexander Motin [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.
Hans Petter Selasky [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

7 years agoGuard sem_clockwait_np() declaration with __BSD_VISIBLE
Eric van Gyzen [Fri, 24 Feb 2017 14:37:55 +0000 (14:37 +0000)]
Guard sem_clockwait_np() declaration with __BSD_VISIBLE

This is a POSIX header file, so keep the namespace clean.

Reported by: kib
MFC after: 13 days
X-MFC with: r314179
Sponsored by: Dell EMC

7 years agoImplement BIT_ULL() macro in the LinuxKPI.
Hans Petter Selasky [Fri, 24 Feb 2017 14:23:46 +0000 (14:23 +0000)]
Implement BIT_ULL() macro in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoExplicitly abort ATIO if CTIO sending status has failed.
Alexander Motin [Fri, 24 Feb 2017 12:12:30 +0000 (12:12 +0000)]
Explicitly abort ATIO if CTIO sending status has failed.

This helps SIM to free related resources in questionable cases.

MFC after: 2 weeks

7 years agoFix missing xpt_done() for ATIO/INOT on missing LUN.
Alexander Motin [Fri, 24 Feb 2017 12:11:17 +0000 (12:11 +0000)]
Fix missing xpt_done() for ATIO/INOT on missing LUN.

MFC after: 2 weeks

7 years agoWe can't access periph after ctlfe_free_ccb().
Alexander Motin [Fri, 24 Feb 2017 11:25:32 +0000 (11:25 +0000)]
We can't access periph after ctlfe_free_ccb().

MFC after: 2 weeks

7 years agoUnify ATIO/INOT CCBs requeuing.
Alexander Motin [Fri, 24 Feb 2017 09:16:21 +0000 (09:16 +0000)]
Unify ATIO/INOT CCBs requeuing.

MFC after: 2 weeks

7 years agoProperly handle possible underflow in vm_fault_prefault().
Konstantin Belousov [Fri, 24 Feb 2017 08:09:16 +0000 (08:09 +0000)]
Properly handle possible underflow in vm_fault_prefault().

In vm_fault_prefault(), if backward count causes underflow in
calculation of
starta = addra - backward * PAGE_SIZE;
then starta must be clipped to entry->start, instead of zero.
Clipping to zero allowed mapping outside of the map entries address
ranges, in particular, map at zero.

Submitted by: Yanko Yankulov <yanko.yankulov@gmail.com>
Reviewed by: alc
MFC after: 1 week

7 years agozfs: clean up unused files and definitions
Andriy Gapon [Fri, 24 Feb 2017 07:53:56 +0000 (07:53 +0000)]
zfs: clean up unused files and definitions

MFC after: 1 month
X-MFC after: r314048

7 years agoSome code cleanup.
Alexander Motin [Fri, 24 Feb 2017 07:47:50 +0000 (07:47 +0000)]
Some code cleanup.

MFC after: 2 weeks

7 years ago[iwm] Add support for Firmware paging, needed for newer 8000C firmware.
Adrian Chadd [Fri, 24 Feb 2017 07:07:58 +0000 (07:07 +0000)]
[iwm] Add support for Firmware paging, needed for newer 8000C firmware.

* Uses the IWM_FW_PAGING_BLOCK_CMD firmware command to tell the firmware
  what memory ranges to use for paging.

Obtained from: dragonflybsd.git 8a5b199964f8e7bdb00039f0b48817a01b402f18

7 years agoFix up r314189
Enji Cooper [Fri, 24 Feb 2017 06:49:31 +0000 (06:49 +0000)]
Fix up r314189

The conditional in do_buff_decode(..) after the while loop was accidentally
inverted. Only increment the pointer for fmt if it's not NUL.

MFC after: 2 weeks
X-MFC with: r314189
Reported by: pstef
Sponsored by: Dell EMC Isilon

7 years agoFix some minor style nits: put parentheses around return values
Enji Cooper [Fri, 24 Feb 2017 06:28:58 +0000 (06:28 +0000)]
Fix some minor style nits: put parentheses around return values

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoFix up NULL/'\0' uses and fix 2 derefs after NULL
Enji Cooper [Fri, 24 Feb 2017 06:24:39 +0000 (06:24 +0000)]
Fix up NULL/'\0' uses and fix 2 derefs after NULL

MFC after: 2 weeks
Reported by: Coverity
CID: 10188981018899
Differential Revision: https://reviews.freebsd.org/D6142
Sponsored by: Dell EMC Isilon

7 years agoCast values to (int) before comparing them to the range of the
Warner Losh [Fri, 24 Feb 2017 01:39:12 +0000 (01:39 +0000)]
Cast values to (int) before comparing them to the range of the
enum. This ensures they are in range w/o the warnings.

7 years agoKDTRACE_HOOKS isn't guaranteed to be defined. Change to check to see
Warner Losh [Fri, 24 Feb 2017 01:39:08 +0000 (01:39 +0000)]
KDTRACE_HOOKS isn't guaranteed to be defined. Change to check to see
if it is defined or not rather than if it is non-zero.

Sponsored by: Netflix, Inc

7 years agoat91: double assignment.
Pedro F. Giffuni [Thu, 23 Feb 2017 23:48:44 +0000 (23:48 +0000)]
at91: double assignment.

Found with: coccinelle (da.cocci)
Suggested by: cognet

7 years agomtx: microoptimize lockstat handling in spin mutexes and thread lock
Mateusz Guzik [Thu, 23 Feb 2017 22:46:01 +0000 (22:46 +0000)]
mtx: microoptimize lockstat handling in spin mutexes and thread lock

While here make the code compilablle on kernels with LOCK_PROFILING but without
KDTRACE_HOOKS.

7 years agoadd jedec_ts.4 to the list of manual pages
Andriy Gapon [Thu, 23 Feb 2017 22:08:35 +0000 (22:08 +0000)]
add jedec_ts.4 to the list of manual pages

Reported by: rpokala
MFC after: 3 days

7 years ago[ifconfig] handle illegal WPS frames
Adrian Chadd [Thu, 23 Feb 2017 20:49:17 +0000 (20:49 +0000)]
[ifconfig] handle illegal WPS frames

Some APs broadcast WPS IE frames with totally broken data.  Ifconfig's printwpsie()
loops through WPS frames printing the attributes out; if the frame's data is bad,
printwpsie() can end up looking at out-of-bounds addresses causing ifconfig to
bus error.

Thanks to Takashi Inoue at Nihon U for his efforts in debugging this.

PR: bin/217312
Submitted by: fbsd@opal.com
MFC after: 1 week

7 years agoFix and shorten BERI kernel builds during universe.
Brooks Davis [Thu, 23 Feb 2017 20:41:55 +0000 (20:41 +0000)]
Fix and shorten BERI kernel builds during universe.

Stop building BERI_DE4_BASE and BERI_SIM_BASE, they aren't particularly
valid as they don't have a root dev.  Do build BERI_DE4_SDROOT which
does so devices get coverage.

Remove ident from BERI_DE4_BASE for the reasons above which will cause
it to fail to build.  BERI_SIM_BASE was already this way and broke
universe.[0]

Reported by: rpokala
Sponsored by: DARPA, AFRL

7 years agoAdd sem_clockwait_np()
Eric van Gyzen [Thu, 23 Feb 2017 19:36:38 +0000 (19:36 +0000)]
Add sem_clockwait_np()

This function allows the caller to specify the reference clock
and choose between absolute and relative mode.  In relative mode,
the remaining time can be returned.

The API is similar to clock_nanosleep(3).  Thanks to Ed Schouten
for that suggestion.

While I'm here, reduce the sleep time in the semaphore "child"
test to greatly reduce its runtime.  Also add a reasonable timeout.

Reviewed by: ed (userland)
MFC after: 2 weeks
Relnotes: yes
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D9656

7 years agoAdd support for RDMA from userspace with T6 cards.
Navdeep Parhar [Thu, 23 Feb 2017 19:21:47 +0000 (19:21 +0000)]
Add support for RDMA from userspace with T6 cards.

Submitted by: Krishnamraju Eraparaju @ Chelsio
Sponsored by: Chelsio Communications

7 years agocxgbe/iw_cxgbe: Minor changes for T6.
Navdeep Parhar [Thu, 23 Feb 2017 19:02:40 +0000 (19:02 +0000)]
cxgbe/iw_cxgbe: Minor changes for T6.

Submitted by: Krishnamraju Eraparaju at Chelsio
Sponsored by: Chelsio Communications