Commit Graph

213595 Commits

Author SHA1 Message Date
Konstantin Belousov
a068480247 For pthread_mutex_trylock() call on owned error-check or non-portable
adaptive mutex, return EDEADLK as required by POSIX.  The
pthread_mutex_lock() is already compliant.

Tested by:	Guy Yur <guyyur@gmail.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Approved by:	re (gjb)
2016-06-25 11:30:40 +00:00
Landon J. Fuller
688fc8c0d6 bhnd(4): Add devinfo allocation and child addition methods, modeled on
pci_if.

This allows bhnd(4) to manage per-device state (such as per-core
pmu/clock refcounting) on behalf of subclass driver instances.

Approved by:	re (gjb), adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D6959
2016-06-25 04:36:30 +00:00
Landon J. Fuller
ff29b85a34 Replace mips/sentry5 with mips/broadcom
The delta between SENTRY5 and BCM was already small due to BCM being
derived from SENTRY5; re-integrating the two avoids the maintenance
overhead of keeping them both in sync with bhnd(4) changes.


- Re-integrate minor SENTRY5 deltas in bcm_machdep.c
- Modify uart_cpu_chipc to allow specifying UART debug/console flags via
  kenv and device hints.
- Switch SENTRY5 to std.broadcom
- Enabled CFI flash support for SENTRY5

Reviewed by:	Michael Zhilin <mizkha@gmail.com> (Broadcom MIPS support)
Approved by:	re (gjb), adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D6897
2016-06-25 04:34:54 +00:00
Landon J. Fuller
0c91e8927d bhnd(4): Perform explicit chipc child enumeration.
Replaces use of DEVICE_IDENTIFY with explicit enumeration of chipc
child devices using the chipc capability structure.

This is a precursor to PMU support, which requires more complex resource
assignment handling than achievable with the static device name-based
hints table.

Reviewed by:	Michael Zhilin <mizkha@gmail.com> (Broadcom MIPS support)
Approved by:	re (gjb), adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D6896
2016-06-25 04:33:00 +00:00
Andriy Voskoboinyk
1902276e19 urtwn: use m_get2() in Rx path.
Replace m_getcl() with m_get2(); this fixes 'frame too long'
messages for frames, which are longer than MCLBYTES
(can be easily triggered when A-MSDU is used).

Tested with RTL8188CUS (AP) and RTL8188EU (STA).

Approved by:	re (marius)
2016-06-24 23:43:19 +00:00
Glen Barber
38ab6d8744 Update the release notes following r302182.
Approved by:	re (implicit, relnotes)
Sponsored by:	The FreeBSD Foundation
2016-06-24 23:42:33 +00:00
Colin Percival
60406292e4 Turn off MSI-X interrupt migration by default in EC2 instances; this works
around a bug in older versions of Xen and unbreaks SR-IOV (aka. "EC2
Enhanced Networking").

Approved by:	re (gjb)
Thanks to:	jhb, Jeremiah Lott
2016-06-24 23:39:44 +00:00
Andriy Voskoboinyk
532a0e9ca0 urtwn: fix memory leak on device restart
Free data buffers every time when device is stopped, not when
it is detached; they are allocated at the initialization stage.

How-to-reproduce:
1) ifconfig wlan0 create wlandev urtwn0 up
2) vmstat -m | grep USBdev
3) service netif restart
4) vmstat -m | grep USBdev

Also, remove usbd_transfer_drain() call; it is already called by
usbd_transfer_unsetup().

Tested with RTL8188CUS, STA mode.

Approved by:	re (marius)
2016-06-24 23:36:22 +00:00
Glen Barber
faebc97a1c Revert r301551, which added blacklistd(8) to sshd(8).
This change has functional impact, and other concerns raised
by the OpenSSH maintainer.

Requested by:	des
PR:		210479 (related)
Approved by:	re (marius)
Sponsored by:	The FreeBSD Foundation
2016-06-24 23:22:42 +00:00
John Baldwin
be0319fd19 Add a tunable to disable migration of MSI-X interrupts.
The new 'machdep.disable_msix_migration' tunable can be set to 1 to
disable migration of MSI-X interrupts.

Xen versions prior to 4.6.0 do not properly handle updates to MSI-X
table entries after the initial write.  In particular, the operation
to unmask a table entry after updating it during migration is not
propagated to the "real" table for passthrough devices causing the
interrupt to remain masked.  At least some systems in EC2 are
affected by this bug when using SRIOV.  The tunable can be set in
loader.conf as a workaround.

Submitted by:	Jeremiah Lott <jlott@averesystems.com> (original patch)
Approved by:	re (marius)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D6947
2016-06-24 22:49:32 +00:00
Alan Somers
39ba705baf Fix bitstring allocation on 32-bit platforms
sys/sys/bitstring.h
	Fix a rounding calculation that could undersize a bitstring on
	32-bit platforms.

tests/sys/sys/bitstring_test.h
	Add a test for bitstr_size

PR:		210260
Reported by:	Mark Millard
Reviewed by:	gibbs
Approved by:	re (marius)
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D6848
2016-06-24 21:44:46 +00:00
Mark Johnston
0367ff567c gcore: Forward pending signals when detaching from the target.
Otherwise gcore's ptrace attach operation can race with delivery of a
signal and cause it to be lost.

In collaboration with:	Suraj Raju <sraju@isilon.com>
Reviewed by:	bdrewery
Approved by:	re (gjb, kib)
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2016-06-24 20:21:32 +00:00
Bryan Drewery
8095b3c249 Regenerate
Approved by:	re (implicit, r302177)
2016-06-24 20:00:39 +00:00
Bryan Drewery
bf16c2e9c9 WITH_SYSTEM_COMPILER: Enable by default
This improves buildworld, toolchain, kernel-toolchain, and universe targets.
See r300354 or src.conf(5) for more details.

Approved by:	re (gjb)
Relnotes:	yes (r300354)
Sponsored by:	EMC / Isilon Storage Division
2016-06-24 19:55:59 +00:00
Ed Maste
b60371f8a6 bsd.prog.mk: add "/usr/lib" to list of base system directories
kgzldr.o is installed into /usr/lib but using bsd.prog.mk. Add
/usr/lib to the base system directory list so that debug files are
installed into /usr/lib/debug/usr/lib, not /usr/lib/.debug .

Approved by:	re (gjb)
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2016-06-24 18:45:16 +00:00
John Baldwin
2ab0398d94 Add pci_get_max_payload() to fetch the PCI-express maximum payload size.
Approved by:	re (gjb)
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D6951
2016-06-24 17:26:42 +00:00
Alan Somers
4dad99bf48 Fix "sysctl vm.vmtotal" output on machines with > 2TB virtual memory
sbin/sysctl/sysctl.c
	Fix integer overflows in printf format strings

PR:		199673
Submitted by:	Vitaly Magerya
Reviewed by:	cem
Approved by:	re (marius)
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D6941
2016-06-24 14:58:37 +00:00
Bjoern A. Zeeb
a8fc1b786d The void isn't void.
Unbreak sparc64 and powerpc builds.

Approved by:	re (gjb)
Sponsored by:	The FreeBSD Foundation
MFC after:	12 days
2016-06-24 11:53:12 +00:00
Hans Petter Selasky
56c926d077 Resolve issue with libusb C++ header file inclusion.
Approved by:	re (marius)
PR:		210509
MFC after:	1 week
2016-06-24 10:55:14 +00:00
Glen Barber
591dda3ad0 Update head to ALPHA5 in preparation of new snapshot builds.
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-06-24 00:05:45 +00:00
Warner Losh
df2362478e Rename CAM_NETFLIX_IOSCHED to CAM_IOSCHED_DYNAMIC to better reflect
its nature.

Approved by: re
Reviewed By: jhb
Differential Revision: https://reviews.freebsd.org/D6811
2016-06-23 23:20:58 +00:00
Alan Somers
3185f0f02b Fix gstat's interactive f and q commands
curses and libedit don't play well together. After last year's libedit
upgrade in head, they play even less well together. This change resets some
curses settings after they get screwed up by libedit calls. Without it,
gstat's interactive commands require an extra "enter", screw up the terminal
on exit, and screw up the display if the user enters an invalid filter
string.

PR:		204852
Submitted by:	Keith White
Reviewed by:	pfg
Approved by:	re (gjb)
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D6934
2016-06-23 23:13:14 +00:00
Bjoern A. Zeeb
66c00e9efb Proerply virtualize pfsync for bringup after pf is initialized and
teardown of VNETs once pf(4) has been shut down.
Properly split resources into VNET_SYS(UN)INITs and one time module
loading.
While here cover the INET parts in the uninit callpath with proper
#ifdefs.

Approved by:	re (gjb)
Obtained from:  projects/vnet
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
2016-06-23 22:31:44 +00:00
Bjoern A. Zeeb
7d7751a071 Make sure pflog is attached after pf is initializaed so we can
borrow pf's lock, and also make sure pflog goes after pf is gone
in order to avoid callouts in VNETs to an already freed instance.

Reported by:    Ivan Klymenko, Johan Hendriks  on current@ today
Obtained from:  projects/vnet
Sponsored by:   The FreeBSD Foundation
MFC after:      13 days
Approved by:	re (gjb)
2016-06-23 22:31:10 +00:00
Bjoern A. Zeeb
a8e8c57443 PFSTATE_NOSYNC goes onto state_flags, not sync_state;
this prevents: panic: pfsync_delete_state: unexpected sync state 8

Reviewed by:		kp
Approved by:		re (gjb)
MFC after:		2 weeks
Sponsored by:		The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D6942
2016-06-23 21:42:43 +00:00
Bjoern A. Zeeb
a0429b5459 Update pf(4) and pflog(4) to survive basic VNET testing, which includes
proper virtualisation, teardown, avoiding use-after-free, race conditions,
no longer creating a thread per VNET (which could easily be a couple of
thousand threads), gracefully ignoring global events (e.g., eventhandlers)
on teardown, clearing various globally cached pointers and checking
them before use.

Reviewed by:		kp
Approved by:		re (gjb)
Sponsored by:		The FreeBSD Foundation
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D6924
2016-06-23 21:34:38 +00:00
Bjoern A. Zeeb
42644eb88e Try to avoid a 2nd conditional by re-writing the loop, pause, and
escape clause another time.

Submitted by:	jhb
Approved by:	re (gjb)
MFC after:	12 days
2016-06-23 21:32:52 +00:00
Brooks Davis
678243ffda Fix two typos in r302152.
Approved by:	re (implicit)
2016-06-23 21:09:07 +00:00
Navdeep Parhar
f22bfc72f8 Add spares to struct ifnet and socket for packet pacing and/or general
use.  Update comments regarding the spare fields in struct inpcb.

Bump __FreeBSD_version for the changes to the size of the structures.

Reviewed by:	gnn@
Approved by:	re@ (gjb@)
Sponsored by:	Chelsio Communications
2016-06-23 21:07:15 +00:00
Brooks Davis
ddc2f805a5 Add an UPDATING entry for the pipe() -> pipe2() transition.
Approved by:	re (gjb)
Sponsored by:	DARPA, AFRL
2016-06-23 21:02:05 +00:00
Jilles Tjoelker
6ea906eec0 posixshm: Fix lock leak when mac_posixshm_check_read rejects read.
While reading the code, I noticed that shm_read() returns without unlocking
foffset and rangelock if mac_posixshm_check_read() rejects the read.

Reviewed by:	kib, jhb, rwatson
Approved by:	re (gjb)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D6927
2016-06-23 20:59:13 +00:00
Kenneth D. Merry
a02e196edd Switch geom_disk over to using a pool mutex.
The GEOM disk d_mtx is only acquired on disk creation and destruction.
It is a good candidate for replacement with a pool mutex.  This eliminates
the mutex initialization and teardown and the mutex and name variables
themselves from struct disk.

sys/geom/geom_disk.h:
	Take d_mtx and d_mtx_name out of struct disk.

sys/geom/geom_disk.c:
	Use mtx_pool_lock() and mtx_pool_unlock() to guard the disk
	initialization state instead of a dedicated mutex.

	This allows removing the initialization and destruction of
	d_mtx.

sys/sys/param.h:
	Bump __FreeBSD_version to 1100119 for the change to struct disk.

Suggested by:	jhb
Sponsored by:	Spectra Logic
Approved by:	re (gjb)
2016-06-23 20:05:59 +00:00
Kurt Lidl
cc4eb1ea10 Add support for a /etc/defaults/vendor.conf override file
Reviewed by:	stas, imp
Approved by:	re (gjb)
Differential Revision:	https://reviews.freebsd.org/D6895
2016-06-23 19:37:00 +00:00
Michael Tuexen
9de217ce56 Fix a bug in the handling of non-blocking SCTP 1-to-1 sockets. When using
this code in the userland stack, it could result in a loop. This happened on iOS.
However, I was not able to reproduce this when using the code in the kernel.
Thanks to Eugen-Andrei Gavriloaie for reporting the issue and proving detailed
information to find the root of the problem.

Approved by:	re (gjb)
MFC after:	1 week
2016-06-23 19:27:29 +00:00
Mark Johnston
c722a89a63 Use M_NOWAIT when allocating memory for the ACPI wakeup handler.
If the allocation attempt fails, we may otherwise VM_WAIT after a failed
attempt to reclaim contiguous memory in the requested range. After r297466,
this results in the thread going to sleep, causing a hang during boot.

Reviewed by:	jkim, kib
Approved by:	re (gjb)
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D6945
2016-06-23 19:24:38 +00:00
Ed Maste
948c30e565 makeroot: zero out subsecond component of time= keywords
They are currently not supported by makefs(1).

PR:		194703
Reviewed by:	brooks
Approved by:	re (gjb)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D6925
2016-06-23 19:19:44 +00:00
Ed Maste
5fafcca757 bsdinstall: increase EFI partition size to 200MB
A larger EFI file system size will facilitate multi-boot configurations
and the installation other EFI applications like firmware update tools.
200MB matches OS X.

Note that this changes only the partition size, not the file system that
bsdinstall places there. We need to do both, but as the partition size
is difficult to adjust later make this change for now so that at least
systems installed with FreeBSD 11.0 have a partition layout with room
to grow.

Reviewed by:	allanjude, imp
Approved by:	re (gjb)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D6935
2016-06-23 18:04:48 +00:00
Alan Somers
58406fff52 Raise the WARNS level in cddl/lib
cddl/lib/libavl/Makefile
cddl/lib/libctf/Makefile
cddl/lib/libnvpair/Makefile
cddl/lib/libumem/Makefile
cddl/lib/libuutil/Makefile
	Increase WARNS to the highest working level for each of these
	libraries

Approved by:	re (gjb, hrs)
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
2016-06-23 15:02:57 +00:00
Bjoern A. Zeeb
361279a4fb In VNET TCP teardown Do not sleep unconditionally but only if we
have any TCP connections left.

Submitted by:		zec
Approved by:		re (hrs)
MFC after:		13 days
2016-06-23 11:55:15 +00:00
Hans Petter Selasky
5b0c29decf Use correct Q-counter output array.
Sponsored by:	Mellanox Technologies
Approved by:	re (kib)
MFC after:	3 days
2016-06-23 09:23:37 +00:00
Michael Tuexen
55b8cd93ef Don't consider the socket when processing an incoming ICMP/ICMP6 packet,
which was triggered by an SCTP packet. Whether a socket exists, is just
not relevant.

Approved by: re (kib)
MFC after: 1 week
2016-06-23 09:13:15 +00:00
Konstantin Belousov
35e8002c58 In vm_page_xunbusy_maybelocked(), add fast path for unbusy when no
waiters exist, same as for vm_page_xunbusy().  If previous value of
busy_lock was VPB_SINGLE_EXCLUSIVER, no waiters existed and wakeup is
not needed.

Move common code from vm_page_xunbusy_maybelocked() and
vm_page_xunbusy_hard() to vm_page_xunbusy_locked().

Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Approved by:	re (gjb)
2016-06-23 08:28:13 +00:00
Konstantin Belousov
505cd5d13b Add a comment noting locking regime for vm_page_xunbusy().
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Approved by:	re (gjb)
2016-06-23 08:27:38 +00:00
Hans Petter Selasky
a0c93fa361 Add support for USB streams to the LibUSB v1.0 API and update the
libusb(3) manual page.

Approved by:	re (gjb)
Requested by:	swills
MFC after:	1 week
2016-06-23 07:12:22 +00:00
Andriy Gapon
0f7dcde977 fix deadlock-prone code in getzfsvfs()
getzfsvfs() called vfs_busy() in the waiting mode while having a hold on
a pool (via a call to dmu_objset_hold).  In other words,
dp_config_rwlock was held in the shared mode while a thread could be
sleeping in vfs_busy().
The pool's txg sync thread needs to take dp_config_rwlock in the
exclusive mode for some actions, e.g., for executing sync tasks.  If the
sync thread gets blocked, then any thread waiting for its sync task to
get executed is also blocked.  Which, in turn, could mean that
vfs_busy() will keep waiting indefinitely.

The solution is to use vfs_ref() in the locked section and to call
vfs_busy() only after dropping other locks.
Note that a reference on a struct mount object does not prevent an
associated zfsvfs_t object from being destroyed.  So, we have to be
careful to operate only on the struct mount object until we successfully
vfs_busy it.

Approved by:	re (gjb)
MFC after:	2 weeks
2016-06-23 07:01:54 +00:00
Bjoern A. Zeeb
8147948e19 Import a fix for and old security issue (CVE-2010-3830) in pf which
was not relevant to FreeBSD as only root could open /dev/pf by default.
With VIMAGE this is will longer be the case.  As pf(4) starts to
be supported with VNETs 3rd party users may open /dev/pf inside the
virtual jail instance; thus we need to address this issue after all.
While OpenBSD largely rewrote code parts for the fix [1], and it's
unclear what Apple [3] did, import the minimal fix from NetBSD [2].

[1] http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/net/pf_ioctl.c.diff?r1=1.235&r2=1.236
[2] http://mail-index.netbsd.org/source-changes/2011/01/19/msg017518.html
[3] https://support.apple.com/en-gb/HT202154

Obtained from:		http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dist/pf/net/pf_ioctl.c.diff?r1=1.42&r2=1.43&only_with_tag=MAIN
MFC After:		2 weeks
Approved by:		re (gjb)
Sponsored by:		The FreeBSD Foundation
Security:		CVE-2010-3830
2016-06-23 05:41:46 +00:00
Navdeep Parhar
62291463de cxgbe(4): Merge netmap support from the ncxgbe/ncxl interfaces to the
vcxgbe/vcxl interfaces and retire the 'n' interfaces.  The main
cxgbe/cxl interfaces and tunables related to them are not affected by
any of this and will continue to operate as usual.

The driver used to create an additional 'n' interface for every
cxgbe/cxl interface if "device netmap" was in the kernel.  The 'n'
interface shared the wire with the main interface but was otherwise
autonomous (with its own MAC address, etc.).  It did not have normal
tx/rx but had a specialized netmap-only data path.  r291665 added
another set of virtual interfaces (the 'v' interfaces) to the driver.
These had normal tx/rx but no netmap support.

This revision consolidates the features of both the interfaces into the
'v' interface which now has a normal data path, TOE support, and native
netmap support.  The 'v' interfaces need to be created explicitly with
the hw.cxgbe.num_vis tunable.  This means "device netmap" will not
result in the automatic creation of any virtual interfaces.

The following tunables can be used to override the default number of
queues allocated for each 'v' interface.  nofld* = 0 will disable TOE on
the virtual interface and nnm* = 0 to will disable native netmap
support.

# number of normal NIC queues
hw.cxgbe.ntxq_vi
hw.cxgbe.nrxq_vi

# number of TOE queues
hw.cxgbe.nofldtxq_vi
hw.cxgbe.nofldrxq_vi

# number of netmap queues
hw.cxgbe.nnmtxq_vi
hw.cxgbe.nnmrxq_vi

hw.cxgbe.nnm{t,r}xq{10,1}g tunables have been removed.

--- tl;dr version ---
The workflow for netmap on cxgbe starting with FreeBSD 11 is:
1) "device netmap" in the kernel config.
2) "hw.cxgbe.num_vis=2" in loader.conf.  num_vis > 2 is ok too, you'll
end up with multiple autonomous netmap-capable interfaces for every
port.
3) "dmesg | grep vcxl | grep netmap" to verify that the interface has
netmap queues.
4) Use any of the 'v' interfaces for netmap.  pkt-gen -i vcxl<n>... .
One major improvement is that the netmap interface has a normal data
path as expected.
5) Just ignore the cxl interfaces if you want to use netmap only.  No
need to bring them up.  The vcxl interfaces are completely independent
and everything should just work.
---------------------

Approved by:	re@ (gjb@)
Relnotes:	Yes
Sponsored by:	Chelsio Communications
2016-06-23 02:53:00 +00:00
Adrian Chadd
9134b0870a revert error commit from previous commit. my bad!
Approved by:	re (implicit)
2016-06-23 01:15:35 +00:00
Adrian Chadd
31318f0793 [BHND/bcma] Add implementation of BHND_BUS_RESET_CORE function for BCMA
This patch addes missing implementation of BHND_BUS_RESET_CORE function for BCMA.
The reset procedure is very simple: enable reset mode, stop clocking,
enable clocking & force clock gating, disable reset mode, stop clock gating.

Tested:

* (michael) Tested on ASUS RT-N53 for enabling/reset USB core

Submitted by:	Michael Zhilin <mizhka@gmail.com>
Approved by:	re (gjb)
2016-06-23 01:14:33 +00:00
Adrian Chadd
1eccf20376 [iwm] Use mbuf for large firmware commands, like OpenBSD does.
We also need to consider the size of large firmware commands in iwm_alloc_tx_ring(),
in the dma tag creation, when qid == IWM_MVM_CMD_QUEUE. The old code apparently
only allocated a 2KB (MCLBYTES) sized buffer when it actually expected 4KB.

Submitted by:	Imre Vadasz <imre@vdsz.com>
Approved by:	re (gjb)
Differential Revision:	https://reviews.freebsd.org/D6824
2016-06-23 01:13:30 +00:00