Re: [PATCH 3/4] arm64/mm: Consolidate page fault information capture
From: Anshuman Khandual
Date: Fri May 31 2019 - 05:13:43 EST
On 05/29/2019 08:23 PM, Mark Rutland wrote:
> On Wed, May 29, 2019 at 06:04:44PM +0530, Anshuman Khandual wrote:
>> This consolidates page fault information capture and move them bit earlier.
>> While here it also adds an wrapper is_write_abort(). It also saves some
>> cycles by replacing multiple user_mode() calls into a single one earlier
>> during the fault.
>
> To be honest, I doubt this has any measureable impact, but I agree that
> using variables _may_ make the flow control easier to understand.
>
>>
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@xxxxxxx>
>> Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
>> Cc: Will Deacon <will.deacon@xxxxxxx>
>> Cc: Mark Rutland <mark.rutland@xxxxxxx>
>> Cc: James Morse <james.morse@xxxxxxx>
>> Cc: Andrey Konovalov <andreyknvl@xxxxxxxxxx>
>> ---
>> arch/arm64/mm/fault.c | 22 +++++++++++++++-------
>> 1 file changed, 15 insertions(+), 7 deletions(-)
>>
>> diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
>> index da02678..170c71f 100644
>> --- a/arch/arm64/mm/fault.c
>> +++ b/arch/arm64/mm/fault.c
>> @@ -435,6 +435,11 @@ static bool is_el0_instruction_abort(unsigned int esr)
>> return ESR_ELx_EC(esr) == ESR_ELx_EC_IABT_LOW;
>> }
>>
>> +static bool is_write_abort(unsigned int esr)
>> +{
>> + return (esr & ESR_ELx_WNR) && !(esr & ESR_ELx_CM);
>> +}
>
> In off-list review, I mentioned that this isn't true for EL1, and I
> think that we should name this 'is_el0_write_abort()' or add a comment
> explaining the caveats if factored into a helper.
>
> Thanks,
> Mark.
Okay will change the wrapper name to is_el0_write_abort() and add a comment
explaining how this is only applicable to aborts originating from EL0.