Simplify set_huge_pte_at, pte_same for LPAE
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest0 of 3 patches 0 repliesNew
Patches in v1 No applies recorded yet
None of the 3 patches the cover letter announces are in this archive.
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/3] Simplify set_huge_pte_at, pte_same for LPAE
Quoted 43 lines · Steve Capper
Hello,
The following patch series is my attempt at fixing a rather nasty bug which became visible in 3.12-rc1 when running the libhugetlbfs test suite. (This problem only just came to my attention yesterday).For LPAE,
set_huge_pte_atcallsset_pte_atwhich then callsset_pte_ext, which in turn is wired up to callcpu_v7_set_pte_ext, which is defined inproc-v7-3level.S.For huge pages, given newprot a
pgprot_tvalue for a shared writable VMA, and ptep a pointer to a pte belonging to this VMA; the following behaviour is assumed by core code:hugetlb_change_protection(vma, address, end, newprot); ... huge_pte_write(huge_ptep_get(ptep)); /* should be true! */Unfortunately,
cpu_v7_set_pte_extwill change the bit layout of the resultant pte, and will set the read only bit if the dirty bit is not also enabled.If one were to allocate a read only shared huge page, then fault it in, and then mprotect it to be writeable. A subsequent write to that huge page will result in a spurious call to
hugetlb_cow, which causes corruption. This call is optimised away prior to:
37a2140 mm, hugetlb: do not use a page in page cache for cow
optimizationIf one runs the libhugetlbfs test suite on v3.12-rc1 upwards, then the mprotect test will cause the afformentioned corruption and before the set of tests completes, the system will be left in an unresponsive state. (calls to fork fail with
-ENOMEM).This was an absolute pig to debug and, as this is the second time I've ran into issues caused by ptes being modified in transit, I've opted to re-implement
set_huge_pte_atsuch that it just dereferences the pte. (in a similar manner as arm64). This has also allowed me to revert thepte_samelogic change (that removed the NG bit from comparison), by also setting the NG bit for all new huge ptes.These patches are against 3.12, and I have tested this series on an Arndale board with LPAE running libhugetlbfs.
Quoted 8 lines
I would really value any comments/critique/flames on this series. Especially as I've ommitted the DCCMVAC at the end of
set_huge_pte_atas I couldn't see why it was needed, please yell at me if it is needed! :-)Cheers,
Signature · 1 line
Steve
Hi,
A question has been raised for the arm64 analogue of this series as to whether or not this is the best approach:
http://lists.infradead.org/pipermail/linux-arm-kernel/2013-November/215155.html
I am having a think about this, and will send out a V2 once my brain has caught up. :-)
Cheers,
Signature · 1 line
Steve