Skip to main content

Module tlb

Module tlb 

Source
Expand description

TLB (Translation Lookaside Buffer) shootdown for SMP.

When a page table entry is modified on one CPU, all other CPUs that might have cached that entry in their TLB must be notified to invalidate it.

This implementation uses a per-CPU mailbox system inspired by Asterinas:

  1. Each CPU has its own queue of pending TLB operations.
  2. The initiator pushes an operation into each target’s queue.
  3. The initiator sends a TLB shootdown IPI to all targets.
  4. The targets process their own queue and set an ACK flag.
  5. The initiator waits for all ACK flags to become true.

This avoids global lock contention and race conditions on global counters.

Functions§

init
Initialize TLB shootdown system.
shootdown_all
Flush all TLB entries on all CPUs.
shootdown_page
Invalidate a single page on all CPUs.
shootdown_range
Invalidate a range of pages on all CPUs.
tlb_shootdown_ipi_handler
IPI handler for TLB shootdown (called on receiving CPU).