You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Process Context IDs let the CPU tag TLB entries with the active
page-table root. Without that, every context switch that reloads CR3
must invalidate the whole TLB, even when the outgoing and incoming
tasks are unrelated and their mappings could safely coexist in the
cache. Giving each live task root its own PCID (1..4095; 0 reserved
for per-CPU transitional tables) is the foundation for cheaper
switches later and keeps stale translations from one dead root from
matching a reused tag.This is also part of my GSoC project to
add support for X86 Process Context Identifiers (PCID) in COCONUT-SVSM.
Each task root gets a TaskPcid from a global pool of 4096 IDs (PCID 0
stays reserved for per-CPU transitional page tables). The allocator keeps a
simple in_use bitmap: allocation scans from 1 upward for the first free
slot and marks it taken. Freeing is tied to task lifetime when the
Task is destroyed, TaskPcid’s Drop runs release(), which first
broadcasts a PCID-targeted TLB shootdown on every CPU
(flush_tlb_pcid_sync, INVPCID on native / INVLPGB+TLBSYNC on SNP) so no
stale translations remain tagged with that ID, then clears the in_use bit
so the number can be reused. That guarantees the invariant that any PCID
loaded into CR3 for a new root has no valid entries under its tag anywhere
in the system.
Signed-off-by: tanish111 <tanishdesai37@gmail.com>
0 commit comments