aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Eßer <se@FreeBSD.org>2022-01-01 10:41:54 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2022-01-14 16:17:31 +0000
commita94baf23cf612b06bfe97ab35627391c64e13c4e (patch)
treed51078e6e6fbc09a2517fd2a8d9153e07e52732f
parent2cb81011e734d7896a3caf9bd08f3e4abaa07436 (diff)
downloadsrc-a94baf23cf612b06bfe97ab35627391c64e13c4e.tar.gz
src-a94baf23cf612b06bfe97ab35627391c64e13c4e.zip
Restore variable aliasing in the context of cpu set operations
(cherry picked from commit a19bd8e30eba1673782376a93e9787ed9b490e4e)
-rw-r--r--sys/kern/kern_rmlock.c3
-rw-r--r--sys/kern/sched_4bsd.c6
-rw-r--r--sys/kern/subr_kdb.c3
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 7e6fe03c80e4..3d99d3aca0e2 100644
--- a/sys/kern/sched_4bsd.c
+++ b/sys/kern/sched_4bsd.c
@@ -1172,7 +1172,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) {
@@ -1358,7 +1359,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