pub struct TlbFlusher<'a, G: PinCurrentCpu> { /* private fields */ }Expand description
A TLB flusher that is aware of which CPUs are needed to be flushed.
The flusher needs to stick to the current CPU.
Implementations§
Source§impl<'a, G: PinCurrentCpu> TlbFlusher<'a, G>
impl<'a, G: PinCurrentCpu> TlbFlusher<'a, G>
Sourcepub fn new(target_cpus: &'a AtomicCpuSet, pin_current_guard: G) -> Self
pub fn new(target_cpus: &'a AtomicCpuSet, pin_current_guard: G) -> Self
Creates a new TLB flusher with the specified CPUs to be flushed.
The target CPUs should be a reference to an AtomicCpuSet that will
be loaded upon Self::dispatch_tlb_flush.
The flusher needs to stick to the current CPU. So please provide a
guard that implements PinCurrentCpu.
Sourcepub fn issue_tlb_flush<M: AnyFrameMeta>(&mut self, op: TlbFlushOp)
pub fn issue_tlb_flush<M: AnyFrameMeta>(&mut self, op: TlbFlushOp)
Issues a pending TLB flush request.
This function does not guarantee to flush the TLB entries on either
this CPU or remote CPUs. The flush requests are only performed when
Self::dispatch_tlb_flush is called.
Sourcepub fn issue_tlb_flush_with<M: AnyFrameMeta>(
&mut self,
op: TlbFlushOp,
drop_after_flush: Frame<M>,
)
pub fn issue_tlb_flush_with<M: AnyFrameMeta>( &mut self, op: TlbFlushOp, drop_after_flush: Frame<M>, )
Issues a TLB flush request that must happen before dropping the page.
If we need to remove a mapped page from the page table, we can only recycle the page after all the relevant TLB entries in all CPUs are flushed. Otherwise if the page is recycled for other purposes, the user space program can still access the page through the TLB entries. This method is designed to be used in such cases.
Sourcepub fn dispatch_tlb_flush(&mut self)
pub fn dispatch_tlb_flush(&mut self)
Dispatches all the pending TLB flush requests.
All previous pending requests issued by Self::issue_tlb_flush or
Self::issue_tlb_flush_with starts to be processed after this
function. But it may not be synchronous. Upon the return of this
function, the TLB entries may not be coherent.
Sourcepub fn sync_tlb_flush(&mut self)
pub fn sync_tlb_flush(&mut self)
Waits for all the previous TLB flush requests to be completed.
After this function, all TLB entries corresponding to previous dispatched TLB flush requests are guaranteed to be coherent.
The TLB flush requests are issued with Self::issue_tlb_flush and
dispatched with Self::dispatch_tlb_flush. This method will not
dispatch any issued requests so it will not guarantee TLB coherence
of requests that are not dispatched.
§Panics
This method panics if the IRQs are disabled. Since the remote flush are processed in IRQs, two CPUs may deadlock if they are waiting for each other’s TLB coherence.