AMD Programmer Manual Update Points To PCID Support, Memory Protection Keys
It looks like AMD Zen 3 CPUs will finally be supporting PCID! And memory protection keys are coming too, at least according to AMD's latest programmer reference manual.
AMD has published a new revision of their Programmer's Reference Manual. The new registers detailed are for PCID and PKEY.
Yes, PCID as in Process Context Identifiers are finally being supported on AMD CPUs. PCID has been supported by Intel CPUs since 2010 while since 2018 have been talked about much more for helping to offset some of the performance overhead stemming from Meltdown mitigations as PCID allows avoiding an extra TLB flush. While Intel has long supported PCID, AMD CPUs to date have not supported Process Context Identifiers. The Linux kernel has supported making use of Process Context Identifiers and the INVPCID instruction since around Linux 4.14 with PCID optimized TLB flushing.
As outlined in the PRM, "The Process Context Identifier (PCID) feature allows a logical processor to cache TLB mappings concurrently for multiple virtual address spaces. When enabled (by setting CR4.PCIDE=1), the processor associates the current 12-bit PCID with each TLB mapping it creates. Only entries matching the current PCID are used when performing address translations. In this way, the processor may retain cached TLB mappings for multiple contexts."
The other notable addition with today's updated manual is Memory Protection Key (PKE) support. The AMD PKE support also enables the RDPKRU and WRPKRU instructions. Intel provided that Linux support for years and on the CPU side has been supported since Xeon Skylake. Memory protection keys allow for page-based memory protections via the RDPKRU/WRPKRU instructions. As explained in the AMD manual, "[MPK] provides a way for applications to impose page-based data access protections (read/write, read-only or no access), without requiring modification of page tables and subsequent TLB invalidations when the application changes protection domains."
The Linux kernel, GCC and Clang, and other key libraries like Glibc already have memory protection key support in good order thanks to Intel's earlier work.
While not guaranteed, given the timing of the manual update, the PCID and PKE/MPK functionality is almost surely part of the AMD Zen 3 processors launching later this year.
The latest AMD manual can be found here.
AMD has published a new revision of their Programmer's Reference Manual. The new registers detailed are for PCID and PKEY.
Yes, PCID as in Process Context Identifiers are finally being supported on AMD CPUs. PCID has been supported by Intel CPUs since 2010 while since 2018 have been talked about much more for helping to offset some of the performance overhead stemming from Meltdown mitigations as PCID allows avoiding an extra TLB flush. While Intel has long supported PCID, AMD CPUs to date have not supported Process Context Identifiers. The Linux kernel has supported making use of Process Context Identifiers and the INVPCID instruction since around Linux 4.14 with PCID optimized TLB flushing.
As outlined in the PRM, "The Process Context Identifier (PCID) feature allows a logical processor to cache TLB mappings concurrently for multiple virtual address spaces. When enabled (by setting CR4.PCIDE=1), the processor associates the current 12-bit PCID with each TLB mapping it creates. Only entries matching the current PCID are used when performing address translations. In this way, the processor may retain cached TLB mappings for multiple contexts."
The other notable addition with today's updated manual is Memory Protection Key (PKE) support. The AMD PKE support also enables the RDPKRU and WRPKRU instructions. Intel provided that Linux support for years and on the CPU side has been supported since Xeon Skylake. Memory protection keys allow for page-based memory protections via the RDPKRU/WRPKRU instructions. As explained in the AMD manual, "[MPK] provides a way for applications to impose page-based data access protections (read/write, read-only or no access), without requiring modification of page tables and subsequent TLB invalidations when the application changes protection domains."
The Linux kernel, GCC and Clang, and other key libraries like Glibc already have memory protection key support in good order thanks to Intel's earlier work.
While not guaranteed, given the timing of the manual update, the PCID and PKE/MPK functionality is almost surely part of the AMD Zen 3 processors launching later this year.
The latest AMD manual can be found here.
6 Comments