git: e0612ed490c7 - main - amd64 pmap: add comment explaining why INVLPG is functional for PCID config
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 10 Oct 2022 21:34:02 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e0612ed490c723174607823378d9e883a4b1c257 commit e0612ed490c723174607823378d9e883a4b1c257 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2022-10-10 00:19:45 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-10-10 21:33:17 +0000 amd64 pmap: add comment explaining why INVLPG is functional for PCID config Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D36919 --- sys/amd64/amd64/pmap.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index f69f452bcced..2dddc7a4c582 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -2897,8 +2897,16 @@ pmap_update_pde_invalidate(pmap_t pmap, vm_offset_t va, pd_entry_t newpde) * page table, and INVPCID(INVPCID_CTXGLOB)/invltlb_glob() for a * user space page table(s). * - * If the INVPCID instruction is available, it is used to flush entries - * from the kernel page table. + * If the INVPCID instruction is available, it is used to flush user + * entries from the kernel page table. + * + * When PCID is enabled, the INVLPG instruction invalidates all TLB + * entries for the given page that either match the current PCID or + * are global. Since TLB entries for the same page under different + * PCIDs are unaffected, kernel pages which reside in all address + * spaces could be problematic. We avoid the problem by creating + * all kernel PTEs with the global flag (PG_G) set, when PTI is + * disabled. * * * mode: PTI disabled, PCID present. The kernel reserves PCID 0 for its * address space, all other 4095 PCIDs are used for user mode spaces