On Thu, Sep 15, 2016 at 5:28 AM, Julien Grall wrote: > Hello all, > > The ARM architecture mandates the use of a break-before-make sequence when > changing translation entries if the page table is shared between multiple > CPUs whenever a valid entry is replaced by another valid entry (see D4.7.1 > in ARM DDI 0487A.j for more details). > > The current P2M code does not respect this sequence and may result to > break coherency on some processors. > > Adapting the current implementation to use break-before-make sequence would > imply some code duplication and more TLBs invalidations than necessary. > For instance, if we are replacing a 4KB page and the current mapping in > the P2M is using a 1GB superpage, the following steps will happen: > 1) Shatter the 1GB superpage into a series of 2MB superpages > 2) Shatter the 2MB superpage into a series of 4KB superpages > 3) Replace the 4KB page > > As the current implementation is shattering while descending and install > the mapping before continuing to the next level, Xen would need to issue 3 > TLB invalidation instructions which is clearly inefficient. > > Furthermore, all the operations which modify the page table are using the > same skeleton. It is more complicated to maintain different code paths than > having a generic function that set an entry and take care of the > break-before- > make sequence. > > The new implementation is based on the x86 EPT one which, I think, fits > quite well for the break-before-make sequence whilst keeping the code > simple. > > For all the changes see in each patch. > > I have provided a branch based on upstream here: > git://xenbits.xen.org/people/julieng/xen-unstable.git branch p2m-v2 > > Tested-by: Tamas K Lengyel Works without any issue on both the Cubietruck and the HiKey LeMaker with the xen-access test-cases. Cheers, Tamas