lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <871rhrejw8.fsf@linux.ibm.com>
Date:   Wed, 21 Oct 2020 19:55:11 +0530
From:   "Aneesh Kumar K.V" <aneesh.kumar@...ux.ibm.com>
To:     Christophe Leroy <christophe.leroy@...roup.eu>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Paul Mackerras <paulus@...ba.org>,
        Michael Ellerman <mpe@...erman.id.au>
Cc:     linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] powerpc/mm: Add mask of always present MMU features

Christophe Leroy <christophe.leroy@...roup.eu> writes:

> Le 12/10/2020 à 17:39, Christophe Leroy a écrit :
>> On the same principle as commit 773edeadf672 ("powerpc/mm: Add mask
>> of possible MMU features"), add mask for MMU features that are
>> always there in order to optimise out dead branches.
>> 
>> Signed-off-by: Christophe Leroy <christophe.leroy@...roup.eu>
>> ---
>> v2: Features must be anded with MMU_FTRS_POSSIBLE instead of ~0, otherwise
>>      MMU_FTRS_ALWAYS is ~0 when no #ifdef matches.
>
> This is still not enough. For BOOK3S/32, MMU_FTRS_POSSIBLE is still too much.
> We need a #ifdef CONFIG_PPC_BOOK3S_32 with 0.
>
> Christophe
>
>> ---
>>   arch/powerpc/include/asm/mmu.h | 25 +++++++++++++++++++++++++
>>   1 file changed, 25 insertions(+)
>> 
>> diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
>> index 255a1837e9f7..64e7e7f7cda9 100644
>> --- a/arch/powerpc/include/asm/mmu.h
>> +++ b/arch/powerpc/include/asm/mmu.h
>> @@ -201,8 +201,30 @@ enum {
>>   		0,
>>   };
>>   
>> +enum {
>> +	MMU_FTRS_ALWAYS =
>> +#ifdef CONFIG_PPC_8xx
>> +		MMU_FTR_TYPE_8xx &
>> +#endif
>> +#ifdef CONFIG_40x
>> +		MMU_FTR_TYPE_40x &
>> +#endif
>> +#ifdef CONFIG_PPC_47x
>> +		MMU_FTR_TYPE_47x &
>> +#elif defined(CONFIG_44x)
>> +		MMU_FTR_TYPE_44x &
>> +#endif
>> +#if defined(CONFIG_E200) || defined(CONFIG_E500)
>> +		MMU_FTR_TYPE_FSL_E &
>> +#endif
>> +		MMU_FTRS_POSSIBLE,
>> +};

Will it be simpler if we make it a #define like below?

#ifdef CONFIG_PPC_8XX
#define MMU_FTR_ALWAYS  MMU_FTR_TYPE_8XX & MMU_FTR_POSSIBLE
#endif



>> +
>>   static inline bool early_mmu_has_feature(unsigned long feature)
>>   {
>> +	if (MMU_FTRS_ALWAYS & feature)
>> +		return true;
>> +
>>   	return !!(MMU_FTRS_POSSIBLE & cur_cpu_spec->mmu_features & feature);
>>   }
>>   
>> @@ -231,6 +253,9 @@ static __always_inline bool mmu_has_feature(unsigned long feature)
>>   	}
>>   #endif
>>   
>> +	if (MMU_FTRS_ALWAYS & feature)
>> +		return true;
>> +
>>   	if (!(MMU_FTRS_POSSIBLE & feature))
>>   		return false;
>>   
>> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ