TLB shootdown and panic-halt IPI infrastructure.
More...
TLB shootdown and panic-halt IPI infrastructure.
Implements two IPI paths:
- TLB shootdown (vector 51): vmm_unmap_page() calls ipi_tlb_shootdown() to ensure all CPUs flush the invalidated mapping before the caller continues.
- Panic halt (vector 52): kernel_panic() calls ipi_panic_halt() to halt all APs before the BSP prints the panic message and halts.
◆ ipi_barrier_ack()
Atomically decrement the barrier's ack_count.
- Parameters
-
| b | Barrier to acknowledge. Called by ISR handlers BEFORE lapic_eoi(). |
◆ ipi_barrier_wait()
Spin until barrier->ack_count reaches 0.
- Parameters
-
| b | Barrier to wait on. Called by the IPI initiator after broadcasting. |
◆ ipi_panic_halt()
| void ipi_panic_halt |
( |
void | | ) |
|
Broadcast halt IPI to all APs on kernel panic.
Sends PANIC_HALT_VECTOR (52) to every CPU except the calling BSP via lapic_send_ipi. Waits up to one LAPIC timer period (lapic_bsp_timer_icr/2 CCR ticks) for APs to halt, then returns to allow the BSP to print the panic message and execute cli;hlt. Called from handle_exception().
◆ ipi_tlb_shootdown()
Broadcast TLB-shootdown IPI and wait for all CPUs to flush.
- Parameters
-
| virt | Virtual address to invalidate on all CPUs. |
Sets g_tlb_barrier.virt = @virt and g_tlb_barrier.ack_count = smp_cpu_count - 1, then broadcasts TLB_SHOOTDOWN_VECTOR (51) to all CPUs except self via lapic_send_ipi. Spins in ipi_barrier_wait() until all handlers have called ipi_barrier_ack(). Caller (sys_munmap) must have already called invlpg locally.
Context: Called with interrupts disabled or spinlock protection on g_tlb_barrier.
◆ panic_halt_isr()
| void panic_halt_isr |
( |
void * | frame | ) |
|
ISR for PANIC_HALT_VECTOR (52) on APs.
- Parameters
-
| frame | Pointer to the interrupt frame (unused). |
Executes cli; hlt. Does NOT send EOI – the halted CPU never needs the LAPIC unblocked for subsequent interrupts.
◆ tlb_shootdown_isr()
| void tlb_shootdown_isr |
( |
void * | frame | ) |
|
ISR for TLB_SHOOTDOWN_VECTOR (51) on remote CPUs.
- Parameters
-
| frame | Pointer to the interrupt frame (unused by this handler). |
Executes invlpg(g_tlb_barrier.virt), then calls ipi_barrier_ack(&g_tlb_barrier) (decrement-before-EOI guarantees the initiator sees ack_count==0 only after the TLB flush is complete), then calls lapic_eoi_asm().
◆ g_tlb_barrier