#
e24a6552 |
| 29-Jul-2024 |
Mark Johnston <markj@FreeBSD.org> |
thread: Remove kernel stack swapping support, part 4
- Remove the IS_SWAPPED thread inhibitor state. - Remove all uses of TD_IS_SWAPPED() in the kernel. - Remove the TDF_CANSWAP flag. - Remove the P
thread: Remove kernel stack swapping support, part 4
- Remove the IS_SWAPPED thread inhibitor state. - Remove all uses of TD_IS_SWAPPED() in the kernel. - Remove the TDF_CANSWAP flag. - Remove the P_SWAPPINGOUT and P_SWAPPINGIN flags.
Tested by: pho Reviewed by: alc, imp, kib Differential Revision: https://reviews.freebsd.org/D46115
show more ...
|
Revision tags: release/14.1.0, release/13.3.0 |
|
#
aeff15b3 |
| 09-Feb-2024 |
Olivier Certner <olce@FreeBSD.org> |
sched: Simplify sched_lend_user_prio_cond()
If 'td_lend_user_pri' has the expected value, there is no need to check the fields that sched_lend_user_prio() modifies, they either are already good or s
sched: Simplify sched_lend_user_prio_cond()
If 'td_lend_user_pri' has the expected value, there is no need to check the fields that sched_lend_user_prio() modifies, they either are already good or soon will be ('td->td_lend_user_pri' has just been changed by a concurrent update).
Reviewed by: kib Approved by: emaste (mentor) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D44050
show more ...
|
#
6a3c02bc |
| 16-Jan-2024 |
Olivier Certner <olce@FreeBSD.org> |
sched: sched_switch(): Factorize sleepqueue flags
Avoid duplicating common flags for the preempted and non-preempted cases, making it clear that they are the same without resorting to formatting.
N
sched: sched_switch(): Factorize sleepqueue flags
Avoid duplicating common flags for the preempted and non-preempted cases, making it clear that they are the same without resorting to formatting.
No functional change.
Approved by: markj (mentor) MFC after: 3 days Sponsored by: The FreeBSD Foundation
show more ...
|
Revision tags: release/14.0.0 |
|
#
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 |
|
#
1029dab6 |
| 09-Feb-2023 |
Mitchell Horne <mhorne@FreeBSD.org> |
mi_switch(): clean up switch types and their usage
Overall, this is a non-functional change, except for kernels built with SCHED_STATS. However, the switch types are useful for communicating the int
mi_switch(): clean up switch types and their usage
Overall, this is a non-functional change, except for kernels built with SCHED_STATS. However, the switch types are useful for communicating the intent of the caller.
1. Ensure that every caller provides a type. In most cases, we upgrade the basic yield to sched_relinquish() aka SWT_RELINQUISH. 2. The case of sched_bind() is distinct, so add a new switch type SWT_BIND. 3. Remove the two unused types, SWT_PREEMPT and SWT_SLEEPQTIMO. 4. Remove SWT_NONE altogether and assert that callers always provide a type flag. 5. Reference the mi_switch(9) man page in the comments, as these flags will be documented there.
Reviewed by: kib, markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D38184
show more ...
|
#
bff02948 |
| 09-Feb-2023 |
Mitchell Horne <mhorne@FreeBSD.org> |
sched_4bsd: use the same switch flags as ULE
ULE uses the more specific SWT_REMOTEPREEMPT and SWT_REMOTEWAKEIDLE switch types, let's do that here as well. SWT_PREEMPT is somewhat redundant when we a
sched_4bsd: use the same switch flags as ULE
ULE uses the more specific SWT_REMOTEPREEMPT and SWT_REMOTEWAKEIDLE switch types, let's do that here as well. SWT_PREEMPT is somewhat redundant when we also have the SW_PREEMPT flag.
This only has an effect for kernels built with SCHED_STATS.
Reviewed by: kib, markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D38183
show more ...
|
Revision tags: release/12.4.0 |
|
#
c2d27b0e |
| 24-Sep-2022 |
Mark Johnston <markj@FreeBSD.org> |
sched_4bsd: Fix a racy thread state modification
When a thread switching off-CPU is migrating to a remote CPU, sched_switch() may trigger a rescheduling of the thread currently running on that CPU.
sched_4bsd: Fix a racy thread state modification
When a thread switching off-CPU is migrating to a remote CPU, sched_switch() may trigger a rescheduling of the thread currently running on that CPU. When doing so, it must ensure that that thread is locked before modifying thread state. If the thread's lock is not the scheduler lock, then the thread is in the process of switching off-CPU and no extra effort is needed, and the initiator does not hold the thread's lock and thus should not modify any thread state.
Reported and tested by: Steve Kargl MFC after: 1 week
show more ...
|
#
c6d31b83 |
| 18-Jul-2022 |
Konstantin Belousov <kib@FreeBSD.org> |
AST: rework
Make most AST handlers dynamically registered. This allows to have subsystem-specific handler source located in the subsystem files, instead of making subr_trap.c aware of it. For inst
AST: rework
Make most AST handlers dynamically registered. This allows to have subsystem-specific handler source located in the subsystem files, instead of making subr_trap.c aware of it. For instance, signal delivery code on return to userspace is now moved to kern_sig.c.
Also, it allows to have some handlers designated as the cleanup (kclear) type, which are called both at AST and on thread/process exit. For instance, ast(), exit1(), and NFS server no longer need to be aware about UFS softdep processing.
The dynamic registration also allows third-party modules to register AST handlers if needed. There is one caveat with loadable modules: the code does not make any effort to ensure that the module is not unloaded before all threads processed through AST handler in it. In fact, this is already present behavior for hwpmc.ko and ufs.ko. I do not think it is worth the efforts and the runtime overhead to try to fix it.
Reviewed by: markj Tested by: emaste (arm64), pho Discussed with: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D35888
show more ...
|
#
40efe743 |
| 14-Jul-2022 |
John Baldwin <jhb@FreeBSD.org> |
4bsd: Simplistic time-sharing for interrupt threads.
If an interrupt thread runs for a full quantum without yielding the CPU, demote its priority and schedule a preemption to give other ithreads a t
4bsd: Simplistic time-sharing for interrupt threads.
If an interrupt thread runs for a full quantum without yielding the CPU, demote its priority and schedule a preemption to give other ithreads a turn.
Reviewed by: kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D35645
show more ...
|
#
fea89a28 |
| 14-Jul-2022 |
John Baldwin <jhb@FreeBSD.org> |
Add sched_ithread_prio to set the base priority of an interrupt thread.
Use it instead of sched_prio when setting the priority of an interrupt thread.
Reviewed by: kib, markj Sponsored by: Netflix
Add sched_ithread_prio to set the base priority of an interrupt thread.
Use it instead of sched_prio when setting the priority of an interrupt thread.
Reviewed by: kib, markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D35642
show more ...
|
Revision tags: release/13.1.0 |
|
#
8758ac75 |
| 14-Apr-2022 |
John Baldwin <jhb@FreeBSD.org> |
sched_4bsd: ts is only used in sched_bind for SMP.
|
#
72ff256c |
| 12-Apr-2022 |
John Baldwin <jhb@FreeBSD.org> |
sched_4bsd: Remove unused variables.
|
#
ec3af9d0 |
| 01-Jan-2022 |
Stefan Eßer <se@FreeBSD.org> |
sys/kern/sched_4bsd.c: fix typo introduced in previous commit
|
#
a19bd8e3 |
| 01-Jan-2022 |
Stefan Eßer <se@FreeBSD.org> |
Restore variable aliasing in the context of cpu set operations
A simplification of set operations removed side-effects of the previous code, which are restored by this commit.
|
#
e2650af1 |
| 30-Dec-2021 |
Stefan Eßer <se@FreeBSD.org> |
Make CPU_SET macros compliant with other implementations
The introduction of <sched.h> improved compatibility with some 3rd party software, but caused the configure scripts of some ports to assume t
Make CPU_SET macros compliant with other implementations
The introduction of <sched.h> improved compatibility with some 3rd party software, but caused the configure scripts of some ports to assume that they were run in a GLIBC compatible environment.
Parts of sched.h were made conditional on -D_WITH_CPU_SET_T being added to ports, but there still were compatibility issues due to invalid assumptions made in autoconfigure scripts.
The differences between the FreeBSD version of macros like CPU_AND, CPU_OR, etc. and the GLIBC versions was in the number of arguments: FreeBSD used a 2-address scheme (one source argument is also used as the destination of the operation), while GLIBC uses a 3-adderess scheme (2 source operands and a separately passed destination).
The GLIBC scheme provides a super-set of the functionality of the FreeBSD macros, since it does not prevent passing the same variable as source and destination arguments. In code that wanted to preserve both source arguments, the FreeBSD macros required a temporary copy of one of the source arguments.
This patch set allows to unconditionally provide functions and macros expected by 3rd party software written for GLIBC based systems, but breaks builds of externally maintained sources that use any of the following macros: CPU_AND, CPU_ANDNOT, CPU_OR, CPU_XOR.
One contributed driver (contrib/ofed/libmlx5) has been patched to support both the old and the new CPU_OR signatures. If this commit is merged to -STABLE, the version test will have to be extended to cover more ranges.
Ports that have added -D_WITH_CPU_SET_T to build on -CURRENT do no longer require that option.
The FreeBSD version has been bumped to 1400046 to reflect this incompatible change.
Reviewed by: kib MFC after: 2 weeks Relnotes: yes Differential Revision: https://reviews.freebsd.org/D33451
show more ...
|
Revision tags: release/12.3.0 |
|
#
6a8ea6d1 |
| 04-Nov-2021 |
Kyle Evans <kevans@FreeBSD.org> |
sched: split sched_ap_entry() out of sched_throw()
sched_throw() can no longer take a NULL thread, APs enter through sched_ap_entry() instead. This completely removes branching in the common case a
sched: split sched_ap_entry() out of sched_throw()
sched_throw() can no longer take a NULL thread, APs enter through sched_ap_entry() instead. This completely removes branching in the common case and cleans up both paths. No functional change intended.
Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D32829
show more ...
|
#
589aed00 |
| 02-Nov-2021 |
Kyle Evans <kevans@FreeBSD.org> |
sched: separate out schedinit_ap()
schedinit_ap() sets up an AP for a later call to sched_throw(NULL).
Currently, ULE sets up some pcpu bits and fixes the idlethread lock with a call to sched_throw
sched: separate out schedinit_ap()
schedinit_ap() sets up an AP for a later call to sched_throw(NULL).
Currently, ULE sets up some pcpu bits and fixes the idlethread lock with a call to sched_throw(NULL); this results in a window where curthread is setup in platforms' init_secondary(), but it has the wrong td_lock. Typical platform AP startup procedure looks something like:
- Setup curthread - ... other stuff, including cpu_initclocks_ap() - Signal smp_started - sched_throw(NULL) to enter the scheduler
cpu_initclocks_ap() may have callouts to process (e.g., nvme) and attempt to sched_add() for this AP, but this attempt fails because of the noted violated assumption leading to locking heartburn in sched_setpreempt().
Interrupts are still disabled until cpu_throw() so we're not really at risk of being preempted -- just let the scheduler in on it a little earlier as part of setting up curthread.
Reviewed by: alfredo, kib, markj Triage help from: andrew, markj Smoke-tested by: alfredo (ppc), kevans (arm64, x86), mhorne (arm) Differential Revision: https://reviews.freebsd.org/D32797
show more ...
|
#
af29f399 |
| 29-Jul-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
umtx: Split umtx.h on two counterparts.
To prevent umtx.h polluting by future changes split it on two headers: umtx.h - ABI header for userspace; umtxvar.h - the kernel staff.
While here fix umtx_k
umtx: Split umtx.h on two counterparts.
To prevent umtx.h polluting by future changes split it on two headers: umtx.h - ABI header for userspace; umtxvar.h - the kernel staff.
While here fix umtx_key_match style.
Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D31248 MFC after: 2 weeks
show more ...
|
#
6a467cc5 |
| 23-May-2021 |
Mateusz Guzik <mjg@FreeBSD.org> |
lockprof: pass lock type as an argument instead of reading the spin flag
|
Revision tags: release/13.0.0 |
|
#
fa2528ac |
| 18-Feb-2021 |
Alex Richardson <arichardson@FreeBSD.org> |
Use atomic loads/stores when updating td->td_state
KCSAN complains about racy accesses in the locking code. Those races are fine since they are inside a TD_SET_RUNNING() loop that expects the value
Use atomic loads/stores when updating td->td_state
KCSAN complains about racy accesses in the locking code. Those races are fine since they are inside a TD_SET_RUNNING() loop that expects the value to be changed by another CPU.
Use relaxed atomic stores/loads to indicate that this variable can be written/read by multiple CPUs at the same time. This will also prevent the compiler from doing unexpected re-ordering.
Reported by: GENERIC-KCSAN Test Plan: KCSAN no longer complains, kernel still runs fine. Reviewed By: markj, mjg (earlier version) Differential Revision: https://reviews.freebsd.org/D28569
show more ...
|
#
b77594bb |
| 15-Nov-2020 |
Mateusz Guzik <mjg@FreeBSD.org> |
sched: fix an incorrect comparison in sched_lend_user_prio_cond
Compare with sched_lend_user_prio.
|
Revision tags: release/12.2.0 |
|
#
6fed89b1 |
| 02-Sep-2020 |
Mateusz Guzik <mjg@FreeBSD.org> |
kern: clean up empty lines in .c and .h files
|
Revision tags: release/11.4.0 |
|
#
e43d33d2 |
| 05-Mar-2020 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r358466 through r358677.
|
#
b05ca429 |
| 02-Mar-2020 |
Pawel Biernacki <kaktus@FreeBSD.org> |
sys/: Document few more sysctls.
Submitted by: Antranig Vartanian <antranigv@freebsd.am> Reviewed by: kaktus Commented by: jhb Approved by: kib (mentor) Sponsored by: illuria security Differential R
sys/: Document few more sysctls.
Submitted by: Antranig Vartanian <antranigv@freebsd.am> Reviewed by: kaktus Commented by: jhb Approved by: kib (mentor) Sponsored by: illuria security Differential Revision: https://reviews.freebsd.org/D23759
show more ...
|
#
75dfc66c |
| 27-Feb-2020 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r358269 through r358399.
|