AMD Programmer Manual Update Points To PCID Support, Memory Protection Keys

Written by Michael Larabel in AMD on 29 April 2020 at 03:50 PM EDT. 6 Comments
AMD
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.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week