Commit Graph

145182 Commits

Author SHA1 Message Date
Kyle Evans
866beaa0aa psci: set psci_present as early as possible
psci_attach is way too late to provide the intended semantics for
psci_present.  psci calls can be made immediately after psci_init(),
called way earlier at SI_SUB_CPU + SI_ORDER_FIRST, and we need it to
be valid as early as we can possibly call a psci function.

This fixes booting RPi3+4 with the in-review spintable patch;
rpi3-psci-monitor patches the FDT to add a PSCI node, but it doesn't
patch each cpus' enable-method.  Because of this, we would stall the
boot while enabling CPU 1 as we saw a valid looking enable-method and
"no" functional PSCI and attempted to use the spintable rather than
simply not starting secondary APs.

Fixes:	2218070b2c ("psci: finish psci_present implementation")
Reported by:	karels
2022-10-26 23:22:23 -05:00
Konstantin Belousov
017367c114 ffs validate_sblock(): avoid 32bit mul overflow
Reported by:	soralx@cydem.org
Tested by:	pho
Reviewed by:	mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2022-10-27 06:17:38 +03:00
Jason A. Harmening
f7833196bd vfs_lookup(): Minor performance optimizations
Refactor the symlink and mountpoint traversal logic to avoid
repeatedly checking the vnode type; a symlink cannot be a mountpoint
and vice versa.  Avoid repeatedly checking cn_flags for NOCROSSMOUNT
and simplify the check which determines whether the vnode is a
mountpoint.

Suggested by:	mjg
Reviewed by:	kib
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D35054
2022-10-26 19:33:33 -05:00
Jason A. Harmening
4390622c8d vfs_busy(): fix wording in comment
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D35054
2022-10-26 19:33:30 -05:00
Jason A. Harmening
706f15c5fa Remove witness directives from crossmp locking VOPs
These are of limited use since the crossmp vnode locking ops have not
actually used a lock since commit
a2d3554542.  We in fact require that
these operations are always issued with LK_SHARED.  Additionally,
these directives can produce a false positive in certain VV_CROSSLOCK
cases which require upgrading of the covered vnode lock from shared
to exclusive.

While here, replace the runtime check of LK_SHARED with a KASSERT and
expand the check to include LK_NOWAIT, which all callers pass.

Reviewed by:	kib
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D35054
2022-10-26 19:33:18 -05:00
Jason A. Harmening
080ef8a418 Add VV_CROSSLOCK vnode flag to avoid cross-mount lookup LOR
When a lookup operation crosses into a new mountpoint, the mountpoint
must first be busied before the root vnode can be locked. When a
filesystem is unmounted, the vnode covered by the mountpoint must
first be locked, and then the busy count for the mountpoint drained.
Ordinarily, these two operations work fine if executed concurrently,
but with a stacked filesystem the root vnode may in fact use the
same lock as the covered vnode. By design, this will always be
the case for unionfs (with either the upper or lower root vnode
depending on mount options), and can also be the case for nullfs
if the target and mount point are the same (which admittedly is
very unlikely in practice).

In this case, we have LOR. The lookup path holds the mountpoint
busy while waiting on what is effectively the covered vnode lock,
while a concurrent unmount holds the covered vnode lock and waits
for the mountpoint's busy count to drain.

Attempt to resolve this LOR by allowing the stacked filesystem
to specify a new flag, VV_CROSSLOCK, on a covered vnode as necessary.
Upon observing this flag, the vfs_lookup() will leave the covered
vnode lock held while crossing into the mountpoint. Employ this flag
for unionfs with the caveat that it can't be used for '-o below' mounts
until other unionfs locking issues are resolved.

Reported by:	pho
Tested by:	pho
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D35054
2022-10-26 19:33:03 -05:00
John Baldwin
769b884e2e vmm: Fix AP startup with old userspace binaries.
Older binaries that do not request IPI exits to userspace do not
start user threads for other vCPUs until a STARTUP IPI triggers a
VM_EXITCODE_SPINUP_AP exit to userland.  This means that those vcpus
are not yet active (in terms of vm_active_cpus) when the INIT and
STARTUP IPIs are delivered to the vCPUs.

The changes in commit 0bda8d3e9f changed the INIT and STARTUP IPIs
to reuse the existing vlapic_calcdest() function.  This function
silently ignores IPIs sent to inactive vCPUs.  As a result, when using
an old bhyve binary, the INIT and STARTUP IPIs sent to wakeup APs were
ignored.

To fix, restructure the compat code for the INIT and STARTUP IPIs to
ignore the results of vlapic_calcdest() and manually parse the APIC ID
and resulting vcpuid.  As part of this, make the compat code always
conditonal on the ipi_exit capability being disabled.

Reviewed by:	c.koehne_beckhoff.com, markj
Differential Revision:	https://reviews.freebsd.org/D37093
2022-10-26 14:22:56 -07:00
Mateusz Guzik
d346e3ac33 vfs: use cache_assert_no_entries instead of open-coding it 2022-10-26 15:54:19 +00:00
Gordon Bergling
5daf88ea5e qlnxe(4): Fix a typo in a source code comment
- s/defult/default/

MFC after:	3 days
2022-10-26 17:27:07 +02:00
Gleb Smirnoff
77fe40cf2f netinet*: add back necessary headers
The LINT successful build was provided by the includes that SCTP
pulled in.

Fixes:	92e190f11f
2022-10-26 08:16:44 -07:00
Souradeep Chakrabarti
d16d0b6b19 Hyper-V: Code refactor to avoid redundancy of MSR values on x86 and arm64
Refactor the code to put split the MSR values for x86 and arm64
Hyper-V. Code not yet built. This is one of several patches for
the arm64 Hyper-V enablement.

Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D37103
2022-10-26 03:50:59 +00:00
Gleb Smirnoff
92e190f11f netinet*: remove unneeded headers from files that just declare domains 2022-10-25 11:09:23 -07:00
Gleb Smirnoff
eda633455a tcp: remove useless today lock assertion in a middle of function
It was added back in 7cfc690440, when there was a jump label
above and tcp_input() hadn't been locked all through.
2022-10-25 11:09:22 -07:00
Warner Losh
91f45a3cf3 intrng: Remove from NOTES file
INTRNG is required on these platforms. Remove it from the NOTES file
since it is now in the DEFAULTS file.

Suggested by:		mhorne
Sponsored by:		Netflix
2022-10-25 10:57:29 -06:00
Warner Losh
e0cab5cdb3 subr_physmem: Fix userspace build
Include stdbool.h in userspace configurations. For the kernel builds we
get it from sys/types.h, but bool isn't defined there for non-kernel
builds and this otherwise kernel-only file is used for the physmem test
suite.

Fixes:			deb1e3b719
Sponsored by:		Netflix
2022-10-25 10:57:29 -06:00
Warner Losh
a67c0fae0c vnic: work_done here only used for debug
Sponsored by:		Netflix
2022-10-25 10:57:29 -06:00
Warner Losh
b66e766d57 genet: cnt here is write only and can be removed
Sponsored by:		Netflix
2022-10-25 10:57:29 -06:00
Konstantin Belousov
829145388b x86/include/elf.h: make inclusion blocks for elf32.h and elf64.h similar
They were copy-pasted when x86/include/elf.h file was merged from its
i386 and amd64 counterparts.  Having the text around inclusions
significantly different is somewhat confusing.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37085
2022-10-25 19:00:44 +03:00
Konstantin Belousov
5f00525dfc i386: move hard-coded load address for PIE below default linker base
both for i386 native and compat32 amd64.  We know the ld-elf.so.1 size
in advance, it fits there.  Trying to push it up after the end of a
binary cannot work reliably and eventually fail for large binaries.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37085
2022-10-25 19:00:44 +03:00
Konstantin Belousov
ca18304ea4 arm, arm64: tweak hard-coded load addresses for PIE binaries
They are used when ASLR is not applied.
The need for adjusting is due to rtld direct exec mode puts ld-elf.so.1
at the PIE load address, and this address must not conflict with the
default linker' load address for non-PIE binaries.  Otherwise rtld in
direct mode cannot activate image.  Example of implicit failure is ldd(1)
refusing to run.

Reported by:	kp
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37085
2022-10-25 19:00:44 +03:00
Warner Losh
deb1e3b719 physmem: Add physmem_excluded to query if a region is excluded
In order to safely reuse excluded memory when it's reserved for special
purpose, we need to test whether or not the memory has been reserved
early in boot. physmem_excluded will return true when the entire range
is excluded, false otherwise.

Sponsored by:		Netflix
2022-10-25 09:32:49 -06:00
Warner Losh
ecb167daf7 efi: Add linux memory reserve table defniitions
There is some hardware which can't be completely reset to release the
memory it is using(so far only the GICv3 on arm has fit this
bill). Since that meory needs to be reserved by the OS for that
hardware's later use of it, create defines for code that will parse that
memory table. Otherise the system may allocate the memory for block I/O,
network packets, etc which will lead to memory corruption.

When booting via Linux's kexec protocol, it will add this table to the
EFI systbl's cfgtbl array. While the mechanism to pass 'configuration'
is standardized, these specific tables are not documented except in the
Linux source. Include comments gleened from its study.

Sponsored by:		Netflix
2022-10-25 09:32:49 -06:00
Mark Johnston
ed72168431 bhyve: Address some signed/unsigned comparison warnings
MFC after:	1 week
2022-10-25 11:16:57 -04:00
Gordon Bergling
8ba2beacfd netmap(4): Fix a typo in a source code comment
- s/microsconds/microseconds/

MFC after:	3 days
2022-10-25 14:56:25 +02:00
Gordon Bergling
d53e97bb54 smartpqi(4): Fix two typos in kernel error messages
- s/runnning/running/

MFC after:	2 weeks
2022-10-25 13:17:20 +02:00
Gordon Bergling
24a630de81 arcmsr(4): Fix a typo in a source code comment
- s/faild/failed/

MFC after:	3 days
2022-10-25 12:57:37 +02:00
Gordon Bergling
c03e35accc firewire(4): Fix a typo in an error message
- s/faild/failed/

MFC after:	5 days
2022-10-25 12:54:15 +02:00
Gordon Bergling
dabebd0ba2 ocs_fc(4): Fix a typo in an error message
- s/faild/failed/

MFC after:	5 days
2022-10-25 12:52:24 +02:00
Gordon Bergling
558ec54da3 netpfil: Fix two typos in source code comments
- s/missmatch/mismatch/

MFC after:	3 days
2022-10-25 04:32:59 +02:00
Gordon Bergling
156ce1e51c net8021: Fix a typo in a kernel error message
- s/missmatch/mismatch/

MFC after:	1 week
2022-10-25 04:31:51 +02:00
Konstantin Belousov
fd6dd33dc0 opencrypto: fix null esp crypt
Fixes:	3e9470482a
Reviewed by:	jhb
Sponsored by:	Nvidia networking
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37113
2022-10-25 03:24:43 +03:00
Bjoern A. Zeeb
b5a8107590 LinuxKPI: seq_file add "private" versions.
Add __seq_open_private() and seq_release_private() needed by iwlwifi
debugfs support.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D37089
2022-10-24 21:39:48 +00:00
Bjoern A. Zeeb
16295b0a5a dpaa2: cleanup some include files
2782ed8f6c fixed the standalone module
build.  REmove the now duplicate includes for opt_acpi.h and
opt_platform.h.  Als remove the if_mdio.h again in both the Makefile
and the implementation file as it is not (currently) used.

X-MFC with:	ba7319e909
MFC after:	70 days
2022-10-24 21:24:32 +00:00
Randall Stewart
31bc602ff8 Rack and BBR broken with the new timewait state purge.
We recently got rid of the explicit INP_TIMEWAIT state, this has caused some
minor breakage to both rack and bbr. Basically the timewait check that was
in tcp_lro.c is now gone. This means that compressed_ack and mbuf_queued
packets will arrive at TCP without going through tcp_input_with_port(). We need
to expand the check that was stripped to look at the tcp_state (t_state) and
not "LRO" packets that are in the TCPS_TIMEWAIT state.

Reviewed by: tuexen, gliebus
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D37080
2022-10-24 15:47:29 -04:00
Kristof Provost
13b1d6f0c9 if_ovpn: avoid netisr_queue name conflicts
Rename the netisr_queue variable in if_ovpn.c to avoid naming conflicts.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-10-24 20:45:39 +02:00
Warner Losh
ef1851fb43 acpi_ged: Module build no longer needs to define INTRNG
Now that we properly define INTRNG generically on all the platforms that
need it in opt_global.h, we don't need to define it here.

Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D37110
2022-10-24 12:13:04 -06:00
Warner Losh
4355ab6f04 config.mk: All options in DEFAULTS are now defined in opt_global.h
To simplify management of all the options that should be enabled for the
different architectures, adopt the convention that all options listed in
DEFAULTS will be #defined to 1 in opt_global.h for untied builds. Except
for GEOM_* and ISAPNP, they are all in opt_global.h. ISAPNP is a
opt_dontuse.h, so only filter GEOM_*.

Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D37108
2022-10-24 12:13:04 -06:00
Warner Losh
d6f1e6aa11 config: Make ISAPNP be in opt_dontuse.h
Nothing uses ISAPNP today, apart from bringing in files or not. There's
really no need to ever do #ifdef ISAPNP in drivers and such. It means
use the ISA bus plug and play isolation protocol to enumerate the bus,
not the more useful 'you might have devices with isa pnp ids' which all
drivers hide behind DEV_ISA and/or an isa clause in the files files.

Sponsored by:		Netflix
Reviewed by:		kevans, emaste
Differential Revision:	https://reviews.freebsd.org/D37109
2022-10-24 12:13:03 -06:00
Warner Losh
d4f6b11f66 DEFAULTS: move intrng to DEFAULTS for its platforms.
Sponsored by:		Netflix
Reviewed by:		manu, kevans
Differential Revision:	https://reviews.freebsd.org/D37107
2022-10-24 12:13:03 -06:00
Mark Johnston
6fe0a6c80a zfs: Fix a pair of bugs in zfs_fhtovp()
This cherry-picks upstream ed566bf1cd

    - Add a zfs_exit() call in an error path, otherwise a lock is
      leaked.
    - Remove the fid_gen > 1 check.  That appears to be Linux-specific:
      zfsctl_snapdir_fid() sets fid_gen to 0 or 1 depending on whether
      the snapshot directory is mounted.  On FreeBSD it fails, making
      snapshot dirs inaccessible via NFS.

PR:		266236
MFC after:	3 days
2022-10-24 12:05:17 -04:00
Gleb Smirnoff
ba23f762ec acpi_ged: fix build with ACPI_DEBUG 2022-10-24 09:00:04 -07:00
Mateusz Guzik
d653aaec7a cache: add cache_assert_no_entries 2022-10-24 15:37:43 +00:00
Takanori Watanabe
9cf5db6369 acpi_ged: fix build, as module and non INTRNG case.
Reviewed-by: cy

Differential Revision: https://reviews.freebsd.org/D37104
2022-10-24 23:37:28 +09:00
Takanori Watanabe
a9880bfe11 acpi_ged: New driver to ACPI generic event device
New driver to ACPI generic event device, defined in ACPI spec.
Some ACPI power button may not work without this.

In qemu arm64 with "virt" machine, with ACPI firmware,
enable devd check devd message by
and invoke following command in qemu monitor
(qemu) system_powerdown
and make sure some power button input event appear.
(setting sysctl hw.acpi.power_button_state=S5 is not work,
because ACPI tree does not have \_S5 object.)

Reviewed by: andrew, hrs
Differential Revision: https://reviews.freebsd.org/D37032
2022-10-24 18:57:36 +09:00
Kristof Provost
22893e5840 bridge: default to not filtering L3
Change the default for net.link.bridge.pfil_member and
net.link.bridge.pfil_bridge to zero.

That is, default to not calling layer 3 firewalls on the bridge or its
member interfaces.

With either of these enabled the bridge will, during L2 processing,
remove the Ethernet header from packets, feed them to L3 firewalls,
re-add the Ethernet header and send them out.

Not only does this interact very poorly with firewalls which defer
packets, or reassemble and refragment IPv6, it also causes considerable
confusion for users, because the firewall gets called in unexpected
ways.

For example, a bridge which contains a bhyve tap and the host's LAN
interface. We'd expect traffic between the LAN and bhyve VM to pass, no
matter what (layer 3) firewall rules are set on the host. That's not the
case as long as pfil_bridge or pfil_member are set.

Reviewed by:	Zhenlei Huang
MFC:		never
Differential Revision:	https://reviews.freebsd.org/D37009
2022-10-24 08:52:21 +02:00
Wei Hu
2db785aa01 arm64: Hyper-V: fix couple more commit errors caused by duplicated lines
Remove those duplicated lines.

Reported by:	Souradeep Chakrabarti <schakrabarti@microsoft.com>
Fixes:		6cf00ef80c
Sponsored by:	Microsoft
2022-10-24 08:14:25 +00:00
Kristof Provost
dc12ee39b7 if_ovpn: add sysctls for netisr_queue() and crypto_dispatch_async()
Allow the choice between asynchronous and synchronous netisr and crypto
calls. These have performance implications, but depend on the specific
setup and OCF back-end.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D37017
2022-10-24 10:08:35 +02:00
Bjoern A. Zeeb
d3975204e4 LinuxKPI: add MSEC_PER_SEC
Sponsored by:	The FreeBSD Foundation
Reviewed by:	imp, emaste
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D37087
2022-10-23 21:54:36 +00:00
Bjoern A. Zeeb
64d3da0063 LinuxKPI: 802.11: add MO tracing
Add a macro to each implemented mac80211 operation.  This currently
turns into a printf if LINUXKPI_80211_DEBUG is defined but in the
future could become a different probe as well.
This is helpful for quick analysis and boot-time problem debugging
when DTrace and other frameworks may be harder to use.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-10-23 21:48:22 +00:00
Hans Petter Selasky
fdd9548333 time(3): Fix spelling.
Noted by:	Gary Jennejohn <garyj@gmx.de>
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-10-23 18:42:11 +02:00