| #
83d98828
|
| 18-Jan-2026 |
Konstantin Belousov <kib@FreeBSD.org> |
sys: do not allow entering vm_fault() on boot until VM is initialized
On amd64, a hack sets td_critnest to 1 in hammer_time(), and then clear it before returning from hammer_time(), which is too ear
sys: do not allow entering vm_fault() on boot until VM is initialized
On amd64, a hack sets td_critnest to 1 in hammer_time(), and then clear it before returning from hammer_time(), which is too early. Instead, set TDP_NOFAULTING for thread0, and clear the flag after vm_init() finished.
Noted by: adrian Reviewed by: adrian (previous version), markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54768
show more ...
|
| #
acd02443
|
| 08-Dec-2025 |
John Baldwin <jhb@FreeBSD.org> |
proc0_post: Clear relevant thread stats directly
rufetch() has several other effects besides clearing these per-thread stats most of which are explicitly discarded by the subsequent calls to ruxrese
proc0_post: Clear relevant thread stats directly
rufetch() has several other effects besides clearing these per-thread stats most of which are explicitly discarded by the subsequent calls to ruxreset(). Just clear the relevant stats directly instead.
Reviewed by: olce, kib, markj Differential Revision: https://reviews.freebsd.org/D54050
show more ...
|
| #
dafe50eb
|
| 08-Dec-2025 |
John Baldwin <jhb@FreeBSD.org> |
thread0: Clear td_rux stats in proc0_post
proc0_post aims to reset the CPU usage accounting for all threads and processes in the system to zero once the time of day is verified. However, not all of
thread0: Clear td_rux stats in proc0_post
proc0_post aims to reset the CPU usage accounting for all threads and processes in the system to zero once the time of day is verified. However, not all of the per-thread stats were not being cleared, resulting in over-reported time for thread0 post-boot.
Reviewed by: olce, kib, markj Fixes: bed4c5241663 ("Implement RUSAGE_THREAD. Add td_rux...") Differential Revision: https://reviews.freebsd.org/D54040
show more ...
|
| #
3f8ed605
|
| 08-Dec-2025 |
John Baldwin <jhb@FreeBSD.org> |
ruxreset: Add an inline function to reset all the stats in rusage_ext
Use it in proc0_post to reset per-process CPU usage.
Suggested by: olce Reviewed by: olce, kib Differential Revision: https://r
ruxreset: Add an inline function to reset all the stats in rusage_ext
Use it in proc0_post to reset per-process CPU usage.
Suggested by: olce Reviewed by: olce, kib Differential Revision: https://reviews.freebsd.org/D54049
show more ...
|
| #
61ffc1bf
|
| 04-Dec-2025 |
John Baldwin <jhb@FreeBSD.org> |
MAC: Rename mac_cred_create_swapper to mac_cred_create_kproc0
Reported by: markj Reviewed by: olce Differential Revision: https://reviews.freebsd.org/D54052
|
| #
431b3b22
|
| 04-Dec-2025 |
John Baldwin <jhb@FreeBSD.org> |
thread0: Stop calling thread0 "swapper"
Just leave it as "kernel". While here, replace "parked" with "-" (the typical wait channel for idle threads).
Reviewed by: olce, kib, markj Differential Rev
thread0: Stop calling thread0 "swapper"
Just leave it as "kernel". While here, replace "parked" with "-" (the typical wait channel for idle threads).
Reviewed by: olce, kib, markj Differential Revision: https://reviews.freebsd.org/D54039
show more ...
|
| #
7b28d549
|
| 24-Oct-2025 |
Ed Maste <emaste@FreeBSD.org> |
sys: Bump 32-bit kernel removal to 16.0
We are shipping at least one 32-bit kernel in FreeBSD 15.0 (i.e., armv7).
Sponsored by: The FreeBSD Foundation
|
| #
7e389932
|
| 03-Sep-2025 |
Zhenlei Huang <zlei@FreeBSD.org> |
init_main: Remove the placeholder SYSINIT
This was initially introduced to ensure there is at least one entry so that the sysinit_set symbol is not undefined. Well now that the kernel has plenty of
init_main: Remove the placeholder SYSINIT
This was initially introduced to ensure there is at least one entry so that the sysinit_set symbol is not undefined. Well now that the kernel has plenty of SYSINITs and it is unlikely we will have a kernel without any SYSINITs in future, then this placeholder is not relevant anymore.
MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D47916
show more ...
|
| #
11f1dd19
|
| 03-Sep-2025 |
Zhenlei Huang <zlei@FreeBSD.org> |
init_main: Fix logging the subsystem of pre-loaded kernel modules
The pre-load, aka linker_preload() runs at the order of SI_SUB_KLD, but a pre-loaded module may have SYSINITs that have startup orde
init_main: Fix logging the subsystem of pre-loaded kernel modules
The pre-load, aka linker_preload() runs at the order of SI_SUB_KLD, but a pre-loaded module may have SYSINITs that have startup order prior to SI_SUB_KLD, e.g. TUNABLE_INT() / TUNABLE_LONG(), hence it is possible that we run into abnormal orders.
Without this change, the subsystem of the pre-loaded kernel modules will be melted into previous one. That is mostly harmless but confusing.
MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47904
show more ...
|
| #
5997b193
|
| 06-Dec-2024 |
Zhenlei Huang <zlei@FreeBSD.org> |
init_main: Fix logging of the SYSINIT process
The current subsystem, aka `sip->subsystem`, should be logged, rather than the last one.
Reviewed by: mhorne Fixes: 5a8fceb3bd9f boottrace: trace annot
init_main: Fix logging of the SYSINIT process
The current subsystem, aka `sip->subsystem`, should be logged, rather than the last one.
Reviewed by: mhorne Fixes: 5a8fceb3bd9f boottrace: trace annotations for startup and shutdown MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47903
show more ...
|
| #
a7cfcb26
|
| 06-Dec-2024 |
Zhenlei Huang <zlei@FreeBSD.org> |
init_main: Use TUNABLE_INT_FETCH to initialize verbose_sysinit
It is too late to initialize verbose_sysinit via TUNABLE_INT, as TUNABLE_INT runs at the order of SI_SUB_TUNABLES, thus any subsystems
init_main: Use TUNABLE_INT_FETCH to initialize verbose_sysinit
It is too late to initialize verbose_sysinit via TUNABLE_INT, as TUNABLE_INT runs at the order of SI_SUB_TUNABLES, thus any subsystems those have order prior or equal to SI_SUB_TUNABLES are not logged.
Reviewed by: kevans Fixes: c7962400c9a7 Add debug.verbose_sysinit tunable for VERBOSE_SYSINIT MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47907
show more ...
|
| #
356be134
|
| 30-Aug-2024 |
Zhenlei Huang <zlei@FreeBSD.org> |
kernel: Make some compile time constant variables const
Those variables are not going to be changed at runtime. Make them const to avoid potential overwriting. This will also help spotting accidenta
kernel: Make some compile time constant variables const
Those variables are not going to be changed at runtime. Make them const to avoid potential overwriting. This will also help spotting accidental global variables shadowing, since the variable's name such as `version` is short and commonly used.
This change was inspired by reviewing khng's work D44760.
No functional change intended.
MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D45227
show more ...
|
| #
7412517f
|
| 21-Aug-2024 |
Zhenlei Huang <zlei@FreeBSD.org> |
init_main: Sprinkle const qualifiers where appropriate
No functional change intended.
MFC after: 1 week
|
| #
0dd77895
|
| 29-Jul-2024 |
Mark Johnston <markj@FreeBSD.org> |
vm: Remove kernel stack swapping support, part 2
After mi_startup() finishes, thread0 becomes the "swapper", whose responsibility is to swap threads back in on demand. Now that threads can't be swa
vm: Remove kernel stack swapping support, part 2
After mi_startup() finishes, thread0 becomes the "swapper", whose responsibility is to swap threads back in on demand. Now that threads can't be swapped out, there is no use for this thread. Just sleep forever once sysinits are finished; thread_exit() doesn't work because thread0 is allocated statically. The thread could be repurposed if that would be useful.
Tested by: pho Reviewed by: alc, imp, kib Differential Revision: https://reviews.freebsd.org/D46113
show more ...
|
| #
e0c92dd2
|
| 25-Mar-2024 |
Konstantin Belousov <kib@FreeBSD.org> |
amd64: initialize td_frame stack area for init(8) main thread
Unitialized td_frame mostly does not matter since all registers are overwritten on exec to activate init(8). Except PSL_T bit from the
amd64: initialize td_frame stack area for init(8) main thread
Unitialized td_frame mostly does not matter since all registers are overwritten on exec to activate init(8). Except PSL_T bit from the %rflags which might leak into fresh init as garbage, causing spurious SIGTRAPs delivered to init until first syscall is executed.
Reviewed by: emaste, jhb, jhibbits Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D44498
show more ...
|
| #
eccde5f4
|
| 21-Feb-2024 |
Warner Losh <imp@FreeBSD.org> |
sys/kern: Remove a few sys/cdefs.h around some elf things
These sys/cdefs.h are no longer needed. Remove them in advance of other work in this area.
Sponsored by: Netflix
|
| #
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 ...
|
| #
92541c12
|
| 25-Sep-2023 |
Olivier Certner <olce.freebsd@certner.fr> |
Open-code proc_set_cred_init()
This function is to be called only when initializing a new process (so, 'proc0' and at fork), and not in any other circumstances. Setting the process' 'p_ucred' field
Open-code proc_set_cred_init()
This function is to be called only when initializing a new process (so, 'proc0' and at fork), and not in any other circumstances. Setting the process' 'p_ucred' field to the result of crcowget() on the original credentials is the only thing it does, hiding the fact that the process' 'p_ucred' field is crushed by the call. Moreover, most of the code it executes is already encapsulated in crcowget().
To prevent misuse and improve code readability, just remove this function and replace it with a direct assignment to 'p_ucred'.
Reviewed by: markj (earlier version), kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42255
show more ...
|
| #
1926d5ce
|
| 05-Sep-2023 |
Colin Percival <cperciva@FreeBSD.org> |
init_main: Record completed SYSINITs
When removing them from sysinit_list, append them to sysinit_done_list; print this list from 'show sysinit' along with the list of future sysinits.
Reviewed by:
init_main: Record completed SYSINITs
When removing them from sysinit_list, append them to sysinit_done_list; print this list from 'show sysinit' along with the list of future sysinits.
Reviewed by: jhb, gallatin (previous version) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D41749
show more ...
|
| #
71679cf4
|
| 05-Sep-2023 |
Colin Percival <cperciva@FreeBSD.org> |
init_main: Switch from SLIST to STAILQ, fix order
Constructing an SLIST of SYSINITs by inserting them one by one at the head of the list resulted in them being sorted in anti-stable order: When two
init_main: Switch from SLIST to STAILQ, fix order
Constructing an SLIST of SYSINITs by inserting them one by one at the head of the list resulted in them being sorted in anti-stable order: When two SYSINITs tied for (subsystem, order), they were executed in the reverse order to the order in which they appeared in the linker set.
Note that while this changes struct sysinit, it doesn't affect ABI since SLIST_ENTRY and STAILQ_ENTRY are compatible (in both cases a single pointer to the next element).
Fixes: 9a7add6d01f3 "init_main: Switch from sysinit array to SLIST" Reported by: gallatin Reviewed by: jhb, gallatin, emaste Tested by: gallatin MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D41748
show more ...
|
| #
9a7add6d
|
| 18-Jul-2023 |
Colin Percival <cperciva@FreeBSD.org> |
init_main: Switch from sysinit array to SLIST
This has two effects: 1. We can mergesort the sysinits instead of bubblesorting them, which shaves about 2 ms off the boot time in Firecracker. 2. Addin
init_main: Switch from sysinit array to SLIST
This has two effects: 1. We can mergesort the sysinits instead of bubblesorting them, which shaves about 2 ms off the boot time in Firecracker. 2. Adding more sysinits (e.g. from a KLD) can be performed by sorting them and then merging the sorted lists, which is both faster than the previous "append and sort" approach and avoids needing malloc.
Reviewed by: jhb (previous version) Sponsored by: https://www.patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D41075
show more ...
|
| #
685dc743
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
| #
41582f28
|
| 16-Aug-2023 |
John Baldwin <jhb@FreeBSD.org> |
sys: Add a deprecation warning for 32-bit kernels.
Per recent discussions on arch@ and at the BSDCan developer summit, we are considering removing support for 32-bit platforms (in some form) for 15.
sys: Add a deprecation warning for 32-bit kernels.
Per recent discussions on arch@ and at the BSDCan developer summit, we are considering removing support for 32-bit platforms (in some form) for 15.0 (at the earliest). A final decision on what will ship in 15.0 will be made closer to the release of 15.0. However, we should communicate the potential deprecation in 14.0 to provide notice to users.
This commit adds a warning during boot on 32-bit kernels that they are deprecated and may be removed in 15.0. More details will be included in a followup commit to RELNOTES.
Reviewed by: brooks, imp, emaste Differential Revision: https://reviews.freebsd.org/D41163
show more ...
|
| #
3360b485
|
| 12-Jun-2023 |
Konstantin Belousov <kib@FreeBSD.org> |
killpg(2): close a race with fork(2), part1
If the process group member performs fork(), the child could escape signalling from killpg(). Prevent it by introducing an sx process group lock pg_killsx
killpg(2): close a race with fork(2), part1
If the process group member performs fork(), the child could escape signalling from killpg(). Prevent it by introducing an sx process group lock pg_killsx which is taken interruptibly shared around fork. If there is a pending signal, do the trip through userspace with ERESTART to handle signal ASTs. The lock is taken exclusively during killpg().
The lock is also locked exclusive when the process changes group membership, to avoid escaping a signal by this means, by ensuring that the process group is stable during fork.
Note that the new lock is before proctree lock, so in some situations we could only do trylocking to obtain it.
This relatively simple approach cannot work for REAP_KILL, because process potentially belongs to more than one reaper tree by having sub-reapers.
Reported by: dchagin Tested by: dchagin, pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D40493
show more ...
|
| #
d706d02e
|
| 29-May-2023 |
Dmitry Chagin <dchagin@FreeBSD.org> |
sysentvec: Retire sv_imgact_try as unneeded anymore
The sysentvec sv_imgact_try was used by kern_exec() to allow non-native ABI to fixup shell path according to ABI root directory. Since the non-nat
sysentvec: Retire sv_imgact_try as unneeded anymore
The sysentvec sv_imgact_try was used by kern_exec() to allow non-native ABI to fixup shell path according to ABI root directory. Since the non-native ABI can now specify its root directory directly to namei() via pwd_altroot() call this facility is not needed anymore.
Differential Revision: https://reviews.freebsd.org/D40092 MFC after: 2 month
show more ...
|