diff options
author | Ian Moffett <ian@osmora.org> | 2025-08-20 23:28:17 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-08-20 23:28:17 -0400 |
commit | 7ed5ce81ccd6f7a546ea504d998419452b18fc20 (patch) | |
tree | 14b680d41f842196b2a250f42236a2212de5bd5a /sys/arch/amd64/amd64 | |
parent | 8fe8b0798f40786c156e245ce89749acda401273 (diff) |
kernel/amd64: Do not hit self in cpu_halt_others()
Previously the logic for cpu_halt_others() would fall back to halting
the current processor. However this is not correct and we should instead
bail if there are no other processors to halt.
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/arch/amd64/amd64')
-rw-r--r-- | sys/arch/amd64/amd64/machdep.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 72de150..76c1a5f 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -481,14 +481,13 @@ void cpu_halt_others(void) { struct cpu_info *curcpu, *ci; - uint32_t ncpu; + uint32_t ncpu = cpu_count(); - if (rdmsr(IA32_GS_BASE) == 0) { - __ASMV("cli; hlt"); + if (rdmsr(IA32_GS_BASE) == 0 || ncpu <= 1) { + return; } curcpu = this_cpu(); - ncpu = cpu_count(); for (int i = 0; i < ncpu; ++i) { if ((ci = cpu_get(i)) == NULL) |