linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/mm: Code cleanup for __hash_page_thp
@ 2024-01-25  9:26 Kunwu Chan
  2024-02-26 10:49 ` Michael Ellerman
  0 siblings, 1 reply; 8+ messages in thread
From: Kunwu Chan @ 2024-01-25  9:26 UTC (permalink / raw)
  To: mpe, npiggin, christophe.leroy, aneesh.kumar, naveen.n.rao
  Cc: linuxppc-dev, linux-kernel, Kunwu Chan

This part was commented from commit 6d492ecc6489
("powerpc/THP: Add code to handle HPTE faults for hugepages")
in about 11 years before.

If there are no plans to enable this part code in the future,
we can remove this dead code.

Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
---
 arch/powerpc/mm/book3s64/hash_hugepage.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/arch/powerpc/mm/book3s64/hash_hugepage.c b/arch/powerpc/mm/book3s64/hash_hugepage.c
index c0fabe6c5a12..127a3a2c174b 100644
--- a/arch/powerpc/mm/book3s64/hash_hugepage.c
+++ b/arch/powerpc/mm/book3s64/hash_hugepage.c
@@ -59,16 +59,6 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,
 
 	rflags = htab_convert_pte_flags(new_pmd, flags);
 
-#if 0
-	if (!cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) {
-
-		/*
-		 * No CPU has hugepages but lacks no execute, so we
-		 * don't need to worry about that case
-		 */
-		rflags = hash_page_do_lazy_icache(rflags, __pte(old_pte), trap);
-	}
-#endif
 	/*
 	 * Find the slot index details for this ea, using base page size.
 	 */
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] powerpc/mm: Code cleanup for __hash_page_thp
  2024-01-25  9:26 [PATCH] powerpc/mm: Code cleanup for __hash_page_thp Kunwu Chan
@ 2024-02-26 10:49 ` Michael Ellerman
  2024-02-27  3:14   ` Kunwu Chan
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Ellerman @ 2024-02-26 10:49 UTC (permalink / raw)
  To: Kunwu Chan, npiggin, christophe.leroy, aneesh.kumar, naveen.n.rao
  Cc: linuxppc-dev, linux-kernel, Kunwu Chan

Kunwu Chan <chentao@kylinos.cn> writes:
> This part was commented from commit 6d492ecc6489
> ("powerpc/THP: Add code to handle HPTE faults for hugepages")
> in about 11 years before.
>
> If there are no plans to enable this part code in the future,
> we can remove this dead code.

I agree the code can go. But I'd like it to be replaced with a comment
explaining what the dead code was trying to say.

cheers

> diff --git a/arch/powerpc/mm/book3s64/hash_hugepage.c b/arch/powerpc/mm/book3s64/hash_hugepage.c
> index c0fabe6c5a12..127a3a2c174b 100644
> --- a/arch/powerpc/mm/book3s64/hash_hugepage.c
> +++ b/arch/powerpc/mm/book3s64/hash_hugepage.c
> @@ -59,16 +59,6 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,
>  
>  	rflags = htab_convert_pte_flags(new_pmd, flags);
>  
> -#if 0
> -	if (!cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) {
> -
> -		/*
> -		 * No CPU has hugepages but lacks no execute, so we
> -		 * don't need to worry about that case
> -		 */
> -		rflags = hash_page_do_lazy_icache(rflags, __pte(old_pte), trap);
> -	}
> -#endif
>  	/*
>  	 * Find the slot index details for this ea, using base page size.
>  	 */
> -- 
> 2.39.2

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] powerpc/mm: Code cleanup for __hash_page_thp
  2024-02-26 10:49 ` Michael Ellerman
@ 2024-02-27  3:14   ` Kunwu Chan
  2024-02-27  6:07     ` Michael Ellerman
  0 siblings, 1 reply; 8+ messages in thread
From: Kunwu Chan @ 2024-02-27  3:14 UTC (permalink / raw)
  To: Michael Ellerman, npiggin, christophe.leroy, aneesh.kumar, naveen.n.rao
  Cc: linuxppc-dev, linux-kernel

Thanks for the reply.

On 2024/2/26 18:49, Michael Ellerman wrote:
> Kunwu Chan <chentao@kylinos.cn> writes:
>> This part was commented from commit 6d492ecc6489
>> ("powerpc/THP: Add code to handle HPTE faults for hugepages")
>> in about 11 years before.
>>
>> If there are no plans to enable this part code in the future,
>> we can remove this dead code.
> 
> I agree the code can go. But I'd like it to be replaced with a comment
> explaining what the dead code was trying to say.
Thanks, i'll update a new patch with the following comment:
     /*
     * No CPU has hugepages but lacks no execute, so we
     * don't need to worry about cpu no CPU_FTR_COHERENT_ICACHE feature case
     */

> 
> cheers
> 
>> diff --git a/arch/powerpc/mm/book3s64/hash_hugepage.c b/arch/powerpc/mm/book3s64/hash_hugepage.c
>> index c0fabe6c5a12..127a3a2c174b 100644
>> --- a/arch/powerpc/mm/book3s64/hash_hugepage.c
>> +++ b/arch/powerpc/mm/book3s64/hash_hugepage.c
>> @@ -59,16 +59,6 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,
>>   
>>   	rflags = htab_convert_pte_flags(new_pmd, flags);
>>   
>> -#if 0
>> -	if (!cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) {
>> -
>> -		/*
>> -		 * No CPU has hugepages but lacks no execute, so we
>> -		 * don't need to worry about that case
>> -		 */
>> -		rflags = hash_page_do_lazy_icache(rflags, __pte(old_pte), trap);
>> -	}
>> -#endif
>>   	/*
>>   	 * Find the slot index details for this ea, using base page size.
>>   	 */
>> -- 
>> 2.39.2
-- 
Thanks,
   Kunwu


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] powerpc/mm: Code cleanup for __hash_page_thp
  2024-02-27  3:14   ` Kunwu Chan
@ 2024-02-27  6:07     ` Michael Ellerman
  2024-02-27  9:32       ` Kunwu Chan
  2024-02-29  3:52       ` Aneesh Kumar K.V
  0 siblings, 2 replies; 8+ messages in thread
From: Michael Ellerman @ 2024-02-27  6:07 UTC (permalink / raw)
  To: Kunwu Chan, npiggin, christophe.leroy, aneesh.kumar, naveen.n.rao
  Cc: linuxppc-dev, linux-kernel

Kunwu Chan <chentao@kylinos.cn> writes:
> Thanks for the reply.
>
> On 2024/2/26 18:49, Michael Ellerman wrote:
>> Kunwu Chan <chentao@kylinos.cn> writes:
>>> This part was commented from commit 6d492ecc6489
>>> ("powerpc/THP: Add code to handle HPTE faults for hugepages")
>>> in about 11 years before.
>>>
>>> If there are no plans to enable this part code in the future,
>>> we can remove this dead code.
>> 
>> I agree the code can go. But I'd like it to be replaced with a comment
>> explaining what the dead code was trying to say.

> Thanks, i'll update a new patch with the following comment:
>      /*
>      * No CPU has hugepages but lacks no execute, so we
>      * don't need to worry about cpu no CPU_FTR_COHERENT_ICACHE feature case
>      */

Maybe wait until we can get some input from Aneesh. I'm not sure the
code/comment are really up to date.

cheers

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] powerpc/mm: Code cleanup for __hash_page_thp
  2024-02-27  6:07     ` Michael Ellerman
@ 2024-02-27  9:32       ` Kunwu Chan
  2024-02-29  3:52       ` Aneesh Kumar K.V
  1 sibling, 0 replies; 8+ messages in thread
From: Kunwu Chan @ 2024-02-27  9:32 UTC (permalink / raw)
  To: Michael Ellerman, npiggin, christophe.leroy, aneesh.kumar, naveen.n.rao
  Cc: linuxppc-dev, linux-kernel

Thanks for the reply.
On 2024/2/27 14:07, Michael Ellerman wrote:
> Kunwu Chan <chentao@kylinos.cn> writes:
>> Thanks for the reply.
>>
>> On 2024/2/26 18:49, Michael Ellerman wrote:
>>> Kunwu Chan <chentao@kylinos.cn> writes:
>>>> This part was commented from commit 6d492ecc6489
>>>> ("powerpc/THP: Add code to handle HPTE faults for hugepages")
>>>> in about 11 years before.
>>>>
>>>> If there are no plans to enable this part code in the future,
>>>> we can remove this dead code.
>>>
>>> I agree the code can go. But I'd like it to be replaced with a comment
>>> explaining what the dead code was trying to say.
> 
>> Thanks, i'll update a new patch with the following comment:
>>       /*
>>       * No CPU has hugepages but lacks no execute, so we
>>       * don't need to worry about cpu no CPU_FTR_COHERENT_ICACHE feature case
>>       */
> 
> Maybe wait until we can get some input from Aneesh. I'm not sure the
> code/comment are really up to date.
I won't do anything until I get a reply.
I'll wait for the latest msg.

> 
> cheers
-- 
Thanks,
   Kunwu


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] powerpc/mm: Code cleanup for __hash_page_thp
  2024-02-27  6:07     ` Michael Ellerman
  2024-02-27  9:32       ` Kunwu Chan
@ 2024-02-29  3:52       ` Aneesh Kumar K.V
  2024-02-29  6:18         ` Michael Ellerman
  1 sibling, 1 reply; 8+ messages in thread
From: Aneesh Kumar K.V @ 2024-02-29  3:52 UTC (permalink / raw)
  To: Michael Ellerman, Kunwu Chan, npiggin, christophe.leroy, naveen.n.rao
  Cc: linuxppc-dev, linux-kernel

Michael Ellerman <mpe@ellerman.id.au> writes:

> Kunwu Chan <chentao@kylinos.cn> writes:
>> Thanks for the reply.
>>
>> On 2024/2/26 18:49, Michael Ellerman wrote:
>>> Kunwu Chan <chentao@kylinos.cn> writes:
>>>> This part was commented from commit 6d492ecc6489
>>>> ("powerpc/THP: Add code to handle HPTE faults for hugepages")
>>>> in about 11 years before.
>>>>
>>>> If there are no plans to enable this part code in the future,
>>>> we can remove this dead code.
>>> 
>>> I agree the code can go. But I'd like it to be replaced with a comment
>>> explaining what the dead code was trying to say.
>
>> Thanks, i'll update a new patch with the following comment:
>>      /*
>>      * No CPU has hugepages but lacks no execute, so we
>>      * don't need to worry about cpu no CPU_FTR_COHERENT_ICACHE feature case
>>      */
>
> Maybe wait until we can get some input from Aneesh. I'm not sure the
> code/comment are really up to date.
>
> cheers

How about?

modified   arch/powerpc/mm/book3s64/hash_hugepage.c
@@ -58,17 +58,13 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,
 		return 0;
 
 	rflags = htab_convert_pte_flags(new_pmd, flags);
+	/*
+	 * THPs are only supported on platforms that can do mixed page size
+	 * segments (MPSS) and all such platforms have coherent icache. Hence we
+	 * don't need to do lazy icache flush (hash_page_do_lazy_icache()) on
+	 * noexecute fault.
+	 */
 
-#if 0
-	if (!cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) {
-
-		/*
-		 * No CPU has hugepages but lacks no execute, so we
-		 * don't need to worry about that case
-		 */
-		rflags = hash_page_do_lazy_icache(rflags, __pte(old_pte), trap);
-	}
-#endif
 	/*
 	 * Find the slot index details for this ea, using base page size.
 	 */


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] powerpc/mm: Code cleanup for __hash_page_thp
  2024-02-29  3:52       ` Aneesh Kumar K.V
@ 2024-02-29  6:18         ` Michael Ellerman
  2024-02-29  9:28           ` Kunwu Chan
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Ellerman @ 2024-02-29  6:18 UTC (permalink / raw)
  To: Aneesh Kumar K.V, Kunwu Chan, npiggin, christophe.leroy, naveen.n.rao
  Cc: linuxppc-dev, linux-kernel

Aneesh Kumar K.V <aneesh.kumar@kernel.org> writes:
> Michael Ellerman <mpe@ellerman.id.au> writes:
>> Kunwu Chan <chentao@kylinos.cn> writes:
>>> On 2024/2/26 18:49, Michael Ellerman wrote:
>>>> Kunwu Chan <chentao@kylinos.cn> writes:
>>>>> This part was commented from commit 6d492ecc6489
>>>>> ("powerpc/THP: Add code to handle HPTE faults for hugepages")
>>>>> in about 11 years before.
>>>>>
>>>>> If there are no plans to enable this part code in the future,
>>>>> we can remove this dead code.
>>>> 
>>>> I agree the code can go. But I'd like it to be replaced with a comment
>>>> explaining what the dead code was trying to say.
>>
>>> Thanks, i'll update a new patch with the following comment:
>>>      /*
>>>      * No CPU has hugepages but lacks no execute, so we
>>>      * don't need to worry about cpu no CPU_FTR_COHERENT_ICACHE feature case
>>>      */
>>
>> Maybe wait until we can get some input from Aneesh. I'm not sure the
>> code/comment are really up to date.
>
> How about?
>
> modified   arch/powerpc/mm/book3s64/hash_hugepage.c
> @@ -58,17 +58,13 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,
>  		return 0;
>  
>  	rflags = htab_convert_pte_flags(new_pmd, flags);
> +	/*
> +	 * THPs are only supported on platforms that can do mixed page size
> +	 * segments (MPSS) and all such platforms have coherent icache. Hence we
> +	 * don't need to do lazy icache flush (hash_page_do_lazy_icache()) on
> +	 * noexecute fault.
> +	 */

Yeah thanks that looks good.

It could say "see eg. __hash_page_4K()", but that's probably unnecessary
as it mentions hash_page_do_lazy_icache(), and anyone interested is just
going to grep for that anyway.

cheers

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] powerpc/mm: Code cleanup for __hash_page_thp
  2024-02-29  6:18         ` Michael Ellerman
@ 2024-02-29  9:28           ` Kunwu Chan
  0 siblings, 0 replies; 8+ messages in thread
From: Kunwu Chan @ 2024-02-29  9:28 UTC (permalink / raw)
  To: Michael Ellerman, Aneesh Kumar K.V, npiggin, christophe.leroy,
	naveen.n.rao
  Cc: linuxppc-dev, linux-kernel

Thanks all for the reply.
On 2024/2/29 14:18, Michael Ellerman wrote:
> Aneesh Kumar K.V <aneesh.kumar@kernel.org> writes:
>> Michael Ellerman <mpe@ellerman.id.au> writes:
>>> Kunwu Chan <chentao@kylinos.cn> writes:
>>>> On 2024/2/26 18:49, Michael Ellerman wrote:
>>>>> Kunwu Chan <chentao@kylinos.cn> writes:
>>>>>> This part was commented from commit 6d492ecc6489
>>>>>> ("powerpc/THP: Add code to handle HPTE faults for hugepages")
>>>>>> in about 11 years before.
>>>>>>
>>>>>> If there are no plans to enable this part code in the future,
>>>>>> we can remove this dead code.
>>>>>
>>>>> I agree the code can go. But I'd like it to be replaced with a comment
>>>>> explaining what the dead code was trying to say.
>>>
>>>> Thanks, i'll update a new patch with the following comment:
>>>>       /*
>>>>       * No CPU has hugepages but lacks no execute, so we
>>>>       * don't need to worry about cpu no CPU_FTR_COHERENT_ICACHE feature case
>>>>       */
>>>
>>> Maybe wait until we can get some input from Aneesh. I'm not sure the
>>> code/comment are really up to date.
>>
>> How about?
>>
>> modified   arch/powerpc/mm/book3s64/hash_hugepage.c
>> @@ -58,17 +58,13 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,
>>   		return 0;
>>   
>>   	rflags = htab_convert_pte_flags(new_pmd, flags);
>> +	/*
>> +	 * THPs are only supported on platforms that can do mixed page size
>> +	 * segments (MPSS) and all such platforms have coherent icache. Hence we
>> +	 * don't need to do lazy icache flush (hash_page_do_lazy_icache()) on
>> +	 * noexecute fault.
>> +	 */
> 
I'll use this comment in v2 patch.
And add two Suggested-by: label for you.

> Yeah thanks that looks good.
> 
> It could say "see eg. __hash_page_4K()", but that's probably unnecessary
> as it mentions hash_page_do_lazy_icache(), and anyone interested is just
> going to grep for that anyway.
> 
> cheers
-- 
Thanks,
   Kunwu


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-02-29  9:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-25  9:26 [PATCH] powerpc/mm: Code cleanup for __hash_page_thp Kunwu Chan
2024-02-26 10:49 ` Michael Ellerman
2024-02-27  3:14   ` Kunwu Chan
2024-02-27  6:07     ` Michael Ellerman
2024-02-27  9:32       ` Kunwu Chan
2024-02-29  3:52       ` Aneesh Kumar K.V
2024-02-29  6:18         ` Michael Ellerman
2024-02-29  9:28           ` Kunwu Chan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).