Commit Graph

232920 Commits

Author SHA1 Message Date
Roger Pau Monné
791ca5907a xen/evtchn: fix LOR in evtchn device
Remove the device from the list before unbinding it. Doing it in this
order allows calling xen_intr_unbind without holding the bind_mutex
lock.

Sponsored by:	Citrix Systems R&D
2018-05-24 10:20:42 +00:00
Roger Pau Monné
e2e4a0e02a xen-blkback: don't unbind the interrupt while holding the lock
There's no need to perform the interrupt unbind while holding the
blkback lock, and doing so leads to the following LOR:

lock order reversal: (sleepable after non-sleepable)
 1st 0xfffff8000802fe90 xbbd1 (xbbd1) @ /usr/src/sys/dev/xen/blkback/blkback.c:3423
 2nd 0xffffffff81fdf890 intrsrc (intrsrc) @ /usr/src/sys/x86/x86/intr_machdep.c:224
stack backtrace:
#0 0xffffffff80bdd993 at witness_debugger+0x73
#1 0xffffffff80bdd814 at witness_checkorder+0xe34
#2 0xffffffff80b7d798 at _sx_xlock+0x68
#3 0xffffffff811b3913 at intr_remove_handler+0x43
#4 0xffffffff811c63ef at xen_intr_unbind+0x10f
#5 0xffffffff80a12ecf at xbb_disconnect+0x2f
#6 0xffffffff80a12e54 at xbb_shutdown+0x1e4
#7 0xffffffff80a10be4 at xbb_frontend_changed+0x54
#8 0xffffffff80ed66a4 at xenbusb_back_otherend_changed+0x14
#9 0xffffffff80a2a382 at xenwatch_thread+0x182
#10 0xffffffff80b34164 at fork_exit+0x84
#11 0xffffffff8101ec9e at fork_trampoline+0xe

Reported by:    Nathan Friess <nathan.friess@gmail.com>
Sponsored by:   Citrix Systems R&D
2018-05-24 10:19:54 +00:00
Roger Pau Monné
b3a5ba30e5 dev/xenstore: prevent transaction hijacking
The user-space xenstore device is currently lacking a check to make
sure that the caller is only using transaction ids currently assigned
to it. This allows users of the xenstore device to hijack transactions
not started by them, although the scope is limited to transactions
started by the same domain.

Tested by:      Nathan Friess <nathan.friess@gmail.com>
Sponsored by:   Citrix Systems R&D
2018-05-24 10:18:31 +00:00
Navdeep Parhar
786099de5e cxgbe(4): Data path for rate-limited tx.
This is hardware support for the SO_MAX_PACING_RATE sockopt (see
setsockopt(2)), which is available in kernels built with "options
RATELIMIT".

Relnotes:	Yes
Sponsored by:	Chelsio Communications
2018-05-24 10:18:14 +00:00
Roger Pau Monné
5d7476948f dev/xenstore: add support for watches
Allow user-space applications to register watches using the xenstore
device.  This is needed in order to run toolstack operations on
domains different than the one where xenstore is running (in which
case the device is not used, since the connection to xenstore is done
using a plain socket).

Tested by:      Nathan Friess <nathan.friess@gmail.com>
Sponsored by:   Citrix Systems R&D
2018-05-24 10:17:49 +00:00
Roger Pau Monné
7c743c89a0 xenstore: don't wait with the PCATCH flag
Due to the current synchronous xenstore implementation in FreeBSD, we
cannot return from xs_read_reply without reading a reply, or else the
ring gets out of sync and the next request will read the previous
reply and crash due to the type mismatch. A proper solution involves
making use of the req_id field in the message and allowing multiple
in-flight messages at the same time on the ring.

Remove the PCATCH flag so that signals don't interrupt the wait.

Tested by:      Nathan Friess <nathan.friess@gmail.com>
Sponsored by:   Citrix Systems R&D
2018-05-24 10:17:03 +00:00
Roger Pau Monné
5f8f664619 xenstore: remove the suspend sx lock
There's no need to prevent suspend while doing xenstore transactions,
callers of transactions are supposed to be prepared for a transaction
to fail.

This fixes a bug that could be triggered from the xenstore user-space
device, since starting a transaction from user-space would result in
returning there with a sx lock held, that causes a WITNESS check to
trigger.

Tested by:      Nathan Friess <nathan.friess@gmail.com>
Sponsored by:   Citrix Systems R&D
2018-05-24 10:16:11 +00:00
Navdeep Parhar
c90a8cf80a cxgbe/t4_tom: ABORT_RPL_RSS is a shared CPL and t4_tom shouldn't remove
the global handler when it's being unloaded.
2018-05-24 08:32:02 +00:00
Navdeep Parhar
9c707b3287 cxgbe(4): Make FW4_ACK a shared CPL. ETHOFLD in the base driver will
use it for per-flow rate limiting.

Sponsored by:	Chelsio Communications
2018-05-24 08:21:43 +00:00
Navdeep Parhar
1dd95f641e cxgbe(4): Fix range checks in is_etid. 2018-05-24 08:02:11 +00:00
Navdeep Parhar
a6a8ff351d cxgbe(4): Slightly simpler needs_<foo> functions. 2018-05-24 07:38:46 +00:00
Matt Macy
0a87e3ff64 pmcstat: add usage strings for -L and -I 2018-05-24 07:18:49 +00:00
Matt Macy
f2597cf756 libpmcstat: import aliases table and bug fixes 2018-05-24 06:47:40 +00:00
Matt Macy
4bd2a4b58e pmcstat top mode + -I - use fully qualified address 2018-05-24 06:47:04 +00:00
Navdeep Parhar
2e09fe9116 cxgbe(4): Make sure that the egress queue's cidx is updated periodically
when the driver is writing WRs using start_wrq_wr/commit_wrq_wr all the
time.

Sponsored by:	Chelsio Communications
2018-05-24 06:44:06 +00:00
Matt Macy
357405d985 pmcstat: don't compare signed and unsigned 2018-05-24 04:43:40 +00:00
Matt Macy
341890e07d fix !amd64 signature for pmu_sample_rate_get 2018-05-24 04:38:17 +00:00
Matt Macy
14d13423dd take NUMA out 2018-05-24 04:31:53 +00:00
Matt Macy
e98bbcf9ca libpmcstat: compile in events based on json description 2018-05-24 04:30:06 +00:00
Matt Macy
3741a56c31 devd: drop WARNS back down to 3 until 6 actually works with GCC 2018-05-24 01:12:06 +00:00
Matt Macy
fe524329e4 convert allocations to INVARIANTS M_ZERO 2018-05-24 01:04:56 +00:00
Matt Macy
b17fbe5bf6 malloc: Add flag for conditionally zeroing for INVARIANTS builds 2018-05-24 01:03:31 +00:00
John Baldwin
4560b78de2 Catch up two more places to the V_ifnet change to a CK_STAILQ. 2018-05-24 00:06:55 +00:00
Konstantin Belousov
8936419a6c x86: stop unconditionally clearing PSL_T on the trace trap.
We certainly should clear PSL_T when calling the SIGTRAP signal
handler, which is already done by all x86 sendsig(9) ABI code.  On the
other hand, there is no obvious reason why PSL_T needs to be cleared
when returning from the signal handler.  For instance, Linux allows
userspace to set PSL_T and keep tracing enabled for the desired
period.  There are userspace programs which would use PSL_T if we make
it possible, for instance sbcl.

Remember if PSL_T was set by PT_STEP or PT_SETSTEP by mean of TDB_STEP
flag, and only clear it when the flag is set.

Discussed with:	Ali Mashtizadeh
Reviewed by:	jhb (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D15054
2018-05-23 21:39:29 +00:00
Konstantin Belousov
79547c52b8 Stop obliterating actual exception type for emulated traps from vm86.
Wording and reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D15054
2018-05-23 21:26:41 +00:00
Ed Maste
12db404753 Revert r334081 (-Wmain) as it broke the build on gcc architectures 2018-05-23 21:26:33 +00:00
Konstantin Belousov
61bc50d032 Style.
Wording and reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D15054
2018-05-23 21:25:49 +00:00
Matt Macy
4f6c66cc9c UDP: further performance improvements on tx
Cumulative throughput while running 64
  netperf -H $DUT -t UDP_STREAM -- -m 1
on a 2x8x2 SKL went from 1.1Mpps to 2.5Mpps

Single stream throughput increases from 910kpps to 1.18Mpps

Baseline:
https://people.freebsd.org/~mmacy/2018.05.11/udpsender2.svg

- Protect read access to global ifnet list with epoch
https://people.freebsd.org/~mmacy/2018.05.11/udpsender3.svg

- Protect short lived ifaddr references with epoch
https://people.freebsd.org/~mmacy/2018.05.11/udpsender4.svg

- Convert if_afdata read lock path to epoch
https://people.freebsd.org/~mmacy/2018.05.11/udpsender5.svg

A fix for the inpcbhash contention is pending sufficient time
on a canary at LLNW.

Reviewed by:	gallatin
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D15409
2018-05-23 21:02:14 +00:00
Matt Macy
630ba2c514 udp: assign flowid to udp sockets round-robin
On a 2x8x2 SKL this increases measured throughput with 64
netperf -H $DUT -t UDP_STREAM -- -m 1

from 590kpps to 1.1Mpps
before:
https://people.freebsd.org/~mmacy/2018.05.11/udpsender.svg
after:
https://people.freebsd.org/~mmacy/2018.05.11/udpsender2.svg
2018-05-23 20:50:09 +00:00
Edward Tomasz Napierala
d008c0d75f Centralize USB device mode bus power reporting, and add
hw.usb.template_power sysctl to control it.

Reviewed by:	hselasky@ (earlier version)
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-05-23 20:06:04 +00:00
Matt Macy
95104040a3 pmc: bump PMC major version to reflect ABI breakage and make warning not require verbose 2018-05-23 19:55:47 +00:00
Leandro Lupori
e0d394d096 Adding myself to committers-src.dot and calendar.freebsd
Approved by:	jhibbits (mentor)
2018-05-23 19:17:17 +00:00
Emmanuel Vadot
3df266dff9 arm64: rockchip: Add proper armclock support
The core clock (armclk) on RockChip SoC is special.
It can derive it's clock from many PLLs but RockChip recommand to do it
from "apll" on old SoC and "npll" on new SoC. The reason for choosing npll
is that it's have less jitter and is more close to the arm core on the SoC.
r333314 added the core clock as a composite clock but due to it's specials
property we need to deal with it differently.
A new rk_clk_armclk type is added for this and it supports only the "npll"
as we don't run on old RockChip SoC that only have the "apll".
It will always reparent to "npll" and set the frequency according to a rate
table that is known to be good.
For now we set the "npll" to the desired frequency and just set the core clk
divider to 1 as its parent it just used for the core clk.
2018-05-23 19:07:03 +00:00
Konstantin Belousov
84ffdd6a81 Note that PT_SETSTEP is auto-cleared.
Wording and reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D15054
2018-05-23 17:55:30 +00:00
Matt Macy
a85289cf9b hwppmc: set threadid in callchain records - second part of r334108 2018-05-23 17:44:29 +00:00
Matt Macy
7e1a13f4b4 UPDATING: note that the pmc callchain ABI has changed 2018-05-23 17:30:23 +00:00
Matt Macy
0b5dc7f64f hwpmc: add thread id field to callchain and context switch records to allow filtering
on thread in post-processing.

To generate stacks for just ${THREADID}:

pmcstat -R ${PREFIX}.pmcstat -L ${THREADID} -z100 -G ${PREFIX}.stacks

Sponsored by:	Limelight Networks
2018-05-23 17:25:00 +00:00
John Baldwin
9c4a7c50ae Remove references to the LIBC_SCCS and SYSLIBC_SCCS C macros.
This language dates back to when libthr was libc_r that included its own
syscalls and replaced libc entirely.  It hasn't been relevant for a long
time.
2018-05-23 17:05:12 +00:00
John Baldwin
636402a76a Use __SCCSID() for SCCS IDs.
- Define NO__SCCSID in CFLAGS to preserve existing behavior of omitting
  SCCS IDs by default.
- While here, fix the $FreeBSD$ in pw_util.c to use __FBSDID.
2018-05-23 17:02:12 +00:00
Mark Johnston
2531686329 Revert r334090.
It causes the 32bit compat build of libmd to fail with:

libmd/rmd160c.c:86:9: error: 'ripemd160_block' macro redefined
#define ripemd160_block ripemd160_block_x86
        ^
libmd/ripemd.h:122:9: note: previous definition is here
#define ripemd160_block         _libmd_ripemd160_block
2018-05-23 17:01:28 +00:00
Matt Macy
246a619924 epoch: allow for conditionally asserting that the epoch context fields
are unused by zeroing on INVARIANTS builds
2018-05-23 17:00:05 +00:00
Konstantin Belousov
3ae6b51919 Support IBRS for i386.
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D15522
2018-05-23 16:31:46 +00:00
Brad Davis
e172d4c3f0 Switch calendar installs to use FILES and SYMLINKS instead of bare install(1)
Also explicitly list each file to install so we don't silently add or miss
some.

Approved by:	bapt (mentor)
2018-05-23 16:28:31 +00:00
Mark Johnston
6514b4f061 Add GET_STACK_USAGE() for arm64.
Its absence meant that GEOM direct dispatch was disabled (the service
routines check the current thread's stack usage to determine whether
to hand off the request to a dedicated thread), and this change is
sufficient to enable direct dispatch by default.

Reviewed by:	allanjude
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D15527
2018-05-23 15:43:35 +00:00
Mark Johnston
64223daed4 Document the return value of sbuf_bcat(9).
MFC after:	1 week
2018-05-23 15:26:56 +00:00
Alexander Motin
af66b67ab2 Add ready polling after PHY reset on VIA SATA controllers.
According to PR there are cases of controller hang if soft reset is
sent before device report ready status after the hard reset.

I don't think this patch is perfect, but it was reported as working
by the submitter, and I have neither the old hardware nor interest to
test some improved version, so just done some style cleaning.

PR:		183294
Submitted by:	alexandre.martins@netasq.com
MFC after:	1 month
2018-05-23 15:22:58 +00:00
Breno Leitao
0cdd15f5a4 Adding myself share/misc/committers-src.dot. 2018-05-23 14:19:06 +00:00
Eitan Adler
f405a1bea1 devd: Move variable declaration to header
Reminder by:	imp
2018-05-23 13:48:16 +00:00
Luca Pizzamiglio
11d416666d Improve MAC address uniqueness on if_epair(4).
As reported in PR184149, it can happen that epair devices can have the same
MAC address.
This solution is based on a 32-bit hash, obtained combining the if_index of
the a interface and the hostid.
If the hostid is zero, a random number is used.

PR:		184149
Reviewed by:	wollman, eugen
Approved by:	cognet
Differential Revision:	https://reviews.freebsd.org/D15329
2018-05-23 13:10:57 +00:00
Eitan Adler
d14732d366 kldstat: align size to the right
This makes it easier to compare numbers directly.

PR:		215747
Submitted by:	"Alexander von Gernler" <grunk@pestilenz.org>
2018-05-23 12:10:16 +00:00