All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/book3s64/radix/tlb: Determine hugepage flush correctly
@ 2020-05-13  3:06 Aneesh Kumar K.V
  2020-05-13  4:30 ` Nicholas Piggin
  2020-06-09  5:28 ` Michael Ellerman
  0 siblings, 2 replies; 4+ messages in thread
From: Aneesh Kumar K.V @ 2020-05-13  3:06 UTC (permalink / raw)
  To: linuxppc-dev, mpe; +Cc: Aneesh Kumar K.V, npiggin, Bharata B Rao

With a 64K page size flush with start and end value as below
(start, end) = (721f680d0000, 721f680e0000) results in
(hstart, hend) = (721f68200000, 721f68000000)

Avoid doing a __tlbie_va_range with the wrong hstart and hend value in this
case.

__tlbie_va_range will skip the actual tlbie operation for start > end.
But we still end up doing the tlbie fixup.

Reported-by: Bharata B Rao <bharata@linux.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
 arch/powerpc/mm/book3s64/radix_tlb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c
index 758ade2c2b6e..d592f9e1c037 100644
--- a/arch/powerpc/mm/book3s64/radix_tlb.c
+++ b/arch/powerpc/mm/book3s64/radix_tlb.c
@@ -884,10 +884,10 @@ static inline void __radix__flush_tlb_range(struct mm_struct *mm,
 		if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
 			hstart = (start + PMD_SIZE - 1) & PMD_MASK;
 			hend = end & PMD_MASK;
-			if (hstart == hend)
-				hflush = false;
-			else
+			if (hstart < hend)
 				hflush = true;
+			else
+				hflush = false;
 		}
 
 		if (local) {
-- 
2.26.2


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

* Re: [PATCH] powerpc/book3s64/radix/tlb: Determine hugepage flush correctly
  2020-05-13  3:06 [PATCH] powerpc/book3s64/radix/tlb: Determine hugepage flush correctly Aneesh Kumar K.V
@ 2020-05-13  4:30 ` Nicholas Piggin
  2020-05-18  6:34   ` Michael Ellerman
  2020-06-09  5:28 ` Michael Ellerman
  1 sibling, 1 reply; 4+ messages in thread
From: Nicholas Piggin @ 2020-05-13  4:30 UTC (permalink / raw)
  To: Aneesh Kumar K.V, linuxppc-dev, mpe; +Cc: Bharata B Rao

Excerpts from Aneesh Kumar K.V's message of May 13, 2020 1:06 pm:
> With a 64K page size flush with start and end value as below
> (start, end) = (721f680d0000, 721f680e0000) results in
> (hstart, hend) = (721f68200000, 721f68000000)
> 
> Avoid doing a __tlbie_va_range with the wrong hstart and hend value in this
> case.
> 
> __tlbie_va_range will skip the actual tlbie operation for start > end.
> But we still end up doing the tlbie fixup.

Hm, good catch.

> Reported-by: Bharata B Rao <bharata@linux.ibm.com>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> ---
>  arch/powerpc/mm/book3s64/radix_tlb.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c
> index 758ade2c2b6e..d592f9e1c037 100644
> --- a/arch/powerpc/mm/book3s64/radix_tlb.c
> +++ b/arch/powerpc/mm/book3s64/radix_tlb.c
> @@ -884,10 +884,10 @@ static inline void __radix__flush_tlb_range(struct mm_struct *mm,
>  		if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
>  			hstart = (start + PMD_SIZE - 1) & PMD_MASK;
>  			hend = end & PMD_MASK;
> -			if (hstart == hend)
> -				hflush = false;
> -			else
> +			if (hstart < hend)
>  				hflush = true;
> +			else
> +				hflush = false;

We can probably get rid of the else part since it is already false.

Otherwise

Reviewed-by: Nicholas Piggin <npiggin@gmail.com>


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

* Re: [PATCH] powerpc/book3s64/radix/tlb: Determine hugepage flush correctly
  2020-05-13  4:30 ` Nicholas Piggin
@ 2020-05-18  6:34   ` Michael Ellerman
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2020-05-18  6:34 UTC (permalink / raw)
  To: Nicholas Piggin, Aneesh Kumar K.V, linuxppc-dev; +Cc: Bharata B Rao

Nicholas Piggin <npiggin@gmail.com> writes:
> Excerpts from Aneesh Kumar K.V's message of May 13, 2020 1:06 pm:
>> With a 64K page size flush with start and end value as below
>> (start, end) = (721f680d0000, 721f680e0000) results in
>> (hstart, hend) = (721f68200000, 721f68000000)
>> 
>> Avoid doing a __tlbie_va_range with the wrong hstart and hend value in this
>> case.
>> 
>> __tlbie_va_range will skip the actual tlbie operation for start > end.
>> But we still end up doing the tlbie fixup.
>
> Hm, good catch.
>
>> Reported-by: Bharata B Rao <bharata@linux.ibm.com>
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>> ---
>>  arch/powerpc/mm/book3s64/radix_tlb.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>> 
>> diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c
>> index 758ade2c2b6e..d592f9e1c037 100644
>> --- a/arch/powerpc/mm/book3s64/radix_tlb.c
>> +++ b/arch/powerpc/mm/book3s64/radix_tlb.c
>> @@ -884,10 +884,10 @@ static inline void __radix__flush_tlb_range(struct mm_struct *mm,
>>  		if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
>>  			hstart = (start + PMD_SIZE - 1) & PMD_MASK;
>>  			hend = end & PMD_MASK;
>> -			if (hstart == hend)
>> -				hflush = false;
>> -			else
>> +			if (hstart < hend)
>>  				hflush = true;
>> +			else
>> +				hflush = false;
>
> We can probably get rid of the else part since it is already false.

Yeah I can do that when applying.

cheers

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

* Re: [PATCH] powerpc/book3s64/radix/tlb: Determine hugepage flush correctly
  2020-05-13  3:06 [PATCH] powerpc/book3s64/radix/tlb: Determine hugepage flush correctly Aneesh Kumar K.V
  2020-05-13  4:30 ` Nicholas Piggin
@ 2020-06-09  5:28 ` Michael Ellerman
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2020-06-09  5:28 UTC (permalink / raw)
  To: linuxppc-dev, mpe, Aneesh Kumar K.V; +Cc: npiggin, Bharata B Rao

On Wed, 13 May 2020 08:36:16 +0530, Aneesh Kumar K.V wrote:
> With a 64K page size flush with start and end value as below
> (start, end) = (721f680d0000, 721f680e0000) results in
> (hstart, hend) = (721f68200000, 721f68000000)
> 
> Avoid doing a __tlbie_va_range with the wrong hstart and hend value in this
> case.
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc/book3s64/radix/tlb: Determine hugepage flush correctly
      https://git.kernel.org/powerpc/c/8f53f9c0f68ab2168f637494b9e24034899c1310

cheers

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

end of thread, other threads:[~2020-06-09  5:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-13  3:06 [PATCH] powerpc/book3s64/radix/tlb: Determine hugepage flush correctly Aneesh Kumar K.V
2020-05-13  4:30 ` Nicholas Piggin
2020-05-18  6:34   ` Michael Ellerman
2020-06-09  5:28 ` Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.