Fix latency spikes on return from stop on POWER9+
On POWER9 and higher platforms, cpu_idle_power9() directly control the external
interrupt enable lines when entering / exiting stop states. This does not
provide needed information to the rest of the kernel regarding the core going
into a stop state, and results in random, significant latency spikes (>200ms)
due to the stopped core not receiving wakeup interrupts in a deterministic
manner.
Bring cpu_idle_power9() in line with cpu_idle_powerx() by using spinlock
entry / exit to control the interrupt state vs. direct MSR read / write.
Signed-off-by: Timothy Pearson <tpearson at raptorengineering.com>
Add machdep.cpu_idle_max_stop_state tunable
Multiple idle and deep sleep states are supported on Power7+ platforms, with
each state having a characteristic latency and effect on system real-time
performance.
Add a tunable to allow a maximum sleep state (maximum theoretical sleep-related
latency) to be set, in order to better support specific latency-sensitive
applications / real time workloads.
Signed-off-by: Timothy Pearson <tpearson at raptorengineering.com>
vm_phys: reduce touching of page->pool fields
Change the usage of the pool field in vm_page structs.
Currently, every page belongs to a pool, and the pool field identifies
that pool, whether the page is allocated or free.
With this change, the pool field of the first page of a free block is
used by the buddy allocator to identify its pool, but the buddy
allocator makes no guarantees about the pool field value for allocated
pages. The buddy allocator requires that a pool parameter be passed as
part of freeing memory. A function that allocates memory may use the
pool field of a page to record what pool to pass as that parameter
when the memory is freed, but might not need to do so for every
allocated page.
Suggested by: alc
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D45409
checkstyle9.pl: don't require Signed-off-by for committers
Silence the warning about Signed-off-by: lines if the Author: is using a
FreeBSD.org address. We don't require the lines in direct FreeBSD
commits so the warning is just noise in this case.
Reviwed by: imp, emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/1577
fibs tests: Fix test failures and simplify
The tests previously expected the invoker to pass a list of FIBs to use.
However, they now run in separate VNET jails, so we can simply expand
the FIB array as needed in each test. Modify each test to simply set
net.fibs as needed and grab FIB numbers starting at 1.
A number of tests were also broken by commit 9206c7996198
("usr.bin/netstat: -n should not print symbolic names"), so fix those.
Reviewed by: asomers
Fixes: 9206c7996198 ("usr.bin/netstat: -n should not print symbolic names")
MFC after: 2 weeks
Sponsored by: Klara, Inc.
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D48585
periodic: set _localbase for periodic scripts from within periodic.conf
Set _localbase variable from within /etc/defaults/periodic.conf
for use by periodic scripts.
This fixes e5d7100c09, no other functional changes intended.
Reported by: gahr, otis
Reviewed by: markj, gahr
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D47486
bsdinstall/zfsboot: Remove unused global variable
In an AMA session on the FreeBSD Discord, it was revealed that no
logic remains calling GPART_BOOTCODE_PARTONLY. It was removed in
aa2a0e0fc311 for FreeBSD 12. git grep shows no other references.
No functional change intended.
MFC after: 2 weeks
Fixes: aa2a0e0fc311 (Enable new UEFI+GELI support)
Reported by: Antranig Vartanian <antranigv at freebsd.am>
Reviewed by: emaste, mhorne
Approved by: emaste, mhorne (src)
Approved by: mhorne, carlavilla (mentors)
Differential Revision: https://reviews.freebsd.org/D48086
pci_host_generic: Use SYS_RES_MEMORY for the parent of I/O resource ranges
When a SYS_RES_IOPORT resource crosses a pci_host_generic bridge, it
is translated into a memory access for an associated range, so use
SYS_RES_MEMORY for the resource allocated from the parent.
Tested by: markj
Differential Revision: https://reviews.freebsd.org/D44207
setfib.2: Note that the number of FIBs can be adjusted after boot
Reviewed by: zlei, imp
MFC after: 2 weeks
Sponsored by: Klara, Inc.
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D48545
if_vxlan(4): Invoke vxlan_stop event handler only when the interface is configured
It is harmless but pointless to invoke vxlan_stop event handler when the
interface was not previously configured. This change will also prevent
an assert panic from t4_vxlan_stop_handler().
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D48494
makefs: Handle special file types when creating a zpool
Previously, anything other than a regular file, directory or symlink
would cause makefs to exit with an assertion failure. Make it a bit
more resilient to user error: print a warning and skip the file. Add a
regression test wherein we create an image from a devfs mount.
PR: 283583
MFC after: 2 weeks
(cherry picked from commit ce878284318e71217d8d8f43f7d590b6c338d3aa)
install: Fix METALOG ouptut for numeric -o and -g args
install's -o and -g flags both accept a name or a numeric argument.
In -U -M (non-root METALOG) mode it always emitted uname= and gname= in
the METALOG, but these are not appropriate for numeric IDs.
If the -o and/or -u arguments parse as an ID, emit uid= and/or gid=
respectively.
Note that if an argument is valid as both a name and numeric ID we will
prefer the name in normal (non -U -M) mode and the ID in -U -M mode. We
don't want to require a passwd db in non-root mode, and entirely-numeric
user or group names are a terrible idea so just accept this discrepancy.
PR: 284119
Reviewed by: jlduran
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48504
hid: Correctly handle signed/unsigned quantities in kernel HID parser.
Wrong signedness of usage value results in inverted range check in hmt(4)
driver that allows out of bound array access leading to panic.
Reported by: many
Sponsored by: Future Crew, LLC
Obtained from: NetBSD
NetBSD PR: kern/53605
PR: 274014, 282592
(cherry picked from commit 38b67578fb4bbf568f7012ca3921a4d15cfe7c5d)
(cherry picked from commit 1dda3a6ed9c51adc908fee4db5917b1232fa932c)
hid: Correctly handle signed/unsigned quantities in kernel HID parser.
Wrong signedness of usage value results in inverted range check in hmt(4)
driver that allows out of bound array access leading to panic.
Reported by: many
Sponsored by: Future Crew, LLC
Obtained from: NetBSD
NetBSD PR: kern/53605
PR: 274014, 282592
(cherry picked from commit 38b67578fb4bbf568f7012ca3921a4d15cfe7c5d)
sound: Make CHN_REMOVE_SAFE() the default
Commit 27b932e32fab ("sound: Safely remove channel from list in one
pass") optimized CHN_REMOVE_SAFE() to perform almost equally to
CHN_REMOVE(), so we can turn CHN_REMOVE_SAFE() into CHN_REMOVE() without
fears of performance regressions, while also being more robust.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: dev_submerge.ch
Differential Revision: https://reviews.freebsd.org/D48249
sound: Safely remove channel from list in one pass
The CHN_REMOVE_SAFE() macro did two traversals of the channel list to
remove a channel, one to check whether the channel is an element of the
list, and a second traversal through SLIST_REMOVE(). Reduce this to one
traversal, while still preventing a NULL dereference in case the channel
in question is not present in the list.
While here, rename the macro arguments to something more descriptive.
MFC after: 1 week
Reviewed by: christos
Differential Revision: https://reviews.freebsd.org/D48207
sound: Unit test the pcm sample read and write macros
Main goal is to have a unit test, with sample test data that is verified
against the current macro implementation of pcm sample read and write
functions. With a test in place, we can proceed on a planned refactoring
of the sample read and write code, and confidently check the new code
for regressions.
Implementation of the unit test itself has to avoid any cast or
conversion affected by endianness, to make the tests compatible with all
machine architectures.
MFC after: 1 week
Reviewed by: christos, markj
Differential Revision: https://reviews.freebsd.org/D48330
netlink: restore the ability to delete PINNED routes
route(8) had such ability before migration to netlink. To be able
to delete PINNED routes we pass RTM_F_FORCE to rib_del_route_px()
when userland uses RTF_PINNED flag with RTM_DELETE command.
This is hackish way for route(8) tool, that third-party software
usually doesn't use.
PR: 279988
Tested by: franco at opnsense org
Discussed with: glebius
Differential Revision: https://reviews.freebsd.org/D46301
(cherry picked from commit 3ce003c8b6151f7764b7934de11c789d6b84ee5c)
ipfw: use only needed TCP flags for state tracking
This fixes stateful firewall failures after adding TH_AE flag
into TH_FLAGS.
Reported by: ronald
Fixes: 347dd05
(cherry picked from commit 9ea8d692f4cb552902b9e8394260d7f3cf4aefb0)
netlink: restore the ability to delete PINNED routes
route(8) had such ability before migration to netlink. To be able
to delete PINNED routes we pass RTM_F_FORCE to rib_del_route_px()
when userland uses RTF_PINNED flag with RTM_DELETE command.
This is hackish way for route(8) tool, that third-party software
usually doesn't use.
PR: 279988
Tested by: franco at opnsense org
Discussed with: glebius
Differential Revision: https://reviews.freebsd.org/D46301
(cherry picked from commit 3ce003c8b6151f7764b7934de11c789d6b84ee5c)
ipfw: use only needed TCP flags for state tracking
This fixes stateful firewall failures after adding TH_AE flag
into TH_FLAGS.
Reported by: ronald
Fixes: 347dd05
(cherry picked from commit 9ea8d692f4cb552902b9e8394260d7f3cf4aefb0)
riscv vmm: implement SBI RFNC extension.
The RISC-V SBI (Supervisor Binary Interface) RFNC (fence) extension is used
to provide a standardized mechanism for enforcing memory and I/O ordering
between different execution contexts or cores in a system. Specifically, it
allows supervisors (such as an operating system kernel) to request certain
synchronization operations across CPUs or harts (hardware threads) via the
SBI.
Differential Revision: https://reviews.freebsd.org/D48441