The branch main has been updated by se:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=a19bd8e30eba1673782376a93e9787ed9b490e4e

commit a19bd8e30eba1673782376a93e9787ed9b490e4e
Author:     Stefan Eßer <[email protected]>
AuthorDate: 2022-01-01 10:41:54 +0000
Commit:     Stefan Eßer <[email protected]>
CommitDate: 2022-01-01 10:58:40 +0000

    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.
---
 sys/kern/kern_rmlock.c | 3 ++-
 sys/kern/sched_4bsd.c  | 6 ++++--
 sys/kern/subr_kdb.c    | 3 ++-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c
index 5e64f79e3836..08a01fca9827 100644
--- a/sys/kern/kern_rmlock.c
+++ b/sys/kern/kern_rmlock.c
@@ -548,7 +548,8 @@ _rm_wlock(struct rmlock *rm)
 
        if (CPU_CMP(&rm->rm_writecpus, &all_cpus)) {
                /* Get all read tokens back */
-               CPU_ANDNOT(&readcpus, &all_cpus, &rm->rm_writecpus);
+               readcpus = all_cpus;
+               CPU_ANDNOT(&readcpus, &readcpus, &rm->rm_writecpus);
                rm->rm_writecpus = all_cpus;
 
                /*
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c
index ae8c77f3aa4a..5233cba95c54 100644
--- a/sys/kern/sched_4bsd.c
+++ b/sys/kern/sched_4bsd.c
@@ -1179,7 +1179,8 @@ forward_wakeup(int cpunum)
        }
 
        if (forward_wakeup_use_mask) {
-               CPU_ANDNOT(&map, &idle_cpus_mask, &dontuse);
+               map = idle_cpu_mask;
+               CPU_ANDNOT(&map, &map, &dontuse);
 
                /* If they are both on, compare and use loop if different. */
                if (forward_wakeup_use_loop) {
@@ -1365,7 +1366,8 @@ sched_add(struct thread *td, int flags)
                kick_other_cpu(td->td_priority, cpu);
        } else {
                if (!single_cpu) {
-                       CPU_ANDNOT(&tidlemsk, &idle_cpus_mask, &hlt_cpus_mask);
+                       tidlemsk = idle_cpus_mask;
+                       CPU_ANDNOT(&tidlemsk, &tidlemsk, &hlt_cpus_mask);
                        CPU_CLR(cpuid, &tidlemsk);
 
                        if (!CPU_ISSET(cpuid, &idle_cpus_mask) &&
diff --git a/sys/kern/subr_kdb.c b/sys/kern/subr_kdb.c
index 2218c20586f2..14a0205fc098 100644
--- a/sys/kern/subr_kdb.c
+++ b/sys/kern/subr_kdb.c
@@ -707,7 +707,8 @@ kdb_trap(int type, int code, struct trapframe *tf)
 
        if (!SCHEDULER_STOPPED()) {
 #ifdef SMP
-               CPU_ANDNOT(&other_cpus, &all_cpus, &stopped_cpus);
+               other_cpus = all_cpus;
+               CPU_ANDNOT(&other_cpus, &other_cpus, &stopped_cpus);
                CPU_CLR(PCPU_GET(cpuid), &other_cpus);
                stop_cpus_hard(other_cpus);
 #endif

Reply via email to