Re: [PATCH v5 4/4] sparc64: Add support for ADI (Application Data Integrity)
From: David Miller
Date: Wed Feb 01 2017 - 12:18:47 EST
From: Khalid Aziz <khalid.aziz@xxxxxxxxxx>
Date: Tue, 31 Jan 2017 16:38:49 -0700
> Thanks for the feedback. This is very helpful. I checked and it indeed
> can cost 50+ cycles even on M7 processor for PSTATE accesses.
Consider how many bytes can be copied in 50+ cycles :-)
>> On etrap, you change ESTATE_PSTATE{1,2} to have the MCDE bit enabled.
>> Then the kernel always runs with ADI enabled.
>
> Running the kernel with PSTATE.mcde=1 can possibly be problematic as
> we had discussed earlier in this thread where keeping PSTATE.mcde
> enabled might mean kernel having to keep track of which pages still
> have tags set on them or flush tags on every page on free. I will go
> through the code again to see if it PSTATE.mcde can be turned on in
> kernel all the time, which might be the case if we can ensure kernel
> accesses pages with TTE.mcd cleared.
If we can clear the tags properly on page release when the page was
used for ADI, it can work.
One way would be to track the state in the page struct somehow, and
in arch_alloc_page() clear the tags if necessary.