Skip to content

RFC Workaround for Xeon Phi PTE A/D bits erratum

Dave Hansen linux-mm lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 RFC Latest posting 2/24 patches 12 repliesIn review
  2. v4 RFC posting 1/24 patches 4 repliesSuperseded
  3. v36 patches 19 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v11 of 7 patches0 repliesSuperseded

Patches in v4 posting 2/2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4x86, swap: move swap offset/type up in PTE to work around erratumarch/x86/include/asm/pgtable_64.h+20 -61 reply
2/4x86, pagetable: ignore A/D bits in pte/pmd/pud_none()arch/x86/include/asm/pgtable.h arch/x86/include/asm/pgtable_types.h+16 -33 replies
3/4x86: disallow running with 32-bit PTEs to work around erratumarch/x86/boot/boot.h arch/x86/boot/cpu.c arch/x86/boot/cpucheck.c +2 more+38 -00 replies
4/4x86: use pte_none() to test for empty PTEarch/x86/mm/init_64.c arch/x86/mm/pageattr.c arch/x86/mm/pgtable_32.c+8 -87 replies

Reviews trailers per patch

3 of 4 patches have a Reviewed-by or Acked-by.

PatchMichal HockoDavid Vrabel
1/4A-b
2/4A-b
3/4
4/4A-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH 0/4] [RFC][v4] Workaround for Xeon Phi PTE A/D bits erratum

This patch survived a bunch of testing over the past week, including on hardware affected by the issue. A debugging patch showed the "stray" bits being set, and no ill effects were noticed.

Barring any heartburn from folks, I think this is ready for the tip tree.

--

The Intel(R) Xeon Phi(TM) Processor x200 Family (codename: Knights Landing) has an erratum where a processor thread setting the Accessed or Dirty bits may not do so atomically against its checks for the Present bit. This may cause a thread (which is about to page fault) to set A and/or D, even though the Present bit had already been atomically cleared.

These bits are truly "stray". In the case of the Dirty bit, the thread associated with the stray set was *not* allowed to write to the page. This means that we do not have to launder the bit(s); we can simply ignore them.

More details can be found in the "Specification Update" under "KNL4":

http://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/xeon-phi-processor-specification-update.pdf

If the PTE is used for storing a swap index or a NUMA migration index, the A bit could be misinterpreted as part of the swap type. The stray bits being set cause a software-cleared PTE to be interpreted as a swap entry. In some cases (like when the swap index ends up being for a non-existent swapfile), the kernel detects the stray value and WARN()s about it, but there is no guarantee that the kernel can always detect it.

This patch changes the kernel to attempt to ignore those stray bits when they get set. We do this by making our swap PTE format completely ignore the A/D bits, and also by ignoring them in our pte_none() checks.

Andi Kleen wrote the original version of this patch. Dave Hansen wrote the later ones.

v4: complete rework: let the bad bits stay around, but try to
ignore them
v3: huge rework to keep batching working in unmap case
v2: out of line. avoid single thread flush. cover more clear
cases

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>