kernel/x86: Always call arch_cpu_global_tlb_invalidate with interrupts disabled.

Fixes a race. Discovered by SED4906.

Change-Id: I2b267312e9f3ff32bafa2ac2784f5d4a9905e24e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10416
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Augustin Cavalier
2026-03-09 17:37:05 +00:00
committed by waddlesplash
parent 5d19bcda45
commit de74304510
2 changed files with 3 additions and 4 deletions
+1 -4
View File
@@ -1994,16 +1994,13 @@ void
arch_cpu_global_tlb_invalidate()
{
uint32 flags = x86_read_cr4();
if (flags & IA32_CR4_GLOBAL_PAGES) {
if ((flags & IA32_CR4_GLOBAL_PAGES) != 0) {
// disable and reenable the global pages to flush all TLBs regardless
// of the global page bit
x86_write_cr4(flags & ~IA32_CR4_GLOBAL_PAGES);
x86_write_cr4(flags | IA32_CR4_GLOBAL_PAGES);
} else {
cpu_status state = disable_interrupts();
arch_cpu_user_tlb_invalidate(0);
restore_interrupts(state);
}
}
@@ -104,7 +104,9 @@ X86VMTranslationMap::Flush()
fInvalidPagesCount);
if (fIsKernelMap) {
cpu_status state = disable_interrupts();
arch_cpu_global_tlb_invalidate();
restore_interrupts(state);
smp_send_broadcast_ici(SMP_MSG_GLOBAL_INVALIDATE_PAGES, 0, 0, 0,
NULL, SMP_MSG_FLAG_SYNC);
} else {