[PATCH] ARM: mm: clear SCTLR.HA instead of setting it for LPAE

Catalin Marinas catalin.marinas at arm.com
Tue Sep 23 09:16:29 PDT 2014


On Mon, Sep 22, 2014 at 04:02:17PM +0100, Will Deacon wrote:
> SCTLR.HA (hardware access flag) is deprecated, not actually implemented
> by any CPUs

That I agree.

> and would probably break Linux if it was (since we don't use
> atomics when accessing page table entries).

But not here. The ARMv7 ARM states:

  Any implementation of hardware management of the Access flag must
  ensure that any software changes to the translation table are not
  overwritten. The architecture does not require software that changes
  translation table entries to use interlocked operations. The hardware
  management mechanisms for the Access flag must prevent any loss of
  data written to translation table entries that might occur when, for
  example, a write by another processor occurs between the read and
  write phases of a translation table walk that updates the Access flag.

So basically you should not be required to change the OS for atomic
accesses to the page table entries. There is indeed a chance that the OS
would inadvertently clear the AF bit but that's only affecting the
statistics a bit.

> Furthermore, it can confuse cr_alignment checks where the whole value
> of SCTLR is compared against the value sitting in the hardware, since
> the bit is actually RAZ/WI and will not match the saved cr_alignment
> value.

Is this the right fix for cr_alignment? What if we get other bits in the
future which are RAZ/WI on ARMv7 and RW on 32-bit ARMv8?

-- 
Catalin



More information about the linux-arm-kernel mailing list