#
2cb49090 |
| 30-Apr-2024 |
Justin Hibbits <jhibbits@FreeBSD.org> |
cons: Add boot option to mute boot messages after banner
This is useful for embedded systems, where it provides feedback that the kernel has booted, but avoids printing the probe messages. If both
cons: Add boot option to mute boot messages after banner
This is useful for embedded systems, where it provides feedback that the kernel has booted, but avoids printing the probe messages. If both mutemsgs and verbose are set, verbose cancels the mute.
Additionally, this unmutes the console on panic, so a user can see what happened leading up to the panic.
Obtained from: Juniper Networks, Inc.
show more ...
|
#
2aee804c |
| 27-Mar-2024 |
Stephen J. Kiernan <stevek@FreeBSD.org> |
kerneldump: Add flag to indicate kernel core was successfully dumped
This allows for shutdown_final EVENTHANDLERs to know that a core dump successfully occurred. Embedded systems may want to record
kerneldump: Add flag to indicate kernel core was successfully dumped
This allows for shutdown_final EVENTHANDLERs to know that a core dump successfully occurred. Embedded systems may want to record this fact or act on it.
Obtained from: Juniper Networks, Inc. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44542
show more ...
|
Revision tags: release/13.3.0 |
|
#
e4ab361e |
| 06-Feb-2024 |
Andriy Gapon <avg@FreeBSD.org> |
fix poweroff regression from 9cdf326b4f by delaying shutdown_halt
The regression affected ACPI-based systems without EFI poweroff support (including VMs).
The key reason for the regression is that
fix poweroff regression from 9cdf326b4f by delaying shutdown_halt
The regression affected ACPI-based systems without EFI poweroff support (including VMs).
The key reason for the regression is that I overlooked that poweroff is requested by RB_POWEROFF | RB_HALT combination of flags. In my opinion, that command is a bit bipolar, but since we've been doing that forever, then so be it. Because of that flag combination, the order of shutdown_final handlers that check for either flag does matter.
Some additional complexity comes from platform-specific shutdown_final handlers that aim to handle multiple reboot options at once. E.g., acpi_shutdown_final handles both poweroff and reboot / reset. As explained in 9cdf326b4f, such a handler must run after shutdown_panic to give it a chance. But as the change revealed, the handler must also run before shutdown_halt, so that the system can actually power off before entering the halt limbo.
Previously, shutdown_panic and shutdown_halt had the same priority which appears to be incompatible with handlers that can do both poweroff and reset.
The above also applies to power cycle handlers.
PR: 276784 Reported by: many Tested by: Katsuyuki Miyoshi <katsubsd@gmail.com>, Masachika ISHIZUKA <ish@amail.plala.or.jp> Fixes: 9cdf326b4fae run acpi_shutdown_final later to give other handlers a chance MFC after: 1 week
show more ...
|
#
6b353101 |
| 18-Jan-2024 |
Olivier Certner <olce@FreeBSD.org> |
SCHEDULER_STOPPED(): Rely on a global variable
A commit from 2012 (5d7380f8e34f0083, r228424) introduced 'td_stopsched', on the ground that a global variable would cause all CPUs to have a copy of i
SCHEDULER_STOPPED(): Rely on a global variable
A commit from 2012 (5d7380f8e34f0083, r228424) introduced 'td_stopsched', on the ground that a global variable would cause all CPUs to have a copy of it in their cache, and consequently of all other variables sharing the same cache line.
This is really a problem only if that cache line sees relatively frequent modifications. This was unlikely to be the case back then because nearby variables are almost never modified as well. In any case, today we have a new tool at our disposal to ensure that this variable goes into a read-mostly section containing frequently-accessed variables ('__read_frequently'). Most of the cache lines covering this section are likely to always be in every CPU cache. This makes the second reason stated in the commit message (ensuring the field is in the same cache line as some lock-related fields, since these are accessed in close proximity) moot, as well as the second order effect of requiring an additional line to be present in the cache (the one containing the new 'scheduler_stopped' boolean, see below).
From a pure logical point of view, whether the scheduler is stopped is a global state and is certainly not a per-thread quality.
Consequently, remove 'td_stopsched', which immediately frees a byte in 'struct thread'. Currently, the latter's size (and layout) stays unchanged, but some of the later re-orderings will probably benefit from this removal. Available bytes at the original position for 'td_stopsched' have been made explicit with the addition of the '_td_pad0' member.
Store the global state in the new 'scheduler_stopped' boolean, which is annotated with '__read_frequently'.
Replace uses of SCHEDULER_STOPPED_TD() with SCHEDULER_STOPPER() and remove the former as it is now unnecessary.
Reviewed by: markj, kib Approved by: markj (mentor) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D43572
show more ...
|
#
12d6a032 |
| 18-Jan-2024 |
Olivier Certner <olce@FreeBSD.org> |
Annotate 'rebooting' with __read_mostly
While here, put such annotation after the variable for 'dumping', since it concerns the variable and not the type.
Reviewed by: markj Approved by:
Annotate 'rebooting' with __read_mostly
While here, put such annotation after the variable for 'dumping', since it concerns the variable and not the type.
Reviewed by: markj Approved by: markj (mentor) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D43570
show more ...
|
#
eaed922e |
| 18-Jan-2024 |
Olivier Certner <olce@FreeBSD.org> |
panic()/KERNEL_PANICKED(): Move back to using 'panicstr' as a flag
Currently, no performance-critical path tests for a panic. Moreover, we today have KERNEL_PANICKED() which wraps the test into __p
panic()/KERNEL_PANICKED(): Move back to using 'panicstr' as a flag
Currently, no performance-critical path tests for a panic. Moreover, we today have KERNEL_PANICKED() which wraps the test into __predict_false(), already catering to those (potential) use cases. Also, in practice we don't support 64-bit architectures without caches, so reading an 'int' instead of a pointer doesn't (directly) save any memory access. Finally, 'panicked' is redundant with 'panicstr' (and wastes a tiny amount of memory).
Consequently: 1. Use again 'panicstr' as a flag indicating that the system is panicking. To this end: - Modify panic() so that it ensures this pointer is set to some non-NULL value even if the caller didn't pass any panic string. - Modify KERNEL_PANICKED() to test for 'panicstr'. - Remove 'panicked'. 2. Annotate 'panicstr' with '__read_mostly' (instead of using '__read_frequently' as for 'panicked'). This may have to be changed if, in the future, some performance-intensive path needs to test it. 3. Convert a few more direct tests of 'panicstr' to using KERNEL_PANICKED().
Reviewed by: kib, markj, emaste Approved by: markj (mentor) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D43569
show more ...
|
#
29363fb4 |
| 23-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl s
sys: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script.
Sponsored by: Netflix
show more ...
|
#
4e78a766 |
| 23-Nov-2023 |
Mitchell Horne <mhorne@FreeBSD.org> |
kern_reboot(): don't clear kdb_active
It is possible to reach this function from ddb via the "reset" command. When this happens, we don't actually exit kdb, meaning we never execute the latter steps
kern_reboot(): don't clear kdb_active
It is possible to reach this function from ddb via the "reset" command. When this happens, we don't actually exit kdb, meaning we never execute the latter steps of kdb_break() to restore the system state (e.g. re-enable scheduler).
Therefore, we should not clear the kdb_active flag in this function, as the debugger is still active. Put differently, kern_reboot() is not an authority on kdb state, and should not touch it. The original motivation for this assignment is not clear; I have checked thoroughly and I am convinced it is not required by any reset code.
This fixes an edge case where a panic can be triggered during reset from ddb: 1. Enter ddb via keyboard break sequence (KERNEL_PANICKED() == false && td->td_critnest > 0) 2. Execute the "reset" command 3. kern_reboot() sets kdb_active = false 4. A witness_checkorder() call via shutdown handler sees !kdb_active and panics
Reviewed by: imp, markj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42684
show more ...
|
#
960612a1 |
| 23-Nov-2023 |
Mitchell Horne <mhorne@FreeBSD.org> |
shutdown: tweak kproc/kthread shutdown check
This is to handle the case where the system has not panicked but the debugger is active, where we still can't wait for thread termination.
Reviewed by:
shutdown: tweak kproc/kthread shutdown check
This is to handle the case where the system has not panicked but the debugger is active, where we still can't wait for thread termination.
Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42683
show more ...
|
Revision tags: release/14.0.0 |
|
#
deacab75 |
| 04-Nov-2023 |
Mark Johnston <markj@FreeBSD.org> |
reboot: Avoid unlocking Giant if the scheduler is stopped
When the scheduler is stopped, mtx_unlock() turns into a no-op, so the loop
while (mtx_owned(&Giant)) mtx_unlock(&Giant);
runs fo
reboot: Avoid unlocking Giant if the scheduler is stopped
When the scheduler is stopped, mtx_unlock() turns into a no-op, so the loop
while (mtx_owned(&Giant)) mtx_unlock(&Giant);
runs forever if the calling thread has Giant locked.
Reviewed by: mhorne MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D42460
show more ...
|
#
685dc743 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
Revision tags: release/13.2.0, release/12.4.0 |
|
#
cab10561 |
| 25-Oct-2022 |
Mark Johnston <markj@FreeBSD.org> |
kdb: Modify securelevel policy
Currently, sysctls which enable KDB in some way are flagged with CTLFLAG_SECURE, meaning that you can't modify them if securelevel > 0. This is so that KDB cannot be u
kdb: Modify securelevel policy
Currently, sysctls which enable KDB in some way are flagged with CTLFLAG_SECURE, meaning that you can't modify them if securelevel > 0. This is so that KDB cannot be used to lower a running system's securelevel, see commit 3d7618d8bf0b7. However, the newer mac_ddb(4) restricts DDB operations which could be abused to lower securelevel while retaining some ability to gather useful debugging information.
To enable the use of KDB (specifically, DDB) on systems with a raised securelevel, change the KDB sysctl policy: rather than relying on CTLFLAG_SECURE, add a check of the current securelevel to kdb_trap(). If the securelevel is raised, only pass control to the backend if MAC specifically grants access; otherwise simply check to see if mac_ddb vetoes the request, as before.
Add a new secure sysctl, debug.kdb.enter_securelevel, to override this behaviour. That is, the sysctl lets one enter a KDB backend even with a raised securelevel, so long as it is set before the securelevel is raised.
Reviewed by: mhorne, stevek MFC after: 1 month Sponsored by: Juniper Networks Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D37122
show more ...
|
#
c3179891 |
| 20-Mar-2023 |
Mark Johnston <markj@FreeBSD.org> |
kerneldump: Inline dump_savectx() into its callers
The callers of dump_savectx() (i.e., doadump() and livedump_start()) subsequently call dumpsys()/minidumpsys(), which dump the calling thread's sta
kerneldump: Inline dump_savectx() into its callers
The callers of dump_savectx() (i.e., doadump() and livedump_start()) subsequently call dumpsys()/minidumpsys(), which dump the calling thread's stack when writing the dump. If dump_savectx() gets its own stack frame, that frame might be clobbered when its caller later calls dumpsys()/minidumpsys(), making it difficult for debuggers to unwind the stack.
Fix this by making dump_savectx() a macro, so that savectx() is always called directly by the function which subsequently calls dumpsys()/minidumpsys().
This fixes stack unwinding for the panicking thread from arm64 minidumps. The same happened to work on amd64, but kgdb reports the dump_savectx() calls as coming from dumpsys(), so in that case it appears to work by accident.
Fixes: c9114f9f86f9 ("Add new vnode dumper to support live minidumps") Reviewed by: mhorne, jhb MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D39151
show more ...
|
#
627ca221 |
| 23-Jan-2023 |
Mitchell Horne <mhorne@FreeBSD.org> |
kern_reboot: unconditionally call shutdown_reset()
Currently shutdown_reset() is registered as the final entry of the shutdown_final event handler. However, if a panic occurs early in boot before th
kern_reboot: unconditionally call shutdown_reset()
Currently shutdown_reset() is registered as the final entry of the shutdown_final event handler. However, if a panic occurs early in boot before the event is registered (SI_SUB_INTRINSIC), we may end up spinning in the subsequent infinite for loop and failing to reset altogether. Instead we can simply call this function unconditionally.
Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D37981
show more ...
|
#
84ec7df0 |
| 13-Jul-2022 |
Colin Percival <cperciva@FreeBSD.org> |
Add kern.reboot_wait_time sysctl
Historic FreeBSD behaviour (dating back to 1994-04-02) when rebooting is to print "Rebooting..." and then /* wait 1 sec for printf's to complete and be read */
Pri
Add kern.reboot_wait_time sysctl
Historic FreeBSD behaviour (dating back to 1994-04-02) when rebooting is to print "Rebooting..." and then /* wait 1 sec for printf's to complete and be read */
Prior to April 1994, there was a 100 ms delay (added 1993-11-12).
Since (a) most users will already be aware that the system is rebooting and do not need to take time to read an additional message to that effect, and (b) most FreeBSD systems don't have anyone actively looking at the console anyway, this delay no longer serves much purpose.
This commit adds a kern.reboot_wait_time sysctl which defaults to 0; historic behaviour can be regained by setting it to 1.
Reviewed by: imp Relnotes: FreeBSD now reboots faster; to restore the traditional wait after printing "Rebooting..." to the console, set kern.reboot_wait_time=1 (or more). Sponsored by: https://www.patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D35796
show more ...
|
#
c84c5e00 |
| 18-Jul-2022 |
Mitchell Horne <mhorne@FreeBSD.org> |
ddb: annotate some commands with DB_CMD_MEMSAFE
This is not completely exhaustive, but covers a large majority of commands in the tree.
Reviewed by: markj Sponsored by: Juniper Networks, Inc. Spons
ddb: annotate some commands with DB_CMD_MEMSAFE
This is not completely exhaustive, but covers a large majority of commands in the tree.
Reviewed by: markj Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D35583
show more ...
|
#
35eb9b10 |
| 02-Jun-2022 |
Mitchell Horne <mhorne@FreeBSD.org> |
Use KERNEL_PANICKED() in more places
This is slightly more optimized than checking panicstr directly. For most of these instances performance doesn't matter, but let's make KERNEL_PANICKED() the com
Use KERNEL_PANICKED() in more places
This is slightly more optimized than checking panicstr directly. For most of these instances performance doesn't matter, but let's make KERNEL_PANICKED() the common idiom.
Reviewed by: mjg MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D35373
show more ...
|
#
db71383b |
| 13-May-2022 |
Mitchell Horne <mhorne@FreeBSD.org> |
kerneldump: remove physical from dump routines
It is unused, especially now that the underlying d_dumper methods do not accept the argument.
Reviewed by: markj MFC after: 2 weeks Differential Revis
kerneldump: remove physical from dump routines
It is unused, especially now that the underlying d_dumper methods do not accept the argument.
Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D35174
show more ...
|
#
489ba222 |
| 13-May-2022 |
Mitchell Horne <mhorne@FreeBSD.org> |
kerneldump: remove physical argument from d_dumper
The physical address argument is essentially ignored by every dumper method. In addition, the dump routines don't actually pass a real address; eve
kerneldump: remove physical argument from d_dumper
The physical address argument is essentially ignored by every dumper method. In addition, the dump routines don't actually pass a real address; every call to dump_append() passes a value of zero for physical.
Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D35173
show more ...
|
Revision tags: release/13.1.0, release/12.3.0, release/13.0.0 |
|
#
c9114f9f |
| 23-Mar-2021 |
Mitchell Horne <mhorne@FreeBSD.org> |
Add new vnode dumper to support live minidumps
This dumper can instantiate and write the dump's contents to a file-backed vnode.
Unlike existing disk or network dumpers, the vnode dumper should not
Add new vnode dumper to support live minidumps
This dumper can instantiate and write the dump's contents to a file-backed vnode.
Unlike existing disk or network dumpers, the vnode dumper should not be invoked during a system panic, and therefore is not added to the global dumper_configs list. Instead, the vnode dumper is constructed ad-hoc when a live dump is requested using the new ioctl on /dev/mem. This is similar in spirit to a kgdb session against the live system via /dev/mem.
As described briefly in the mem(4) man page, live dumps are not guaranteed to result in a usuable output file, but offer some debugging value where forcefully panicing a system to dump its memory is not desirable/feasible.
A future change to savecore(8) will add an option to save a live dump.
Reviewed by: markj, Pau Amma <pauamma@gundo.com> (manpages) Discussed with: kib MFC after: 3 weeks Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D33813
show more ...
|
#
59c27ea1 |
| 09-Aug-2021 |
Mitchell Horne <mhorne@FreeBSD.org> |
Split out dumper allocation from list insertion
Add a new function, dumper_create(), to allocate a dumper. dumper_insert() will call this function and retains the existing behaviour.
This is desira
Split out dumper allocation from list insertion
Add a new function, dumper_create(), to allocate a dumper. dumper_insert() will call this function and retains the existing behaviour.
This is desirable for performing live dumps of the system. Here, there is a need to allocate and configure a dumper structure that is invoked outside of the typical debugger context. Therefore, it should be excluded from the list of panic-time dumpers.
free_single_dumper() is made public and renamed to dumper_destroy().
Reviewed by: kib, markj MFC after: 1 week Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D34068
show more ...
|
#
669d5ea4 |
| 02-Apr-2022 |
Gordon Bergling <gbe@FreeBSD.org> |
kern: Fix a typo in a source code comment
- s/paniced/panicked/
MFC after: 3 days
|
#
5a8fceb3 |
| 22-Feb-2022 |
Mitchell Horne <mhorne@FreeBSD.org> |
boottrace: trace annotations for startup and shutdown
Add trace events for execution of SYSINITs (both static and dynamically loaded), and to the various steps in the shutdown/panic/reboot paths.
S
boottrace: trace annotations for startup and shutdown
Add trace events for execution of SYSINITs (both static and dynamically loaded), and to the various steps in the shutdown/panic/reboot paths.
Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. X-NetApp-PR: #23 Differential Revision: https://reviews.freebsd.org/D30187
show more ...
|
#
800e7495 |
| 28-Sep-2021 |
Mitchell Horne <mhorne@FreeBSD.org> |
boot(9): update to match reality
This function was renamed to kern_reboot() in 2010, but the man page has failed to keep in sync. Bring it up to date on the rename, add the shutdown hooks to the syn
boot(9): update to match reality
This function was renamed to kern_reboot() in 2010, but the man page has failed to keep in sync. Bring it up to date on the rename, add the shutdown hooks to the synopsis, and document the (obvious) fact that kern_reboot() does not return.
Fix an outdated reference to the old name in kern_reboot(), and leave a reference to the man page so future readers might find it before any large changes.
Reviewed by: imp, markj MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32085
show more ...
|
#
13a58148 |
| 06-Aug-2021 |
Eric van Gyzen <vangyzen@FreeBSD.org> |
netdump: send key before dump, in case dump fails
Previously, if an encrypted netdump failed, such as due to a timeout or network failure, the key was not saved, so a partial dump was completely use
netdump: send key before dump, in case dump fails
Previously, if an encrypted netdump failed, such as due to a timeout or network failure, the key was not saved, so a partial dump was completely useless.
Send the key first, so the partial dump can be decrypted, because even a partial dump can be useful.
Reviewed by: bdrewery, markj MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D31453
show more ...
|