Commit Graph

35052 Commits

Author SHA1 Message Date
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
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
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
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
a85289cf9b hwppmc: set threadid in callchain records - second part of r334108 2018-05-23 17:44:29 +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
Eitan Adler
ae4cfcdf30 mrsas(4): Remove unneed extra arg from MR_LdBlockSizeGet().
Obtained From: DragonFly (482292f9859e1ceae4f35343c0a8eac4c4486d1)
2018-05-23 07:39:00 +00:00
Ed Maste
03ba5353ce if_muge: only attach to LAN7800 Chip ID
This driver was developed for the LAN7800 and the register-compatible
LAN7515 (found on Raspberry Pi 3B+) and has only been tested on those
devices.

Sponsored by:	The FreeBSD Foundation
2018-05-22 20:00:56 +00:00
Edward Tomasz Napierala
defd918d79 Add new PIDs for Audio, CDCE, MTP, and Mass Storage, from
https://github.com/obdev/v-usb/blob/master/usbdrv/USB-IDs-for-free.txt.

Big thanks to Christian Starkjohann for allocating those.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-05-22 19:11:06 +00:00
Navdeep Parhar
80259b6c12 cxgbe(4): Only valid filters are expected to have a valid tid. 2018-05-22 16:23:14 +00:00
Andrew Turner
1442afc1c7 Handle reserved memory with the no-map property.
We shouldn't be mapping this memory, so we need to find it so it
can be excluded from the phys_avail map.

Reviewed by:	manu
Obtained from:	ABT Systems Ltd
Sponsored by:	Turing Robotic Industries
Differential Revision:	https://reviews.freebsd.org/D15518
2018-05-22 16:03:41 +00:00
Mark Johnston
be9292a8c9 Typo.
Reported by:	rgrimes, vangyzen
X-MFC with:	r334050
2018-05-22 15:49:23 +00:00
Mark Johnston
6030b0c672 Flush caches before initiating a microcode update on Intel CPUs.
This apparently works around issues with updates of certain Broadwell
CPUs.

Reviewed by:	emaste, kib, sbruno
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D15520
2018-05-22 15:38:51 +00:00
Roger Pau Monné
ffe4446b33 xen-blkback: do not use state 3 (XenbusStateInitialised)
Linux will not connect to a backend that's in state 3
(XenbusStateInitialised), it needs to be in state 2
(XenbusStateInitWait) for Linux to attempt to connect to the backend.

The protocol seems to suggest that the backend should indeed wait in
state 2 for the frontend to connect, which makes state 3 unusable for
disk backends.

Also make sure blkback will connect to the frontend if the frontend
reaches state 3 (XenbusStateInitialised) before blkback has processed
the results from the hotplug script (Submitted by Nathan Friess).

MFC after:	1 week
2018-05-22 08:51:16 +00:00
Konstantin Belousov
3621ba1ede Add Intel Spec Store Bypass Disable control.
Speculative Store Bypass (SSB) is a speculative execution side channel
vulnerability identified by Jann Horn of Google Project Zero (GPZ) and
Ken Johnson of the Microsoft Security Response Center (MSRC)
https://bugs.chromium.org/p/project-zero/issues/detail?id=1528.
Updated Intel microcode introduces a MSR bit to disable SSB as a
mitigation for the vulnerability.

Introduce a sysctl hw.spec_store_bypass_disable to provide global
control over the SSBD bit, akin to the existing sysctl that controls
IBRS. The sysctl can be set to one of three values:
0: off
1: on
2: auto

Future work will enable applications to control SSBD on a per-process
basis (when it is not enabled globally).

SSBD bit detection and control was verified with prerelease microcode.

Security:	CVE-2018-3639
Tested by:	emaste (previous version, without updated microcode)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2018-05-21 21:08:19 +00:00
Andriy Gapon
a23a4e68fa uchcom: extend hardware support to version 0x30
This change adds support for a UBS<->RS232 adapter based on CH340 (or an
analogue) that I own.  The device seems to have a newer internal version
(0x30) and the existing code incorrectly configures line control for it
resulting in garbled transmission.  The changes are based on what I
learned in Linux drivers for the same hardware.

Additional changes:
- use UCHCOM_REG_LCR1 / UCHCOM_REG_LCR2 instead of explicit 0x18 and
  0x25
- use NULL instead of 0 where a pointer is expected

Reviewed by:	hselasky
MFC after:	3 weeks
Differential Revision: https://reviews.freebsd.org/D15498
2018-05-21 21:04:31 +00:00
Andriy Gapon
dad3e656eb uchcom: remove UCHCOM_REG_BREAK2 alias of UCHCOM_REG_LCR1
Also, add definitions for more bits of UCHCOM_REG_LCR1 as seen in the
Linux driver.  UCHCOM_LCR1_PARENB definition was different from that in
the Linux driver and clashed with newly added UCHCOM_LCR1_RX.  I took a
liberty to change UCHCOM_LCR1_PARENB to the Linux definition as it was
unused in the driver anyway.  This change should make
uchcom_cfg_set_break() easier to understand.

Approved by:	hselasky
MFC after:	2 weeks
2018-05-21 21:02:10 +00:00
Andriy Gapon
40e7b06492 uchcom: reject parity and double stop bits as unsupported
Reviewed by:	hselasky
MFC after:	2 weeks
2018-05-21 21:00:13 +00:00
Andriy Gapon
7acd73fd1e uchcom: add a hardware configuration tweak seen in Linux code
Reviewed by:	hselasky
MFC after:	2 weeks
2018-05-21 20:59:15 +00:00
Andriy Gapon
1d33c9a55f uchcom: add DPRINTF-s to aid debugging of the driver
Reviewed by:	hselasky
MFC after:	2 weeks
2018-05-21 20:58:06 +00:00
Andriy Gapon
d759c295c1 uchcom: report detected product based on USB product ID
Product IDs are specified in vendor documents.  The previously used
device ID is not.  This is a cosmetic change.  No functionality depends
on those IDs.

Reviewed by:	hselasky
MFC after:	2 weeks
2018-05-21 20:57:14 +00:00
Andriy Gapon
27dca831a6 stop and restart kernel event timers in the suspend / resume cycle
I have a system that is very unstable after resuming from suspend-to-RAM
but only if HPET is used as the event timer.  The theory is that SMM
code / firmware could be enabling HPET for its own uses and unexpected
interrupts cause a trouble for it.  Originally I wanted to solve the
problem in hpet_suspend() method, but that was insufficient as the event
timer could get reprogrammed again.

So, it's better, for my case and in general, to stop the event timer(s)
before entering the hardware suspend.

MFC after:	4 weeks
Differential Revision: https://reviews.freebsd.org/D15413
2018-05-21 20:23:04 +00:00
Edward Tomasz Napierala
733efc21c4 Add a somewhat ugly hack that makes OSX serial device node names
human-readable.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-05-21 17:33:52 +00:00
Edward Tomasz Napierala
ac4a7f30d2 Improve description strings for USB device-mode serial ports.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-05-21 16:33:13 +00:00
Edward Tomasz Napierala
d01c1c8bfe Use USB Vendor Identifiers and Product Identifiers provided by V-USB
(https://github.com/obdev/v-usb/blob/master/usbdrv/USB-IDs-for-free.txt).
Previously we were using an invalid (not assigned to us) VID.

Reviewed by:	hselasky@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-05-21 15:06:19 +00:00
Matt Macy
ae573a91cf pmc: detach free_gtask on unload
Reported by:	pho
2018-05-20 20:34:15 +00:00
Matt Macy
f2daab2c8f pmc: avoid potential race on shutdown
Clear shutdown flag first, conservatively allow 5ms for all hardclock consumers to
see flag before drainining
2018-05-20 19:35:24 +00:00
Nathan Whitehorn
4f75b93007 Avoid writing to the frame buffer in early boot on PowerPC if the CPU's
MMU is disabled.

This expands some earlier logic and avoids a number of potential problems:
1. The CPU may not be able to access the framebuffer in real mode (real
   mode does not necessarily encompass all available memory, especially
   under a hypervisor).
2. Real mode accesses generally assume cacheability, so it might not
   even have worked.
3. The difference in cacheability between real mode and later (and
   potentially earlier) points in the boot with the MMU on may cause
   ERAT parity problems, resulting in a machine check.

This fixes real-mode (usefdt=1) early boot on the G5 iMac, which was
previously broken as a result of issue #3. Late boot will require some
other fixups.
2018-05-19 22:04:54 +00:00
Ed Maste
0842ea9bb9 muge(4): chase r333813 if_addr_lock rwlock to epoch + mutex
muge was committed to the tree in r333713 but not yet connected to the
tree, and it crossed paths with the migration to using ck.

Sponsored by:	The FreeBSD Foundation
2018-05-19 18:44:29 +00:00
Matt Macy
4f4eb606dd bhnd nvram map: don't write "variable records written" to standard out by default
Add -v (verbose) option for the developers. The rest of us
derive no value from this information.
2018-05-19 18:15:41 +00:00
Edward Tomasz Napierala
86c61317fd Fix whitespace; no functional changes.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-05-19 15:18:15 +00:00
Edward Tomasz Napierala
1558eec6db Add #defines for vendor/product USB IDs. No functional changes.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-05-19 15:11:24 +00:00
Edward Tomasz Napierala
6073714909 Permit "(", ")", ":", and "/" in USB string descriptors.
This way we can properly show descriptors with URLs in them.

Reviewed by:	hselasky@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-05-19 10:49:51 +00:00
Matt Macy
24a7d6d3a6 netmap and iflib drivers, silence unused var warnings 2018-05-19 05:57:26 +00:00
Matt Macy
3535fae847 netmap: compare e1 with e2, not with itself 2018-05-19 05:37:18 +00:00
Edward Tomasz Napierala
6b7e508c4a Stop claiming the device-side USB serial interfaces talk Hayes AT.
There should be no functional difference.

Reviewed by:	hselasky@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-05-18 20:24:19 +00:00
Matt Macy
d7c5a620e2 ifnet: Replace if_addr_lock rwlock with epoch + mutex
Run on LLNW canaries and tested by pho@

gallatin:
Using a 14-core, 28-HTT single socket E5-2697 v3 with a 40GbE MLX5
based ConnectX 4-LX NIC, I see an almost 12% improvement in received
packet rate, and a larger improvement in bytes delivered all the way
to userspace.

When the host receiving 64 streams of netperf -H $DUT -t UDP_STREAM -- -m 1,
I see, using nstat -I mce0 1 before the patch:

InMpps OMpps  InGbs  OGbs err TCP Est %CPU syscalls csw     irq GBfree
4.98   0.00   4.42   0.00 4235592     33   83.80 4720653 2149771   1235 247.32
4.73   0.00   4.20   0.00 4025260     33   82.99 4724900 2139833   1204 247.32
4.72   0.00   4.20   0.00 4035252     33   82.14 4719162 2132023   1264 247.32
4.71   0.00   4.21   0.00 4073206     33   83.68 4744973 2123317   1347 247.32
4.72   0.00   4.21   0.00 4061118     33   80.82 4713615 2188091   1490 247.32
4.72   0.00   4.21   0.00 4051675     33   85.29 4727399 2109011   1205 247.32
4.73   0.00   4.21   0.00 4039056     33   84.65 4724735 2102603   1053 247.32

After the patch

InMpps OMpps  InGbs  OGbs err TCP Est %CPU syscalls csw     irq GBfree
5.43   0.00   4.20   0.00 3313143     33   84.96 5434214 1900162   2656 245.51
5.43   0.00   4.20   0.00 3308527     33   85.24 5439695 1809382   2521 245.51
5.42   0.00   4.19   0.00 3316778     33   87.54 5416028 1805835   2256 245.51
5.42   0.00   4.19   0.00 3317673     33   90.44 5426044 1763056   2332 245.51
5.42   0.00   4.19   0.00 3314839     33   88.11 5435732 1792218   2499 245.52
5.44   0.00   4.19   0.00 3293228     33   91.84 5426301 1668597   2121 245.52

Similarly, netperf reports 230Mb/s before the patch, and 270Mb/s after the patch

Reviewed by:	gallatin
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D15366
2018-05-18 20:13:34 +00:00
John Baldwin
24ddd0ec9c Be more robust against garbage input on a TOE TLS TX socket.
If a socket is closed or shutdown and a partial record (or what
appears to be a partial record) is waiting in the socket buffer,
discard the partial record and close the connection rather than
waiting forever for the rest of the record.

Reported by:	Harsh Jain @ Chelsio
Sponsored by:	Chelsio Communications
2018-05-18 19:09:11 +00:00
Ed Maste
891cf3ed44 Use NULL for SYSINIT's last arg, which is a pointer type
Sponsored by:	The FreeBSD Foundation
2018-05-18 17:58:09 +00:00
Matt Macy
70398c2f86 epoch(9): Make epochs non-preemptible by default
There are risks associated with waiting on a preemptible epoch section.
Change the name to make them not be the default and document the issue
under CAVEATS.

Reported by:	markj
2018-05-18 17:29:43 +00:00
Ed Maste
e5151258c8 muge(4): style and comment cleanup
And tag some spots to revisit with XXX.

Sponsored by:	The FreeBSD Foundation
2018-05-18 17:07:59 +00:00
Ed Maste
48bc175842 muge(4): sync register names with Microchip's lan7800.h
Microchip provided a permissively-licensed lan78xx header, which has
an 'ETH_' prefix on most definitions.  Follow suit in our driver.

Sponsored by:	The FreeBSD Foundation
2018-05-18 14:30:45 +00:00
Sean Bruno
f097a19eab bnxt(4)
- Fix HWRM warning message during HW LRO configuration.

Submitted by:	bhargava.marreddy@broadcom.com
MFC after:	1 week
Sponsored by:	Broadcom Limited
Differential Revision:	https://reviews.freebsd.org/D15466
2018-05-18 13:49:12 +00:00
Navdeep Parhar
67e071128d cxgbe(4): Implement ifnet callbacks that deal with send tags.
An etid (ethoffload tid) is allocated for a send tag and it acquires a
reference on the traffic class that matches the send parameters
associated with the tag.

Sponsored by:	Chelsio Communications
2018-05-18 06:09:15 +00:00
Matt Macy
cfa866f6a1 netmap: pull fix for 32-bit support from upstream
Approved by:	sbruno
2018-05-18 03:38:17 +00:00