diff options
| author | Bojan Novković <bnovkov@FreeBSD.org> | 2026-05-13 15:49:01 +0000 |
|---|---|---|
| committer | Bojan Novković <bnovkov@FreeBSD.org> | 2026-07-10 15:52:52 +0000 |
| commit | 7489f0bf84e4c88ad6cfbf4c8cf91bd7bede56f6 (patch) | |
| tree | 5cf846a8302e1c1899f61355feb1307e163a8e1c | |
| parent | 10487e30c0a70cedb2ade55e88c0dbbfc8e59f24 (diff) | |
riscv/mp_machdep.c: Flush the TLB after releasing APs
Spurious page faults caused by cached invalid entries may occur when
starting APs and potentially panic the kernel if we're running in
a non-sleepable context.
Fix this avoidable panic by flushing the TLB after the AP is released.
Differential Revision: https://reviews.freebsd.org/D57003
Reviewed by: markj
| -rw-r--r-- | sys/riscv/riscv/mp_machdep.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/riscv/riscv/mp_machdep.c b/sys/riscv/riscv/mp_machdep.c index 235bee15ca29..9c81d9ee1043 100644 --- a/sys/riscv/riscv/mp_machdep.c +++ b/sys/riscv/riscv/mp_machdep.c @@ -172,6 +172,11 @@ init_secondary(uint64_t hart) while (!atomic_load_int(&aps_ready)) __asm __volatile("wfi"); + /* + * Flush the TLB to avoid spurious kernel page faults + * on implementations that cache invalid entries. + */ + sfence_vma(); /* Initialize curthread */ KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread")); pcpup->pc_curthread = pcpup->pc_idlethread; |
