Commit Graph

133066 Commits

Author SHA1 Message Date
Xin LI
fcf69f3dbc Consistently use gctl_get_provider instead of home-grown variants.
Reviewed by:		cem, imp
MFC after:		2 weeks
Differential revision:	https://reviews.freebsd.org/D25739
2020-07-22 02:15:21 +00:00
Xin LI
0ab851aac3 gctl_get_class, gctl_get_geom and gctl_get_provider: provide feedback
when the requested argument is missing.

Reviewed by:		cem
MFC after:		2 weeks
Differential revision:	https://reviews.freebsd.org/D25738
2020-07-22 02:14:27 +00:00
Mitchell Horne
dc42509049 INTRNG: only shuffle for !EARLY_AP_STARTUP
During device attachment, all interrupt sources will bind to the BSP,
as it is the only processor online. This means interrupts must be
redistributed ("shuffled") later, during SI_SUB_SMP.

For the EARLY_AP_STARTUP case, this is no longer true. SI_SUB_SMP will
execute much earlier, meaning APs will be online and available before
devices begin attachment, and there will therefore be nothing to
shuffle.

All PIC-conforming interrupt controllers will handle this early
distribution properly, except for RISC-V's PLIC. Make the necessary
tweak to the PLIC driver.

While here, convert irq_assign_cpu from a boolean_t to a bool.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D25693
2020-07-21 22:47:02 +00:00
Alexander V. Chernikov
e1c05fd290 Transition from rtrequest1_fib() to rib_action().
Remove all variations of rtrequest <rtrequest1_fib, rtrequest_fib,
 in6_rtrequest, rtrequest_fib> and their uses and switch to
 to rib_action(). This is part of the new routing KPI.

Submitted by: Neel Chauhan <neel AT neelc DOT org>
Differential Revision: https://reviews.freebsd.org/D25546
2020-07-21 19:56:13 +00:00
Alan Somers
aafaa8b794 Fix geli's null cipher, and add a test case
PR:		247954
Submitted by:	jhb (sys), asomers (tests)
Reviewed by:	jhb (tests), asomers (sys)
MFC after:	2 weeks
Sponsored by:	Axcient
2020-07-21 19:18:29 +00:00
Alexander Motin
f2b6da18de Avoid code duplicaiton by using ipi_selected().
MFC after:	2 weeks
2020-07-21 17:18:38 +00:00
Richard Scheffenegger
cce999b38f Fix style and comment around concave/convex regions in TCP cubic.
In cubic, the concave region is when snd_cwnd starts growing slower
towards max_cwnd (cwnd at the time of the congestion event), and
the convex region is when snd_cwnd starts to grow faster and
eventually appearing like slow-start like growth.

PR:		238478
Reviewed by:	tuexen (mentor), rgrimes (mentor)
Approved by:	tuexen (mentor), rgrimes (mentor)
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D24657
2020-07-21 16:21:52 +00:00
Mateusz Guzik
4aff9f5d99 lockmgr: denote recursion with a bit in lock value
This reduces excessive reads from the lock.

Tested by:	pho
2020-07-21 14:42:22 +00:00
Mateusz Guzik
f6b091fbbd lockmgr: rewrite upgrade to stop always dropping the lock
This matches rw and sx locks.
2020-07-21 14:41:25 +00:00
Mateusz Guzik
bdb6d824f4 lockmgr: add a helper for reading the lock value 2020-07-21 14:39:20 +00:00
Andrew Turner
7377c1df84 Only write to VIRTIO_MMIO_GUEST_PAGE_SIZE with virtio mmio version 1
This register is only defined for the legacy v1 interface so only write
to it when interacting with a legacy device.

Sponsored by:	Innovate UK
2020-07-21 14:25:36 +00:00
Ruslan Bukin
1238a28d15 Move sys/iommu.h to dev/iommu/ as a part of generic IOMMU busdma backend.
Reviewed by:	kib
Sponsored by:	DARPA/AFRL
Differential Revision:	https://reviews.freebsd.org/D25750
2020-07-21 13:50:10 +00:00
Ruslan Bukin
f2b2f31707 Move the Intel DMAR busdma backend to a generic place so
it can be used on other IOMMU systems.

Reviewed by:	kib
Sponsored by:	DARPA/AFRL
Differential Revision:	https://reviews.freebsd.org/D25720
2020-07-21 10:38:51 +00:00
Andriy Gapon
2032c532aa dtrace/fbt: fix return probe arguments on arm
arg0 should be an offset of the return point within the function, arg1
should be the return value.  Previously the return probe had arguments as
if for the entry probe.

Tested on armv7.

andrew noted that the same problem seems to be present on arm64, mips,
and riscv.
I am not sure if I will get around to fixing those.  So, platform users
or anyone looking to make a contribution please be aware of this
opportunity.

Reviewed by:	markj
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D25685
2020-07-21 07:41:36 +00:00
Andriy Gapon
e57f9c8a9f gpioiic: never drive lines active high
I2C communication is done by a combination of driving a line low or
letting it float, so that it is either pulled up or driven low by
another party.

r355276 besides the stated goal of the change -- using the new GPIO API
-- also changed the logic, so that active state is signaled by actively
driving a line.

That worked with iicbb prior to r362042, but stopped working after that
commit on at least some hardware.  My guess that the breakage was
related to getting an ACK bit.  A device expected to be able to drive
SDA actively low, but controller was actively driving it high for some
time.

Anyway, this change seems to fix the problem.
Tested using gpioiic on Orange Pi PC Plus with HTU21 sensor.

Reported by:	Nick Kostirya <nikolay.kostirya@i11.co>
Reviewed by:	manu
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D25684
2020-07-21 07:35:03 +00:00
Richard Scheffenegger
66ba9aafcf Add MODULE_VERSION to TCP loadable congestion control modules.
Without versioning information, using preexisting loader /
linker code is not easily possible when another module may
have dependencies on pre-loaded modules, and also doesn't
allow the automatic loading of dependent modules.

No functional change of the actual modules.

Reviewed by:	tuexen (mentor), rgrimes (mentor)
Approved by:	tuexen (mentor), rgrimes (mentor)
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D25744
2020-07-20 23:47:27 +00:00
John Baldwin
33a1a488d5 Don't dynamically allocate data structures for KTLS crypto requests.
Allocate iovec arrays and struct cryptop and struct ocf_operation
objects on the stack to reduce avoid the overhead of malloc().

These structures are all small enough to fit on the stack of the KTLS
worker threads.

Reviewed by:	gallatin
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D25692
2020-07-20 22:32:39 +00:00
Vincenzo Maffione
ac11d85740 iflib: initialize netmap with the correct number of descriptors
In case the network device has a RX or TX control queue, the correct
number of TX/RX descriptors is contained in the second entry of the
isc_ntxd (or isc_nrxd) array, rather than in the first entry.
This case is correctly handled by iflib_device_register() and
iflib_pseudo_register(), but not by iflib_netmap_attach().
If the first entry is larger than the second, this can result in a
panic. This change fixes the bug by introducing two helper functions
that also lead to some code simplification.

PR:	247647
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D25541
2020-07-20 21:08:56 +00:00
Mark Johnston
e1a82b35bf crypto(9): Stop checking for failures from malloc(M_WAITOK).
PR:		240545
Submitted by:	Andrew Reiter <arr@watson.org>
Reviewed by:	cem, delphij, jhb
MFC after:	1 week
Event:		July 2020 Bugathon
2020-07-20 17:44:13 +00:00
Mark Johnston
17eee3b501 Fix a memory leak in dsl_scan_visitbp().
This should be triggered only if arc_read() fails, i.e., quite rarely.
The same logic is already present in OpenZFS.

PR:		247445
Submitted by:	jdolecek@NetBSD.org
MFC after:	1 week
2020-07-20 17:05:44 +00:00
Alan Somers
b4fef8d068 padlock: fix Via Padlock with 192-bit keys
It's been broken since a typo in r359374

Reviewed by:	jhb
MFC after:	2 weeks
Sponsored by:	Axcient
Differential Revision:	https://reviews.freebsd.org/D25710
2020-07-20 16:12:14 +00:00
Mark Johnston
39bc40e3d2 ext2fs: Stop checking for failures from malloc(M_WAITOK).
PR:		240545
Submitted by:	Andrew Reiter <arr@watson.org>
Reviewed by:	fsu
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D25707
2020-07-20 14:28:26 +00:00
Xin LI
82b17c8e91 Fix indent for if clause.
MFC after:	2 weeks
2020-07-20 01:55:19 +00:00
Mitchell Horne
cf5cd89c3a riscv: look for bootargs in FDT
The FDT may contain a short /chosen/bootargs string which we should pass
to boot_parse_cmdline. Notably, this allows the use of qemu's -append
option to pass things like -s to boot to single user mode.

Submitted by:	Nathaniel Filardo <nwf20@cl.cam.ac.uk>
Reviewed by:	mhorne
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D25544
2020-07-19 23:34:52 +00:00
Mitchell Horne
bd8f09eb49 Make efirt module dependent on MK_EFI
MK_EFI was added to kern.opts.mk in r331099, but is currently unused.
Take advantage of that fact and gate the build of efirt behind it.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D24673
2020-07-19 23:19:09 +00:00
Ian Lepore
d4fb0c0a56 The ds3231 RTC chip bitmask values for 12- versus 24-hour mode were reversed,
flip them so that times in the 20:00:00 to 23:59:59 range read correctly.

Reported by:	Dr. Rolf Jansen <freebsd-rj@obsigna.com>
Pointy hat:	ian@
2020-07-19 18:53:19 +00:00
Konstantin Belousov
0675f4e1ca Simplify non-pti syscall entry on amd64.
Limit manipulations to use %rax as scratch to the pti portion of the
syscall entry code.

Submitted by:	alc
Reviewed by:	markj
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D25722
2020-07-19 17:47:55 +00:00
Adrian Chadd
208b9eabb4 [if_an] unbreak!
.. I missed this when checking drivers.

Differential Revision:	https://reviews.freebsd.org/D25723
2020-07-19 17:27:48 +00:00
Adrian Chadd
78957abd9e [net80211] missing from last commit, le whoops
Differential Revision:https://reviews.freebsd.org/D25630
2020-07-19 16:07:51 +00:00
Adrian Chadd
f7d38a13a8 [net80211] Add new privileges; restrict what can be done in a jail.
Split the MANAGE privilege into MANAGE, SETMAC and CREATE_VAP.

+ VAP_MANAGE is everything but setting the MAC and creating a VAP.
+ VAP_SETMAC is setting the MAC address of the VAP.
  Typically you wouldn't want the jail to be able to modify this.
+ CREATE_VAP is to create a new VAP. Again, you don't want to be doing
  this in a jail, but this DOES stop being able to run some corner
  cases like Dynamic WDS (DWDS) AP in a jail/vnet. We can figure this
  bit out later.

This allows me to run wpa_supplicant in a jail after transferring
a STA VAP into it. I unfortunately can't currently set the wlan
debugging inside the jail; that would be super useful!

Reviewed by:	bz
Differential Revision:	https://reviews.freebsd.org/D25630
2020-07-19 15:16:27 +00:00
Michael Tuexen
8745f898c4 Add reference counts for inp/stcb/net when timers are running.
This avoids a use-after-free reported for the userland stack.
Thanks to Taylor Brandstetter for suggesting a patch for
the userland stack.

MFC after:		1 week
2020-07-19 12:34:19 +00:00
Edward Tomasz Napierala
aa75412146 Make linux(4) support the BLKPBSZGET ioctl. Oracle uses it.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25694
2020-07-19 12:25:03 +00:00
Alexander V. Chernikov
725871230d Temporarly revert r363319 to unbreak the build.
Reported by:	CI
Pointy hat to: melifaro
2020-07-19 10:53:15 +00:00
Alexander V. Chernikov
8cee15d9e4 Transition from rtrequest1_fib() to rib_action().
Remove all variations of rtrequest <rtrequest1_fib, rtrequest_fib,
 in6_rtrequest, rtrequest_fib> and their uses and switch to
to rib_action(). This is part of the new routing KPI.

Submitted by:	Neel Chauhan <neel AT neelc DOT org>
Differential Revision:	https://reviews.freebsd.org/D25546
2020-07-19 09:29:27 +00:00
Konstantin Belousov
3ec7e1695c amd64 pmap: microoptimize local shootdowns for PCID PTI configurations
When pmap operates in PTI mode, we must reload %cr3 on return to
userspace.  In non-PCID mode the reload always flushes all non-global
TLB entries and we take advantage of it by only invalidating the KPT
TLB entries (there is no cached UPT entries at all).

In PCID mode, we flush both KPT and UPT TLB explicitly, but we can
take advantage of the fact that PCID mode command to reload %cr3
includes a flag to flush/not flush target TLB.  In particular, we can
avoid the flush for UPT, instead record that load of pc_ucr3 into %cr3
on return to usermode should be flushing.  This is done by providing
either all-1s or ~CR3_PCID_MASK in pc_ucr3_load_mask.  The mask is
automatically reset to all-1s on return to usermode.

Similarly, we can avoid flushing UPT TLB on context switch, replacing
it by setting pc_ucr3_load_mask.  This unifies INVPCID and non-INVPCID
PTI ifunc, leaving only 4 cases instead of 6.  This trick is also
applicable both to the TLB shootdown IPI handlers, since handlers
interrupt the target thread.

But then we need to check pc_curpmap in handlers, and this would
reopen the same race for INVPCID machines as was fixed in r306350 for
non-INVPCID.  To not introduce the same bug, unconditionally do
spinlock_enter() in pmap_activate().

Reviewed by:	alc, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
Differential revision:	https://reviews.freebsd.org/D25483
2020-07-18 18:19:57 +00:00
Ruslan Bukin
08e99af305 o Move iommu_test_boundary() to sys/iommu.h
o Rename DMAR -> IOMMU in comments
o Add IOMMU_PAGE_SIZE / IOMMU_PAGE_MASK macroses
o x86 only: dmar_quirks_pre_use() / dmar_instantiate_rmrr_ctxs()

Reviewed by:	kib
Sponsored by:	DARPA/AFRL
Differential Revision:	https://reviews.freebsd.org/D25665
2020-07-18 13:10:31 +00:00
Michael Tuexen
05bceec68e Remove code which is not needed.
MFC after:		1 week
2020-07-18 13:10:02 +00:00
Kristof Provost
93ed6ade6e bridge: Don't sleep during epoch
While it doesn't trigger INVARIANTS or WITNESS on head it does in stable/12.
There's also no reason for it, as we can easily report the out of memory error
to the caller (i.e. userspace). All of these can already fail.

PR:		248046
MFC after:	3 days
2020-07-18 12:43:11 +00:00
Edward Tomasz Napierala
d5c5b4b382 Make linux fallocate(2) return EOPNOTSUPP, not ENOSYS, on unsupported mode,
as documented in the man page.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2020-07-18 12:21:08 +00:00
Edward Tomasz Napierala
eb6ae7576d Bump the default linux version from 3.2.0 to 3.10.0, which corresponds
to RHEL 7.  Required for DB2.

Reviewed by:	emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25656
2020-07-18 11:37:30 +00:00
Edward Tomasz Napierala
3e9a214260 Regen after r363304.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2020-07-18 11:31:31 +00:00
Edward Tomasz Napierala
8d1d017175 Add a trivial linux(4) splice(2) implementation, which simply
returns EINVAL.  Fixes grep (grep-3.1-2build1).

PR:		kern/218699
Reported by:	avos
Reviewed by:	emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25636
2020-07-18 11:28:40 +00:00
Edward Tomasz Napierala
978ffef22f Add missing SysV IPC stats to linprocfs(4). Fixes 'ipcs -l',
and also helps Oracle.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25669
2020-07-18 10:56:04 +00:00
Edward Tomasz Napierala
7ce051e799 Fix bogomips calculation. Previously it was off by half. This was
verified under VMWare Fusion, comparing to what's reported under CentOS,
and by comparing numbers reported by linuxulator on T420 with a googled
up Linux cpuinfo (https://lkml.org/lkml/2011/11/29/116).

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20693
2020-07-18 10:53:56 +00:00
Edward Tomasz Napierala
8ba7dddd6f Fix two typos in flag names in /proc/cpuinfo.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25695
2020-07-18 10:49:17 +00:00
Jung-uk Kim
61b180362a MFV: r363292
Merge ACPICA 20200717.
2020-07-18 07:35:34 +00:00
Mateusz Guzik
7cd4443fb1 Short-circuit tdfind when looking for the calling thread.
Common occurence with cpuset and other places.
2020-07-18 00:14:43 +00:00
Chuck Silvers
1bd12a3bb2 Fix vnode_pager handling of read ahead/behind pages when a disk read fails.
Rather than marking the read ahead/behind pages valid even though they were
not initialized, free them using the new function vm_page_free_invalid().

Reviewed by:	markj, kib
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D25430
2020-07-17 23:10:35 +00:00
Chuck Silvers
4dfa06e114 Add a new function vm_page_free_invalid() for freeing invalid pages
that might be wired.  If the page is wired then it cannot be freed now,
but the thread that eventually unwires it will free it at that point.

Reviewed by:	markj, kib
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D25430
2020-07-17 23:09:36 +00:00
Chuck Silvers
c3dbadc1fd Revert my change from r361855 in favor of a better fix.
Reviewed by:	markj, kib
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D25430
2020-07-17 23:08:01 +00:00