Commit Graph

112231 Commits

Author SHA1 Message Date
Warner Losh
34dc8f1bb4 Kill a few stray debug printfs. 2016-07-28 22:40:31 +00:00
Alan Cox
f095d1bbc7 Remove any mention of cache (PG_CACHE) pages from the comments in
vm_pageout_scan().  That function has not cached pages since r284376.

MFC after:	3 days
2016-07-28 22:30:48 +00:00
Brooks Davis
40018b91dd Don't create pointless backups of generated files in "make sysent".
Any sensible workflow will include a revision control system from which
to restore the old files if required.  In normal usage, developers just
have to clean up the mess.

Reviewed by:	jhb
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D7353
2016-07-28 21:29:04 +00:00
Brooks Davis
e9004cefe9 cxgbe's firmware module fails to build on mips64 as well as mips32 so
disable for all mips.

Sponsored by:	DARPA, AFRL
2016-07-28 21:27:47 +00:00
Andrew Gallatin
0e3b891988 Call tcp_notify() directly to shoot down routes, rather than
calling in_pcbnotifyall().

This avoids lock contention on tcbinfo due to in_pcbnotifyall()
holding the tcbinfo write lock while walking all connections.

Reviewed by:	rrs, karels
MFC after:	2 weeks
Sponsored by:	Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D7251
2016-07-28 19:32:25 +00:00
Stephen J. Kiernan
f11ec79842 Remove BSD and USL copyright and update license block in in_prot.c, as the
code in this file was written by Robert N. M. Waston.

Move cr_can* prototypes from sys/systm.h to sys/proc.h

Reported by:	rwatson
Reviewed by:	rwatson
Approved by:	sjg (mentor)
Differential Revision:	https://reviews.freebsd.org/D7345
2016-07-28 18:39:30 +00:00
John Baldwin
29c229e9fc Mark spg_len and fl_pktshift static.
These variables are no longer exported to t4_netmap.c after r296478.
2016-07-28 17:37:12 +00:00
Ruslan Bukin
9346408d90 Normalise the CWARNFLAGS inter-word spacing: remove all leading
and trailing space, and convert multiple consecutive spaces to
single space.

This helps to keep build output looking good.
2016-07-28 17:18:02 +00:00
Konstantin Belousov
88ad2d7b47 Do not delegate a work to geom event thread which can be done inline.
In particular, swapongeom_ev() needed event thread context when swap
pager configuration was performed under Giant and geom asserted that
Giant is not owned.  Now both of the reason went away.

On the other hand, note that swpageom_release() is called from the
bio_done context, and possible close cannot be performed inline.

Also fix some minor issues.  The swapgeom() function does not use the
td argument, remove it.  Recheck that the vnode passed is still VCHR
and not reclaimed after the lock.

Reviewed by:	mav
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2016-07-28 15:57:01 +00:00
Konstantin Belousov
2174a0c607 Fix style and typo.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-07-28 15:49:51 +00:00
Ed Maste
45eff3df96 remove CONSTRUCTORS from kernel linker scripts
The linker script CONSTRUCTORS keyword is only meaningful "when linking
object file formats which do not support arbitrary sections, such as
ECOFF and XCOFF"[1] and is ignored for other object file formats.

LLVM's lld does not yet accept (and ignore) CONSTRUCTORS, so just remove
CONSTRUCTORS from the linker scripts as it has no effect.

[1] https://sourceware.org/binutils/docs/ld/Output-Section-Keywords.html

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7343
2016-07-28 13:54:46 +00:00
Ruslan Bukin
8da8940319 Build ofw_bus_if.h for modules for RISC-V. 2016-07-28 13:21:45 +00:00
Ruslan Bukin
c760a23737 Build DTrace assym.o with -msoft-float flag for RISC-V so we have
correct flag in ELF file.

Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-07-28 13:18:10 +00:00
Ruslan Bukin
96c072fcb0 o Add warn flags required to build modules with GCC 6.1;
o Sort GCC 4.8 warn flags.

Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-07-28 13:15:23 +00:00
Alexander Motin
8709930cfc Fix r303429 build with invariants. 2016-07-28 12:25:58 +00:00
Ed Schouten
5590eb985e Regenerate system call table for r303435. 2016-07-28 12:22:34 +00:00
Ed Schouten
d9c4cd2fbc Change the return type of msgrcv() to ssize_t as required by POSIX.
It looks like the msgrcv() system call is already written in such a way
that the size is internally computed as a size_t and written into all of
td_retval[0]. This means that it is effectively already returning
ssize_t. It's just that the userspace prototype doesn't match up.
2016-07-28 12:22:01 +00:00
Alexander Motin
4490696b3e Once more refactor KPI between NTB hardware and consumers.
New design allows hardware resources to be split between several consumers.
For example, one BAR can be dedicated for remote memory access, while other
resources can be used for packet transport for virtual Ethernet interface.
And even without resource split, this code allows to specify which consumer
driver should attach the hardware.

From some points this makes the code even closer to Linux one, even though
Linux does not provide the described flexibility.
2016-07-28 10:48:20 +00:00
Konstantin Belousov
2d19b736ed Rewrite subr_sleepqueue.c use of callouts to not depend on the
specifics of callout KPI.  Esp., do not depend on the exact interface
of callout_stop(9) return values.

The main change is that instead of requiring precise callouts, code
maintains absolute time to wake up.  Callouts now should ensure that a
wake occurs at the requested moment, but we can tolerate both run-away
callout, and callout_stop(9) lying about running callout either way.

As consequence, it removes the constant source of the bugs where
sleepq_check_timeout() causes uninterruptible thread state where the
thread is detached from CPU, see e.g. r234952 and r296320.

Patch also removes dual meaning of the TDF_TIMEOUT flag, making code
(IMO much) simpler to reason about.

Tested by:	pho
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D7137
2016-07-28 09:09:55 +00:00
Konstantin Belousov
a9e182e895 Extract the calculation of the callout fire time into the new function
callout_when(9).  See the man page update for the description of the
intended use.

Tested by:	pho
Reviewed by:	jhb, bjk (man page updates)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
X-Differential revision:	https://reviews.freebsd.org/D7137
2016-07-28 08:57:01 +00:00
Konstantin Belousov
ad90086e85 Fix typo in comment.
MFC after:  3 days
2016-07-28 08:53:38 +00:00
Konstantin Belousov
b7a25e63b6 When a debugger attaches to the process, SIGSTOP is sent to the
target.  Due to a way issignal() selects the next signal to deliver
and report, if the simultaneous or already pending another signal
exists, that signal might be reported by the next waitpid(2) call.
This causes minor annoyance for debuggers, which must be prepared to
take any signal as the first event, then filter SIGSTOP later.

More importantly, for tools like gcore(1), which attach and then
detach without processing events, SIGSTOP might leak to be delivered
after PT_DETACH.  This results in the process being unintentionally
stopped after detach, which is fatal for automatic tools.

The solution is to force SIGSTOP to be the first signal reported after
the attach.  Attach code is modified to set P2_PTRACE_FSTP to indicate
that the attaching ritual was not yet finished, and issignal() prefers
SIGSTOP in that condition.  Also, the thread which handles
P2_PTRACE_FSTP is made to guarantee to own p_xthread during the first
waitpid(2).  All that ensures that SIGSTOP is consumed first.

Additionally, if P2_PTRACE_FSTP is still set on detach, which means
that waitpid(2) was not called at all, SIGSTOP is removed from the
queue, ensuring that the process is resumed on detach.

In issignal(), when acting on STOPing signals, remove the signal from
queue before suspending.  Otherwise parallel attach could result in
ptracestop() acting on that STOP as if it was the STOP signal from the
attach.  Then SIGSTOP from attach leaks again.

As a minor refactoring, some bits of the common attach code is moved
to new helper proc_set_traced().

Reported by:	markj
Reviewed by:	jhb, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D7256
2016-07-28 08:41:13 +00:00
Sepherosa Ziehau
7d8ee480c4 hyperv/vmbus: Inclusion cleanup
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7334
2016-07-28 06:46:10 +00:00
Sepherosa Ziehau
0bc135dffc hyperv/vmbus: Avoid unnecessary mb()
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7333
2016-07-28 06:30:29 +00:00
Luiz Otavio O Souza
92ee0c01d4 Enable the build of micphy as part of generic miibus build, but only for
FDT enabled systems.

Sponsored by:	Rubicon Communications (Netgate)
2016-07-28 05:59:56 +00:00
Imre Vadász
34938c3085 [iwm] When stopping TX DMA, wait for all channels at once.
* Makes the TX DMA stopping more similar to Linux code, and potentially
      a bit faster. Also, output an error message when TX DMA idling fails.

    Taken-From: Linux iwlwifi

Tested:

* AC3165, STA mode

Approved by:	adrian (mentor)
Obtained from:	DragonFlyBSD git 2ee486ddff973ac552ff787c17e8d83e8ae0f24c
Differential Revision:	https://reviews.freebsd.org/D7325
2016-07-27 20:51:31 +00:00
Bryan Drewery
a3f1ec8d91 opt_bdg.h was removed in r150636.
MFC after:	3 days
Sponsored by:	EMC / Isilon Storage Division
2016-07-27 20:48:15 +00:00
Imre Vadász
2b8cf46a68 [iwm] Set different pm_timeout for action frames.
When building a Tx Command for management frames, we are lacking
    a check for action frames, for which we should set a different
    pm_timeout.  This cause the fw to stay awake for 100TU after each
    such frame is transmitted, resulting an excessive power consumption.

    Taken-From: Linux iwlwifi (git b084a35663c3f1f7)

Approved by:	adrian (mentor)
Obtained from:	Linux git b084a35663c3f1f7de1c45c4ae3006864c940fe7
Obtained from:	DragonFlyBSD git ba00f0e3ae873d6f0d5743e22c3ebc49c44dfdac
Differential Revision:	https://reviews.freebsd.org/D7324
2016-07-27 20:46:51 +00:00
Bryan Drewery
ce85964181 opt_apic.h is only used on i386.
MFC after:	3 days
Sponsored by:	EMC / Isilon Storage Division
2016-07-27 20:45:00 +00:00
Bryan Drewery
1a27b3ad56 opt_random.h was removed in r287558 for opt_global.h
MFC after:	3 days
Sponsored by:	EMC / Isilon Storage Division
2016-07-27 20:44:53 +00:00
Imre Vadász
74adf80539 [iwm] Fix inverted logic in iwm_tx().
The PROT_REQUIRE flag in should be set for data frames above a certain
    length, but we were setting it for !data frames above a certain length,
    which makes no sense at all.

    Taken-From: OpenBSD, Linux iwlwifi

Approved by:	adrian (mentor)
Obtained from:	DragonFlyBSD git 8cc03924a36c572c2908e659e624f44636dc2b33
Differential Revision:	https://reviews.freebsd.org/D7323
2016-07-27 20:43:08 +00:00
Stephen J. Kiernan
4ac21b4f09 Prepare for network stack as a module
- Move cr_canseeinpcb to sys/netinet/in_prot.c in order to separate the
   INET and INET6-specific code from the rest of the prot code (It is only
   used by the network stack, so it makes sense for it to live with the
   other network stack code.)
 - Move cr_canseeinpcb prototype from sys/systm.h to netinet/in_systm.h
 - Rename cr_seeotheruids to cr_canseeotheruids and cr_seeothergids to
   cr_canseeothergids, make them non-static, and add prototypes (so they
   can be seen/called by in_prot.c functions.)
 - Remove sw_csum variable from ip6_forward in ip6_forward.c, as it is an
   unused variable.

Reviewed by:	gnn, jtl
Approved by:	sjg (mentor)
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D2901
2016-07-27 20:34:09 +00:00
John Baldwin
b9a53e161b Adjust tests in fsync job scheduling loop to reduce indentation. 2016-07-27 19:31:25 +00:00
John Baldwin
07159830be Add support for zero-copy aio_write() on TOE sockets.
AIO write requests for a TOE socket on a Chelsio T4+ adapter can now
DMA directly from the user-supplied buffer.  This is implemented by
wiring the pages backing the user-supplied buffer and queueing special
mbufs backed by raw VM pages to the socket buffer.  The TOE code
recognizes these special mbufs and builds a sglist from the VM page
array associated with the mbuf when queueing a work request to the TOE.

Because these mbufs do not have an associated virtual address, m_data
is not valid.  Thus, the AIO handler does not invoke sosend() directly
for these mbufs but instead inlines portions of sosend_generic() and
tcp_usr_send().

An aiotx_buffer structure is used to describe the user buffer (e.g.
it holds the array of VM pages and a reference to the AIO job).  The
special mbufs reference this structure via m_ext.  Note that a single
job might be split across multiple mbufs (e.g. if it is larger than
the socket buffer size).  The 'ext_arg2' member of each mbuf gives an
offset relative to the backing aiotx_buffer.  The AIO job associated
with an aiotx_buffer structure is completed when the last reference to
the structure is released.

Zero-copy aio_write()'s for connections associated with a given
adapter can be enabled/disabled at runtime via the
'dev.t[45]nex.N.toe.tx_zcopy' sysctl.

MFC after:	1 month
Relnotes:	yes
Sponsored by:	Chelsio Communications
2016-07-27 18:29:35 +00:00
Mark Johnston
3ac8f842ea De-pluralize "queues" where appropriate in the pagedaemon code.
MFC after:	1 week
2016-07-27 17:11:03 +00:00
Ed Maste
18c23dffac ANSIfy kern_proc.c and delete register keyword
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D6478
2016-07-27 14:27:08 +00:00
Konstantin Belousov
1822421c0b Remove Giant from settime(), tc_setclock_mtx guards tc_windup() calls,
and there is no other issues with parallel settime().  Remove spl()
vestiges there as well.

Tested by:	pho (as part of the whole patch)
Reviewed by:	jhb (same)
Discussed wit:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D7302
2016-07-27 11:54:24 +00:00
Konstantin Belousov
5760b029ee Prevent parallel tc_windup() calls, both parallel top-level calls from
setclock() and from simultaneous top-level and interrupt.  For this,
tc_windup() is protected with a tc_setclock_mtx spinlock, in the try
mode when called from hardclock interrupt.  If spinlock cannot be
obtained without spinning from the interrupt context, this means that
top-level executes tc_windup() on other core and our try may be
avoided.

The boottimebin and boottime variables should be adjusted from
tc_windup().  To be correct, they must be part of the timehands and
read using lockless protocol.  Remove the globals and reimplement the
getboottime(9)/getboottimebin(9) KPI using the timehands read
protocol.

Tested by:	pho (as part of the whole patch)
Reviewed by:	jhb (same)
Discussed wit:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
X-Differential revision:	https://reviews.freebsd.org/D7302
2016-07-27 11:49:41 +00:00
Konstantin Belousov
4493f659e5 Fix a bug in r302252.
Change ntpadj_lock to spinlock always, and rename stuff removing
ADJ/adj from the names. ntp_update_second() requires ntp_lock and is
called from the tc_windup(), so ntp_lock must be a spinlock.  Add
missed lock to ntp_update_second().

Tested by:	pho (as part of the whole patch)
Reviewed by:	jhb (same)
Noted by:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
X-Differential revision:	https://reviews.freebsd.org/D7302
2016-07-27 11:40:06 +00:00
Konstantin Belousov
21547fc7ca Reduce the resettodr_lock scope to only CLOCK_SETTIME() call.
Tested by:	pho (as part of the whole patch)
Reviewed by:	jhb (same)
Discussed with:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
X-Differential revision:	https://reviews.freebsd.org/D7302
2016-07-27 11:34:25 +00:00
Konstantin Belousov
4d29106e55 Style.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
X-Differential revision:	https://reviews.freebsd.org/D7302
2016-07-27 11:33:33 +00:00
Konstantin Belousov
a83c016f00 Reduce number of timehands to just two. This is useful because
consumers can now be only one tc_windup() call late.

Use C99 initialization.

Tested by:	pho (as part of the whole patch)
Reviewed by:	jhb (same)
Discussed with:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
X-Differential revision:	https://reviews.freebsd.org/D7302
2016-07-27 11:27:52 +00:00
Konstantin Belousov
584b675ed6 Hide the boottime and bootimebin globals, provide the getboottime(9)
and getboottimebin(9) KPI. Change consumers of boottime to use the
KPI.  The variables were renamed to avoid shadowing issues with local
variables of the same name.

Issue is that boottime* should be adjusted from tc_windup(), which
requires them to be members of the timehands structure.  As a
preparation, this commit only introduces the interface.

Some uses of boottime were found doubtful, e.g. NLM uses boottime to
identify the system boot instance.  Arguably the identity should not
change on the leap second adjustment, but the commit is about the
timekeeping code and the consumers were kept bug-to-bug compatible.

Tested by:	pho (as part of the bigger patch)
Reviewed by:	jhb (same)
Discussed with:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
X-Differential revision:	https://reviews.freebsd.org/D7302
2016-07-27 11:08:59 +00:00
Sepherosa Ziehau
dc831186e3 hyperv/vmbus: Rename cleaned up bufring code
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7318
2016-07-27 09:27:08 +00:00
Sepherosa Ziehau
b5ddb4093a hyperv/vmbus: Cleanup RX bufring read process.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7317
2016-07-27 07:36:54 +00:00
Sepherosa Ziehau
3ddfec1f17 hyperv/vmbus: Stringent RX bufring data length checks.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7316
2016-07-27 07:19:06 +00:00
Sepherosa Ziehau
455cc95f3f hyperv/vmbus: Cleanup TX bufring write process.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7315
2016-07-27 06:52:43 +00:00
Sepherosa Ziehau
ca7c18e5c4 hyperv/vmbus: Update comment for bufring
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7314
2016-07-27 06:36:57 +00:00
Sepherosa Ziehau
ea06b5d3ec hyperv/vmbus: Use different struct for RX/TX bufring.
So that they can use suitable MP synchronization mechanism.

While I'm here change the bufring init/read/write function names.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7313
2016-07-27 06:17:20 +00:00
Sepherosa Ziehau
a0c3998ea9 hyperv/vmbus: Initialize RX/TX bufring mutex at channel creation time
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7312
2016-07-27 05:47:32 +00:00
Alan Cox
a766ffd061 Update a comment to reflect r284376.
MFC after:	3 days
2016-07-27 03:49:00 +00:00
Stephen J. Kiernan
cc37baea09 Add the NUM_CORE_FILES kernel config option which specifies the limit for the
number of core files allowed by a particular process when using the %I core
file name pattern.

Sanity check at compile time to ensure the value is within the valid range of
0-10.

Reviewed by:	jtl, sjg
Approved by:	sjg (mentor)
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D6812
2016-07-27 03:21:02 +00:00
Ian Lepore
fe67c84656 Annotate the usb-serial drivers which always return 0 for line status,
so that it'll be easier to find and fix them in the future.
2016-07-27 00:08:01 +00:00
Ian Lepore
d83433299b Translate modem status reg bits from ns16550 to SER_* values used by the
tty layer.

Also annotate a switch case fall-through per style(9).
2016-07-27 00:03:18 +00:00
Ian Lepore
d88e7bb082 Translate modem status reg bits from ns16550 to SER_* values used by the
tty layer.

Also annotate a switch case fall-through per style(9).
2016-07-26 23:42:42 +00:00
Navdeep Parhar
17146cd543 cxgbe(4): Initialize the adapter queues (fwq and mgmtq) instead of
returning EAGAIN if they aren't available when the user tries to program
a filter.  Do this after validating the filter so that the driver
doesn't bring up the queues if it doesn't have to.
2016-07-26 23:29:37 +00:00
Ian Lepore
ab3249b590 Translate modem status reg bits from ns16550 to SER_* values used by the
tty layer.  Also, the line status reg bits are already ns16550 as expected
by the ucom layer, so no need for translation or a local var to hold them.
2016-07-26 23:27:28 +00:00
Ian Lepore
b90ce50491 Actually return line status register values from umoscom_cfg_get_status().
The hardware delivers ns16550-compatible status bits, which is what the
usb_serial code expects, so no need for translation, no need for a local
variable to hold a temporary lsr result.
2016-07-26 22:26:49 +00:00
Brad Davis
439e76ec22 Fix the case for some sysctl descriptions.
Reviewed by:	gnn
2016-07-26 20:20:09 +00:00
Ed Schouten
f63cd251b2 Add shmatt_t.
It looks like our "struct shmid_ds::shm_nattch" deviates from the
standard in the sense that it is a signed integer, whereas POSIX
requires that it is unsigned, having a special type shmatt_t.

Patch up our native and 32-bit copies to use a new shmatt_t that is an
unsigned integer. As it's unsigned, we can relax the comparisons that
are performed on it. Leave the Linux, iBCS2, etc. copies of the
structure alone.

Reviewed by:	ngie
Differential Revision:	https://reviews.freebsd.org/D6655
2016-07-26 17:23:49 +00:00
Adrian Chadd
a68401914f Update my TODO items. 2016-07-26 16:40:03 +00:00
Ed Maste
8ee0bdb9fb vt: lock Giant around kbd calls in CONS_GETINFO
Note that keyboards are stored in an array and are not freed (just
"unregistered" by clearing some fields) so a race would be limited to
obtaining stale information about an unregistered keyboard.

Reported by:	CTurt
MFC after:	3 days
2016-07-26 15:34:26 +00:00
Ed Maste
bbecb73b0e apply some style(9) to kbd: make function name start in column 1
Sponsored by:	The FreeBSD Foundation
2016-07-26 13:36:28 +00:00
Sepherosa Ziehau
34c30e12e2 hyperv/vmbus: Nuke unnecessary accessor functions.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7303
2016-07-26 05:06:00 +00:00
Sean Bruno
6a5bc1d1ee iwm(4) synchronize driver to DragonFlyBSD version and recent f/w update.
Submitted by:	Kevin Bowling (kevin.bowling@kev009.com)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D6967
2016-07-26 00:02:17 +00:00
Sean Bruno
33c7715f9b iwm(4): switch to ieee80211_runtask()
Submitted by:	Andiry Voskoboinyk (s3erios@gmail.com)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D5054
2016-07-25 23:44:44 +00:00
Sean Bruno
e4ff429714 Update iwmfw(4) to include support for 8260 series units and update
f/w for the other devices supported by this driver.

Patch linked in https://reviews.freebsd.org/D6967 but not actually
a part of the review.

Obtained from DragonflyBSD.

Submitted by:   Kevin Bowling <kev009@kev009.com>
MFC after:      2 weeks
Relnotes:       yes
2016-07-25 23:05:25 +00:00
Warner Losh
964fee41a3 Remove some extraneous printfs. 2016-07-25 19:16:30 +00:00
Conrad Meyer
af326ace9d devfs: Move most ioctl logic down to vnode layer
Devfs' file layer ioctl is now just a thin shim around the vnode layer.

Reviewed by:	kib
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D7286
2016-07-25 16:28:02 +00:00
Andrew Turner
1af4207389 Remove an unused variable.
Obtained from:	ABT Systems Ltd
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-07-25 16:18:20 +00:00
Andrew Turner
0f0b7aa289 Fix a typo in a string in a KASSERT to sanity check the CPU IDs.
Obtained from:	ABT Systems Ltd
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-07-25 15:59:31 +00:00
Andrew Turner
8ec2b5df73 Rework how we number CPUs on arm64 to try and keep clusters together.
Obtained from:	ABT Systems Ltd
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-07-25 15:57:13 +00:00
Andrew Turner
abf5bdb441 Enable the generic OHCI driver on arm64
Obtained from:	ABT Systems Ltd
MFC after:	1 month
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
2016-07-25 14:49:15 +00:00
Andrey V. Elsukov
1f353a2315 Do not invoke resize method if geom is being withered.
PR:		211028
MFC after:	2 weeks
2016-07-25 09:12:08 +00:00
Julian Elischer
591d7b63ca Split MAKE_SYSENT into two parts so that the initializer part can be
used separately if one wants to embed the sysent into a larger structure.

MFC after:	1 week
2016-07-25 08:13:50 +00:00
Sepherosa Ziehau
afffab7e8b hyperv/vmbus: Move bufring info definition to vmbus_brvar.h
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7282
2016-07-25 03:30:26 +00:00
Sepherosa Ziehau
7dd8881ca6 hyperv/vmbus: Rename hv_vmbus_priv.h to vmbus_brvar.h
It only contains bufring related bits for a while.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7281
2016-07-25 03:12:40 +00:00
Ed Maste
8485a1f677 avoid building otusfw when WITHOUT_SOURCELESS_UCODE set
PR:		204748
Submitted by:	Fabian Keil
Obtained from:	ElectroBSD
MFC after:	1 week
2016-07-25 00:49:27 +00:00
Ruslan Bukin
8500b15f9f Fix style. 2016-07-24 18:04:12 +00:00
Alexander Motin
c072301617 Postpone ntb_get_msix_info() till we need to negotiate MSIX.
Calling it earlier increases the window when MSIX info may change.
This change does not solve the problem completely, but seems logical.
Complete solution should probably include link reset in case of MSIX
remap to trigger new negotiation, but we have no way to get notified
about that now.
2016-07-24 14:42:11 +00:00
Gleb Smirnoff
32e0ade6c4 Partially revert r257696/r257713, which have an issue with writing to user
controlled address. Restore the old code that emulated OSIOCGIFCONF in if.c.

Noticed by:	C Turt
2016-07-24 10:10:09 +00:00
Alexander Motin
fb112f72a8 Add more UEFI/e820 memory types from latest specifications.
This is only cosmetics.

MFC after:	2 weeks
2016-07-24 09:15:11 +00:00
Andrew Turner
07ef31f240 Remove now unused functions from the FDT uart cpu driver.
Obtained from:	ABT Systems Ltd
MFC after:	1 month
X-MFC with:	r303100
Sponsored by:	The FreeBSD Foundation
2016-07-24 08:52:49 +00:00
Michael Zhilin
334453c5a9 [nvram2env] split implementation into generic & MIPS-based code
Split implementation of nvram2env to generic (MI) & MIPS-based code:

 - removed includes like "*siba*", because they are unused
 - added nvram2env_mips.c file with MIPS-specific code, code moved from nvram2env.c
 - added header file to shared defines/structures/function prototypes between MI and MIPS code

Also this fix allows to implement own nvram2env drivers.

Reviewed by:    ray, adrian (mentor)
Approved by:    adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D6513
2016-07-24 08:35:45 +00:00
Luiz Otavio O Souza
285e3c3ea9 Allow the use of micphy on am335x devices.
The Micrel PHYs reads the optional external delays from DTB.

Tested and used by uBMC and uFW.

Sponsored by:	Rubicon Communications (Netgate)
2016-07-24 01:31:41 +00:00
Mark Johnston
44be0a8ea5 Correct a comment - each page queue has its own lock.
Reviewed by:	alc
MFC after:	3 days
2016-07-23 21:03:25 +00:00
Mark Johnston
efe1ff4cf0 Update a comment in vm_page_advise() to match behaviour after r290529.
Reviewed by:	alc
MFC after:	3 days
2016-07-23 21:02:36 +00:00
Luiz Otavio O Souza
67a48226b7 Add support for the Microchip/Micrel KSZ9031 Gigabit Ethernet PHY.
Tested on uBMC and uFW.

Sponsored by:	Rubicon Communications (Netgate)
2016-07-23 18:16:40 +00:00
Luiz Otavio O Souza
522f50c5a0 Remove unused USB ethernet driver from BEAGLEBONE/AM335x kernel. 2016-07-23 17:36:17 +00:00
Navdeep Parhar
3e560c5393 Fix kernel builds with "device cxgbe". 2016-07-23 15:12:03 +00:00
John Baldwin
ab59c4d9f1 Use MTX_SYSINIT for the VESA lock.
vesa_init_done isn't a reliable guard for the mutex init.  If
vesa_configure() doesn't find valid VESA info it will not set
vesa_init_done, but the lock will remain initialized.  Revert r303076
and use MTX_SYSINIT to deterministically init the lock.

Reviewed by:	royger
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D7290
2016-07-23 14:38:09 +00:00
Konstantin Belousov
90b581f2cc Implement mtx_trylock_spin(9).
Discussed with:	bde
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D7192
2016-07-23 05:30:55 +00:00
Justin Hibbits
d071aa6df2 Use label math instead of hard-coding offsets for return addresses.
Though the chances of the code in these sections changing are low, future-proof
the sections and use label math.

Renumber the surrounding areas to avoid duplicate label numbers.
2016-07-23 02:27:42 +00:00
John Baldwin
f91fca5ba7 Add a driver to create VF devices on Chelsio T4/T5 NICs.
Chelsio NICs are a bit unique compared to some other NICs in that they
expose different functionality on different physical functions.  In
particular, PF4 is used to manage the NIC interfaces ('t4nex' and 't5nex').
However, PF4 is not able to create VF devices.  Instead, VFs are only
supported by physical functions 0 through 3.  This commit adds 't4iov'
and 't5iov' drivers that attach to PF0-3.

One extra wrinkle is that the iov devices cannot enable SR-IOV until the
firwmare has been initialized by the main PF4 driver.  To handle this
case, a new t4_if kobj interface has been added to permit cross-calls
between the PF drivers.  The PF4 driver notifies sibling drivers when it
is fully attached.  It also requests sibling drivers to detach before it
detaches.  Sibling drivers query the PF4 driver during their attach
routine to see if it is attached.  If not, the sibling drivers defer
their attach actions until the PF4 driver informs them it is attached.

VF devices are associated with a single port on the NIC.  VF devices
created from PF0 are associated with the first port on the NIC, VFs
from PF1 are associated with the second port, etc.  VF devices can
only be created from a PF device that has an associated port.  Thus,
on a 2-port card, VFs are only supported on PF0 and PF1.

Reviewed by:	np (earlier versions)
MFC after:	1 month
Sponsored by:	Chelsio Communications
2016-07-22 22:46:41 +00:00
John Baldwin
069af0eb14 Install a handler for firmware work request error messages.
If a driver sends an malformed or disallowed work request, the firmware
responds with a work request error.  Previously the driver treated this is
as an unexpected message and panicked.  Now it decodes the error message
to aid in debugging.

Reviewed by:	np (older version)
MFC after:	1 month
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D6950
2016-07-22 21:52:07 +00:00
Bryan Drewery
f5dac37f96 Don't run find(1) for __MPATH with NO_MODULES set.
It's a waste of time when it won't be used.

Submitted by:	bde
MFC after:	3 days
2016-07-22 17:31:14 +00:00
Ruslan Bukin
c4dc5cdb7b Add GCC 6.1 warn flags for kernel as well.
Sponsored by:	DARPA, AFRL
2016-07-22 16:15:35 +00:00
Emmanuel Vadot
1c26086e73 PC5 doesn't have mmc2 function. 2016-07-22 14:39:55 +00:00
Konstantin Belousov
7c627f3468 Make cam.ko loadable.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-07-22 06:21:03 +00:00
Sepherosa Ziehau
031e155216 hyperv/vmbus: Move vmbus bufring definition to vmbus_reg.h
And add more comment about its fields.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7269
2016-07-22 05:09:08 +00:00
Sepherosa Ziehau
bafad35c7d hyperv/vmbus: Cleanup and augment bufring sysctl tree creation
Binary state node is added, so that userland programs do not have
to parse human readable state string.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7268
2016-07-22 03:42:32 +00:00
Sepherosa Ziehau
a6c54e7eea hyperv/vmbus: Cosmetic bufring cleanup.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7267
2016-07-22 03:30:00 +00:00
Mike Karels
ea17754c5a Fix per-connection L2 caching in fast path
r301217 re-added per-connection L2 caching from a previous change,
but it omitted caching in the fast path.  Add it.

Reviewed By: gallatin
Approved by: gnn (mentor)
Differential Revision: https://reviews.freebsd.org/D7239
2016-07-22 02:11:49 +00:00
Warner Losh
03a9f9e062 Add opt_ddb.h.
MFC after: 1 week
2016-07-21 23:29:16 +00:00
Warner Losh
d12543e0c1 Fix cam builds w/o nvme. This is a stop-gap fix until the real fix of
dynamically loading XPTs is done and tested.

MFC After: 1 week
2016-07-21 23:29:13 +00:00
John Baldwin
9c20dc9963 Add more documentation regarding unsafe AIO requests.
The asynchronous I/O changes made previously result in different
behavior out of the box. Previously all AIO requests failed with
ENOSYS / SIGSYS unless aio.ko was explicitly loaded. Now, some AIO
requests complete and others ("unsafe" requests) fail with EOPNOTSUPP.

Reword the introductory paragraph in aio(4) to add a general
description of AIO before describing the vfs.aio.enable_unsafe sysctl.

Remove the ENOSYS error description from aio_fsync(2), aio_read(2),
and aio_write(2) and replace it with a description of EOPNOTSUPP.

Remove the ENOSYS error description from aio_mlock(2).

Log a message to the system log the first time a process requests an
"unsafe" AIO request that fails with EOPNOTSUPP. This is modeled on
the log message used for processes using the legacy pty devices.

Reviewed by:	kib (earlier version)
MFC after:	1 week
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D7151
2016-07-21 22:49:47 +00:00
Konstantin Belousov
492fe1b774 Hide counted_warning(9) under #ifdef _KERNEL braces, to allow building
subr_prf.c in userspace for libsbuf.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-07-21 17:59:30 +00:00
Konstantin Belousov
9fe297bbdc Declare aio requests on files from local filesystems safe.
Two notes:
- I allow AIO on reclaimed vnodes, since it is deterministically terminated
  fast.
- devfs mounts are marked as MNT_LOCAL, but device vnodes have type
  VCHR, so the slow device io is not allowed.

Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D7273
2016-07-21 17:07:06 +00:00
Konstantin Belousov
9837947b07 Provide counter_warning(9) KPI which allows to issue limited number of
warnings for some kernel events, mostly intended for the use of
obsoleted or otherwise undersired interfaces.

This is an abstracted and race-expelled code from compat pty driver.

Requested and reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D7270
2016-07-21 16:34:56 +00:00
Adrian Chadd
303c356245 [mx25l] add new device id.
Tested:

* (submitter) TP-Link TL-WR1043nd v3

Submitted by:	tj@enoti.me
2016-07-21 15:48:41 +00:00
Emmanuel Vadot
852047d66a axp209 needs aw_nmi so attach a bit earlier
Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D7081
2016-07-21 13:28:07 +00:00
Emmanuel Vadot
be79f382c8 We need the GIC to be attached so attach later at BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE
Reviewed by:	andrew
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D7080
2016-07-21 13:26:39 +00:00
Andrew Turner
951154084f Fix the build:
* Add acpi_if.h to the SRC list in the uart module
 * Only include new acpi headers when they are needed

Obtained from:	ABT Systems Ltd
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-07-21 13:01:35 +00:00
Andrew Turner
cf9df3c56b Add support for arm64 to uart_dev_acpi by using the _HID property to find
the uart class to use in a similar way as the fdt driver.

Obtained from:	ABT Systems Ltd
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7248
2016-07-21 09:32:55 +00:00
Sepherosa Ziehau
82b8a87964 hyperv: hv_vmbus_channel -> vmbus_channel
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7260
2016-07-21 06:09:47 +00:00
Sepherosa Ziehau
f62b3ae3be hyperv/vmbus: Shuffle function declaration and macro definition.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7259
2016-07-21 05:46:26 +00:00
Sepherosa Ziehau
3fcf36f408 hyperv/vmbus: Reorder channel fields.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7258
2016-07-21 05:38:05 +00:00
Sepherosa Ziehau
f617e011c9 hyperv/vmbus: Save event flag location and evet flag mask.
This avoids unnecessary access to the vmbus_softc struct on sending path.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7257
2016-07-21 05:30:31 +00:00
Warner Losh
3a31c31c22 Actually import nvme_sim so the CAM attachment for NVME (nda) actually
works.

MFC after: 1 week
2016-07-21 03:11:39 +00:00
Warner Losh
e0ce51cb80 Remove some bogus comments and printfs. Also, we can't
cam_periph_releaes_locked() at the end of nvme_probe_start because we
hit an assertion which may be bogus. Instead, leak a periph until we
sort it out. Since these devices don't arrive and depart often, so
this is the lessor of two evils.

MFC after: 1 week
2016-07-21 03:11:37 +00:00
Warner Losh
336b7b6665 Fix mismerge and add NVME xport support to devstat (or rather, exclude
it from SCSI).

MFC after: 1 week
2016-07-21 03:11:36 +00:00
Warner Losh
b24ced67d0 Fix mismerge and include the nvme support.
Also, print out the name of any CCB's functions that's not supported.

MFC after: 1 week
2016-07-21 03:11:35 +00:00
Conrad Meyer
1005d8aff4 imgact_elf: Rename the segment iterator to match reality
The each_writable_segment routine evaluates segments on a slightly little more
nuanced metric than simply "writable" or not.  Rename the function to more
closely match its behavior (each_dumpable_segment).

Suggested by:	jhb
Sponsored by:	EMC / Isilon Storage Division
2016-07-20 22:51:33 +00:00
Conrad Meyer
f3325003d9 ANSI-fy imgact_elf.c
Sponsored by:	EMC / Isilon Storage Division
2016-07-20 22:46:56 +00:00
Andriy Voskoboinyk
73bb505548 urtwn: fix A-MSDU tx aggregation when encryption is used.
Clear unused (undocumented) CAM bytes while setting a key;
without that, hardware does weird things when A-MSDU bit in QoS header
is set.

Tested with RTL8188CUS (AP) -> RTL8188EU (STA) (A-MSDU transmit).

Reported by:	many
Obtained from:	https://github.com/s3erios/urtwm
MFC after:	5 days
2016-07-20 22:05:44 +00:00
Sean Bruno
c25b4c97a1 Remove uneeded parens.
MFC after:	1 day
2016-07-20 19:21:11 +00:00
Conrad Meyer
07f825e871 Fix DEBUG build on 64-bit arch after r303099
Reported by:	Larry Rosenman <ler at lerctr.org>
2016-07-20 18:11:22 +00:00
Andrew Turner
68abdc4081 Mark the Designware MMC and USB OTG drivers as FDT only. These are normally
found on arm64 devices that use FDT.

Obtained from:	ABT Systems Ltd
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-07-20 17:46:33 +00:00
Alan Cox
8d67b8c863 Add a comment describing the 'fast path' that was introduced in r270011.
Reviewed by:	kib
MFC after:	3 days
Sponsored by:	EMC / Isilon Storage Division
2016-07-20 17:20:22 +00:00
Andrew Turner
d4c893910d We will be switching to a new arm64 uart cpu driver that handles both FDT
and ACPI. As such pull out what will be the common parts of the FDT cpu
detection to a new function that can be shared between them.

Reviewed by:	manu
Obtained from:	ABT Systems Ltd
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7262
2016-07-20 17:19:47 +00:00
Conrad Meyer
c17b0bd2a6 Extend ELF coredump to support more than 65535 segments
The ELF e_phnum field is only 16 bits wide. To support more than 65535 segments
(program headers), Sun's "Linker and Libraries Guide" table 7-7 (or 12-7,
depending on document version) prescribes a special first section header where
sh_info represents the real number of program headers.

Test code to follow, when it is ready.

Reference:	http://docs.oracle.com/cd/E18752_01/pdf/817-1984.pdf

Reviewed by:	emaste, markj
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D7255
2016-07-20 16:59:36 +00:00
Gleb Smirnoff
9f3391243b Redo the r302894: the very new value for a non-scheduled callout is -1.
This was recently added in r290664.

Noticed by:	hselasky
Tested by:	Larry Rosenman <ler lerctr.org>
PR:		210884
2016-07-20 16:48:25 +00:00
Gleb Smirnoff
47e4280922 Revert r303037. It re-introduces the panic with TCP timers.
Agreed by:	rrs, re (gjb)
2016-07-20 16:44:22 +00:00
Konstantin Belousov
e73b16ae7a Ensure that the UFS directory vnode' vm_object is properly sized
before UFS_BALLOC() is called.  I do not believe that this caused any
real issue on FreeBSD because the exclusive vnode lock is held over
the balloc/resize, the change is to make formally correct KPI use.

Based on:	the Matthew Dillon' patch from DragonFly BSD
PR:	93942
Reviewed by:	mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-07-20 14:40:56 +00:00
Emmanuel Vadot
280ab2edb1 Add support for the SID (Security ID Module) on Allwinner A10 and A20.
The rootkey is burnt at production and can't be changed, thus is can be used
as a device unique ID or to generate a MAC address (This is was u-boot does).
The rootkey is exposed as a sysctl (dev.aw_sid.<unit>.rootkey).

Reviewed by:	jmcneill
Differential Revision:	https://reviews.freebsd.org/D6383
2016-07-20 11:23:06 +00:00
Roger Pau Monné
c397b61ea5 vesa: fix panic on suspend
Fix the following panic seen when migrating a FreeBSD guest on Xen:

panic: mtx_lock() of destroyed mutex @ /usr/src/sys/dev/fb/vesa.c:541
cpuid = 0
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe001d2fa4f0
vpanic() at vpanic+0x182/frame 0xfffffe001d2fa570
kassert_panic() at kassert_panic+0x126/frame 0xfffffe001d2fa5e0
__mtx_lock_flags() at __mtx_lock_flags+0x15b/frame 0xfffffe001d2fa630
vesa_bios_save_restore() at vesa_bios_save_restore+0x78/frame 0xfffffe001d2fa680
vga_suspend() at vga_suspend+0xa3/frame 0xfffffe001d2fa6b0
isavga_suspend() at isavga_suspend+0x1d/frame 0xfffffe001d2fa6d0
bus_generic_suspend_child() at bus_generic_suspend_child+0x44/frame
[...]

This is caused because vga_sub_configure (which is called if the VGA adapter
is attached after VESA tried to initialize), points to vesa_configure, which
doesn't initialize the VESA mutex. In order to fix it, make sure
vga_sub_configure points to vesa_load, so that all the needed vesa
components are properly initialized.

Sponsored by:		Citrix Systems R&D
MFC after:		3 days
PR:			209203
Reviewed by:		dumbbell
Differential revision:	https://reviews.freebsd.org/D7196
2016-07-20 09:29:39 +00:00
Michael Tuexen
0ee5c319f2 Fix a bug in deferred stream reset processing which results
in using a length field before it is set.

Thanks to Taylor Brandstetter for reporting the issue and
providing a fix.

MFC after:	3 days
2016-07-20 06:29:26 +00:00
Sepherosa Ziehau
e90bb68be6 hyperv/vmbus: Save MNF trigger location instead of MNF trigger index.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7246
2016-07-20 06:12:32 +00:00
Sepherosa Ziehau
6254947245 hyperv/vmbus: Hide channel struct definition.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7245
2016-07-20 06:00:27 +00:00
Sepherosa Ziehau
fda1c6ee42 hyperv/vmbus: Deprecate the device private data in channel struct
They are neither flexible nor extensible.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7244
2016-07-20 05:48:52 +00:00
Sepherosa Ziehau
ca871fb75c hyperv/vmbus: Pass channel as the first argument for channel callback
The prepares to kill device private fields in channel struct, which
are not flexible and extensible.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7243
2016-07-20 05:34:28 +00:00
Sepherosa Ziehau
9129ad2d70 hyperv/vmbus: Channel struct field rename
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7242
2016-07-20 05:26:04 +00:00
Sepherosa Ziehau
4cd995ff5d hyperv/vmbus: Move IC register definition to Hyper-V utilities
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7241
2016-07-20 05:16:23 +00:00
Sepherosa Ziehau
267fb25f21 hyperv/vmbus: Get rid of unnecessary definition.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7240
2016-07-20 05:03:04 +00:00
Mark Johnston
afa5d70339 Release the second critical section in uma_zfree_arg() slightly earlier.
It is only needed when removing a full bucket from the per-CPU cache. The
bucket cache (uz_buckets) is protected by the zone mutex and thus the
critical section can be released before inserting into that list.

MFC after:	1 week
2016-07-20 01:01:50 +00:00
Mark Johnston
20c58db95a Make vm_pageout_wakeup_thresh a u_int rather than an int.
It's a threshold for v_free_count, which is of type u_int. This also lets
us get rid of a cast in vm_paging_needed().

Reviewed by:	alc
MFC after:	1 week
2016-07-20 00:09:22 +00:00
Mark Johnston
e86e17af79 Merge {amd64,i386}/instr_size.c into x86_instr_size.c.
Also reduce the diff between us and upstream: the input data model will
always be DATAMODEL_NATIVE because of a bug (p_model is never set but is
always initialized to 0), so we don't need to override the caller anyway.
This change is also necessary to support the pid provider for 32-bit
processes on amd64.

MFC after:	2 weeks
2016-07-20 00:02:10 +00:00
Conrad Meyer
f41bde667c Increase vt(4) framebuffer maximum size
And rename "DEFAULT" constants to the more accurate "MAX."

PR:		210382
Submitted by:	Felix <felixphew0 at gmail.com>
Reviewed by:	wblock, cem
Tested by:	Dave Cottlehuber <dch at skunkwerks.at>
2016-07-19 19:20:47 +00:00
Scott Long
3c79101150 Remove unused variable from last commit. 2016-07-19 19:19:03 +00:00
Scott Long
49e20d2420 Supporting flushing the dump before returning, and simplify/combine the
logic.  Switch to a 5us delay since most NVME devices can easily do 200,000
iops.

Submitted by:	imp
MFC after:	3 days
Sponsored by:	Netflix, Inc.
2016-07-19 19:09:23 +00:00
Emmanuel Vadot
ddda1a9c2f Do not use TERM_EMU on arm and arm64 as it doesn't behave well with serial console.
Reviewed by:	andrew, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D6783
2016-07-19 19:00:22 +00:00
Randall Stewart
3d84a18803 This reverts out Gleb's changes and adds three small
fixes that I think closes up the races Gleb was
looking for. This is running quite nicely in Netflix and
now no longer causes TCP-tcb leaks.

Differential Revision:	7135
2016-07-19 18:31:19 +00:00
Mark Murray
a1acc06f4f Random bit generator (RBG) driver for RPi and RPi2.
Summary:
This driver supports the following methods to trigger gathering random bits from the hardware:
1. interrupt when the FIFO is full (default) fed into the harvest queue
2. callout (when BCM2835_RNG_USE_CALLOUT is defined) every second if hz is less than 100, otherwise hz / 100, feeding the random bits into the harvest queue

If the kernel is booted with verbose enabled, the contents of the registers will be dumped after the RBG is started during the attach routine.

Author: hackagadget_gmail.com (Stephen J. Kiernan)

Test Plan: Built RPI2 kernel and booted on board. Tested the different methods to feed the harvest queue (callout, interrupt) and the interrupt driven approach seems best. However, keeping the other method for people to be able to experiment with.

Reviewed By: adrian, delphij, markm

Differential Revision: https://reviews.freebsd.org/D6888
2016-07-19 18:07:47 +00:00
Sean Bruno
03d28807f5 Fixup DA cable detection routines to not set the cable type to
unknown if they do not match one of two cable types.

PR:		150249
Submitted by:	borjam@sarenet.es
Reviewed by:	erj
MFC after:	3 days
2016-07-19 17:31:48 +00:00
Michael Tuexen
0fa7377a03 Use correct order of conditions to avoid NULL deref.
MFC after:	3 days
X-MFC with:	r302935
2016-07-19 11:16:44 +00:00
Michael Tuexen
0ba4c8abe0 netstat and sockstat expect the IPv6 link local addresses to
have an embedded scope. So don't recover.

MFC after:	3 days
2016-07-19 09:48:08 +00:00
Sepherosa Ziehau
e62409966b hyperv/vmbus: Rename laundered vmbus channel code
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7232
2016-07-19 07:51:22 +00:00
Sepherosa Ziehau
d9687005ae hyperv/vmbus: Temp/internal variable/function rename
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7231
2016-07-19 06:04:44 +00:00
Sepherosa Ziehau
e93854c495 hyperv/vmbus: Function rename
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7230
2016-07-19 05:57:19 +00:00
Sepherosa Ziehau
742fb4f669 hyperv/vmbus: Cleanup cpu based channel selection.
And create cpu to channel map at device attach time for storvsc(4).

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7229
2016-07-19 05:46:15 +00:00
Andrey V. Elsukov
f1ff88cf8c Use g_resize_provider() to change the size of GEOM_DISK provider,
when it is being opened. This should fix the possible loss of a resize
event when disk capacity changed.

PR:		211028
Reported by:	Dexuan Cui <decui at microsoft dot com>
MFC after:	3 weeks
2016-07-19 05:36:21 +00:00
Andrey V. Elsukov
ed22e564b8 Add named dynamic states support to ipfw(4).
The keep-state, limit and check-state now will have additional argument
flowname. This flowname will be assigned to dynamic rule by keep-state
or limit opcode. And then can be matched by check-state opcode or
O_PROBE_STATE internal opcode. To reduce possible breakage and to maximize
compatibility with old rulesets default flowname introduced.
It will be assigned to the rules when user has omitted state name in
keep-state and check-state opcodes. Also if name is ambiguous (can be
evaluated as rule opcode) it will be replaced to default.

Reviewed by:	julian
Obtained from:	Yandex LLC
MFC after:	1 month
Relnotes:	yes
Sponsored by:	Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D6674
2016-07-19 04:56:59 +00:00
Scott Long
a498975ef7 Implement crashdump support on NVME
MFC after:	3 days
Sponsored by:	Netflix, Inc.
2016-07-19 03:13:51 +00:00
Adrian Chadd
ffa25bec32 [ath] don't do LDPC, STBC or short-gi for locationing frames.
The 11n duration calculation function in net80211 and the HAL round /up/
the duration calculation for short-gi, so we can't use that.

The 11n duration calculation doesn't know about the extra symbol time
needed for STBC, nor the LDPC encoding duration, so we can't use
that.

This (along with other, local hacks) allow the locationing services to
get down to around 200nS (yes, nanoseconds) of variance when speaking
to a "good" AP.

Tested:

* AR9380, STA mode, local locationing frame hacks
2016-07-19 00:27:17 +00:00
Andrey V. Elsukov
b867e84e95 Add ipfw_nptv6 module that implements Network Prefix Translation for IPv6
as defined in RFC 6296. The module works together with ipfw(4) and
implemented as its external action module. When it is loaded, it registers
as eaction and can be used in rules. The usage pattern is similar to
ipfw_nat(4). All matched by rule traffic goes to the NPT module.

Reviewed by:	hrs
Obtained from:	Yandex LLC
MFC after:	1 month
Relnotes:	yes
Sponsored by:	Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D6420
2016-07-18 19:46:31 +00:00
Alexander Motin
84e633724f Negotiate/disable TXCSUM_IPV6 same as TXCSUM. 2016-07-18 16:58:47 +00:00
John Baldwin
ccb83afd81 Include process IDs in core dumps.
When threads were added to the kernel, the pr_pid member of the
NT_PRSTATUS note was repurposed to store LWP IDs instead of process
IDs.  However, the process ID was no longer recorded in core dumps.
This change adds a pr_pid field to prpsinfo (NT_PRSINFO).  Rather than
bumping the prpsinfo version number, note parsers can use the note's
payload size to determine if pr_pid is present.

Reviewed by:	kib, emaste (older version)
MFC after:	2 months
Differential Revision:	https://reviews.freebsd.org/D7117
2016-07-18 15:14:23 +00:00
John Baldwin
fc4f075a1a Add PTRACE_VFORK to trace vfork events.
First, PL_FLAG_FORKED events now also set a PL_FLAG_VFORKED flag when
the new child was created via vfork() rather than fork().  Second, a
new PL_FLAG_VFORK_DONE event can now be enabled via the PTRACE_VFORK
event mask.  This new stop is reported after the vfork parent resumes
due to the child calling exit or exec.  Debuggers can use this stop to
reinsert breakpoints in the vfork parent process before it resumes.

Reviewed by:	kib
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D7045
2016-07-18 14:53:55 +00:00
Alexander Motin
d0cefbdc0d Update if_hwassist when interface options are changed.
In particular for me this fixes checksum problem when if_bridge attached
to the interface requests TXCSUM to be disabled, but effectively ignored.

MFC after:	3 days
Sponsored by:	iXsystems, Inc.
2016-07-18 14:40:13 +00:00
Konstantin Belousov
77d6809483 The assertion re-added in r302614 was triggered when stopping signal
is delivered to vforked child.  Issue is that we avoid stopping such
children in issignal() to not block parents.  But executed AST, which
ignored stops, leaves the child with the signal pending but no AST
pending.

On first exec after vfork(), call signotify() to handle pending
reenabled signals.  Adjust the assert to not check vfork children
until exec.

Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2016-07-18 10:53:47 +00:00
Gleb Smirnoff
809a9d1353 Revert the last commit. It must get more review and testing first. 2016-07-18 09:29:08 +00:00
Gleb Smirnoff
ef58c6a7a3 Redo the r302894: the very new value for a non-scheduled callout is -1.
This was recently added in r290664.

Noticed by:	hselasky
PR:		210884
2016-07-18 09:26:06 +00:00
Luiz Otavio O Souza
59b67ee8f0 Fix a random memory overwrite at boot time, simplebus_init() and
simplebus_add_device() expect a simplebus_softc structure associated with
the device.

Add the simplebus_softc as first member in am335x_pwmss_softc structure.

Sponsored by:	Rubicon Communications (Netgate)
2016-07-18 06:35:40 +00:00
Sepherosa Ziehau
367d703632 hyperv/vmbus: Cosmetic vmbus channel open cleanup
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7217
2016-07-18 05:36:31 +00:00
Maxim Sobolev
55f9588af4 Relax checking if the privider size matches size recorded in the
superblock, allowing provider to be bit bigger, i.e. have some
extra padding after the FS image. That in some cases might be
a side-effect of using CLOOP format which enforces certain block
size and trying to compress image that is not exactly the number
of those blocks in size. The UFS itself does not have any issues
mounting such padded file systems, so it's what GEOM_LABEL should
do.

Submitted by:	@mizhka_gmail.com
Differential Revision:	https://reviews.freebsd.org/D6208
2016-07-18 05:00:01 +00:00
Konstantin Belousov
56d48d6dcb Fix another bug after r302350.
Reported and tested by:	pho
PR:	210884
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2016-07-18 04:30:34 +00:00
Alan Cox
0c3a489325 Break up vm_fault()'s implementation of the read-ahead and delete-behind
optimizations into two distinct pieces.  The first piece consists of the
code that should only be performed once per page fault and requires the map
to be locked.  The second piece consists of the code that should be
performed each time a pager is called on an object in the shadow chain.
(This second piece expects the map to be unlocked.)

Previously, the entire implementation could be executed multiple times.
Moreover, the second and subsequent executions would occur with the map
unlocked.  Usually, the ensuing unsynchronized accesses to the map were
harmless because the map was not changing.  Nonetheless, it was possible for
a use-after-free error to occur, where vm_fault() wrote to a freed map
entry.  This change corrects that problem.

Reported by:	avg
Reviewed by:	kib
MFC after:	3 days
Sponsored by:	EMC / Isilon Storage Division
2016-07-18 04:20:26 +00:00
Maxim Sobolev
e0cd4b7f6f Don't print same value twice, one in decimal once in hex. This makes
output more cryptic than it needs to be and wastes cpu cycles and
console bandwidth.
2016-07-18 03:59:03 +00:00
Justin Hibbits
78cc33fd32 Remove booke_enable_l3_cache declaration and remaining definition.
L3 cache is not defined by Book-E, so is platform specific.  Since it was
already moved for e500-based devices into mpc85xx in r292903, just eliminate it
altogether.  Any device that supports L3 cache should have its own platform
means to enable it.
2016-07-17 19:24:28 +00:00
Justin Hibbits
b926a14ca7 No need to include mpc85xx.h anymore, so remove it. 2016-07-17 19:19:50 +00:00
Mariusz Zaborski
1b55032939 Fix nvlist array memory leak.
When we change nvl_array_next to NULL it means that we want to destroy or
take nvlist_array. The nvpair, which stores next nvlist of nvlist_array element
is no longer needed and can be freed.

Submitted by:	Adam Starak <starak.adam@gmail.com>
MFC after:	1 week
2016-07-17 15:36:02 +00:00
Mariusz Zaborski
26dc4fcaa7 Fix memory leak in the nvlist string array.
Submitted by:	Adam Starak <starak.adam@gmail.com>
MFC after:	1 week
2016-07-17 15:29:31 +00:00
Michal Meloun
79cceaac0f TEGRA: Subclass Tegra PCIE driver from ofw_pci base driver.
Remove now redundant code.
2016-07-17 14:45:15 +00:00
Alexander Motin
db8e94bb3b Restore PIM_ATA_EXT flag handling, lost at r300207.
This re-enables NCQ TRIM usage on capable hardware (bhyve).
2016-07-17 14:17:58 +00:00
Michal Meloun
efafbd0a87 OFWPCI: Add support for NEW_PCIB.
MFC after: 3 weeks
2016-07-17 13:43:46 +00:00
Michal Meloun
5572376db2 OFWPCI: Improve resource handling.
- add new rman for prefetchable memory. Is used only if given 'ranges'
  property contains prefetchable memory range.

- not all ranges in 'ranges' property are subject for rman's filling.
  Tegra for example, have two addition records which are used for
  'pci 'register' -> 'assigned-address' -> 'ranges' machinery.
  Add sc_ranges_mask for masking not rman related ranges.

- consistently pass unknown (not managed at this level) resources
  allocation/release/adjust requests to parent.

MFC after: 3 weeks
2016-07-17 13:43:00 +00:00
Michael Tuexen
487e2e6507 Add a constant required by RFC 7496.
MFC after:	3 days
2016-07-17 13:33:35 +00:00
Michael Tuexen
8e1b295f09 Fix the PR-SCTP behaviour.
This is done by rrs@.

MFC after:	3 days
2016-07-17 13:14:51 +00:00
Alexander Motin
e50f405eca In AHCI_IRQ_MODE_AFTER mode do not clear interrupts below.
This is probably a NOP change since IS register is not activery used for
interrupts below the shared, but it looked odd to clear interrupts we did
not handle.
2016-07-17 12:45:58 +00:00
Alexander Motin
eaf4f6fe69 Do not consider the last interrupt shared if there are enough interrupts
for all channels.
2016-07-17 12:31:31 +00:00
Michael Tuexen
26f0250adf Add missing sctps_reasmusrmsgs counter.
Joint work with rrs@.
MFC after:	3 days
2016-07-17 08:31:21 +00:00
Jared McNeill
01a469b860 Add support for Allwinner H3 EMAC.
H3 EMAC is the same as A83T/A64 except the SoC includes an (optional)
internal 10/100 PHY. Both internal and external PHYs are supported on H3
with this driver.
2016-07-16 18:06:41 +00:00
Konstantin Belousov
86f1146329 Another issue reported on http://seclists.org/oss-sec/2016/q3/68 is
that struct kevent member ident has uintptr_t type, which is silently
truncated to int in the call to fget().  Explicitely check for the
valid range.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-07-16 13:24:58 +00:00
Michael Tuexen
643fd575da Deal with a portential memory allocation failure, which was reported
by the clang static code analyzer.
Joint work with rrs@.

MFC after:	3 days
2016-07-16 12:25:37 +00:00
Michael Tuexen
b4bf72213a Don't free a data chunk twice.
Found by the clang static code analyzer running for the userland stack.

MFC after:	3 days
2016-07-16 08:11:43 +00:00
Michael Tuexen
56d2f7d8e5 Address a potential memory leak found a the clang static code analyzer
running on the userland stack.

MFC after:	3 days
2016-07-16 07:48:01 +00:00
John Baldwin
a5c6318fc3 Rename PTRACE_SYSCALL to LINUX_PTRACE_SYSCALL.
Suggested by:	kib
2016-07-16 00:54:46 +00:00
Konstantin Belousov
f470cca578 In ptrace_vm_entry(), do not call vmspace_free() while owning a vm
object lock.

The vmspace_free() operations might need to lock map, object etc on
last dereference.  Postpone the free until object's inspection is
done.

Reported and tested by:	will
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-07-15 23:26:33 +00:00
Andrey V. Elsukov
7aeccebc0d Add net.inet6.ip6.intr_queue_maxlen sysctl. It can be used to
change netisr queue limit for IPv6 at runtime.

Obtained from:	Yandex LLC
MFC after:	2 weeks
Sponsored by:	Yandex LLC
2016-07-15 17:09:30 +00:00
John Baldwin
8d570f64aa Add a mask of optional ptrace() events.
ptrace() now stores a mask of optional events in p_ptevents.  Currently
this mask is a single integer, but it can be expanded into an array of
integers in the future.

Two new ptrace requests can be used to manipulate the event mask:
PT_GET_EVENT_MASK fetches the current event mask and PT_SET_EVENT_MASK
sets the current event mask.

The current set of events include:
- PTRACE_EXEC: trace calls to execve().
- PTRACE_SCE: trace system call entries.
- PTRACE_SCX: trace syscam call exits.
- PTRACE_FORK: trace forks and auto-attach to new child processes.
- PTRACE_LWP: trace LWP events.

The S_PT_SCX and S_PT_SCE events in the procfs p_stops flags have
been replaced by PTRACE_SCE and PTRACE_SCX.  PTRACE_FORK replaces
P_FOLLOW_FORK and PTRACE_LWP replaces P2_LWP_EVENTS.

The PT_FOLLOW_FORK and PT_LWP_EVENTS ptrace requests remain for
compatibility but now simply toggle corresponding flags in the
event mask.

While here, document that PT_SYSCALL, PT_TO_SCE, and PT_TO_SCX both
modify the event mask and continue the traced process.

Reviewed by:	kib
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D7044
2016-07-15 15:32:09 +00:00