After ChkTag [1] announcement, it's worth preparing a stable x86 linear
address masking (lam) user interface. One important aspect of lam is the
tag width, and aligning it with other industry solutions can provide a
more popular, generalized interface that other technologies could
utilize.

ChkTag will use 4-bit tags and since that's the direction other memory
tagging implementations seem to be taking too (for example Arm's MTE)
it's reasonable to converge lam in linux to the same specification. Even
though x86's LAM supports 6-bit tags it is beneficial to default lam to
4 bits as ChkTag will likely be the main user of the interface and such
connection should simplify things in the future.

6-bit tags should still be available as a debug feature and possible to
enable through debugfs. Tag width can be system wide whether it's the
default 4 bits or debug 6 bits and when a process requests a specific tag
width it should get the max amount enabled globally.

Series also cleans up some comments referencing LAM_U48 which was not
implemented in the kernel and the comments shouldn't imply it can be
enabled.

Patches are based on v6.19.

[1] 
https://community.intel.com/t5/Blogs/Tech-Innovation/open-intel/ChkTag-x86-Memory-Safety/post/1721490

Maciej Wieczor-Retman (4):
  x86/process: Shorten the default LAM tag width
  x86/process: Add a debug interface to change LAM tag width
  x86/mm: Cleanup comments where LAM_U48 is mentioned
  selftests/lam: Add test cases for different LAM tag widths

 arch/x86/include/asm/mmu.h         |  2 +-
 arch/x86/include/asm/mmu_context.h |  3 ++
 arch/x86/include/asm/tlbflush.h    |  2 +-
 arch/x86/kernel/process_64.c       | 71 +++++++++++++++++++++---
 tools/testing/selftests/x86/lam.c  | 87 +++++++++++++++++++++++++-----
 5 files changed, 144 insertions(+), 21 deletions(-)

-- 
2.53.0



Reply via email to