Re: [PATCH] powerpc/book3s64/radix/tlb: Determine hugepage flush correctly

2020-06-08 Thread Michael Ellerman
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) = (721f680d, 721f680e) results in
> (hstart, hend) = (721f6820, 721f6800)
> 
> 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


Re: [PATCH] powerpc/book3s64/radix/tlb: Determine hugepage flush correctly

2020-05-18 Thread Michael Ellerman
Nicholas Piggin  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) = (721f680d, 721f680e) results in
>> (hstart, hend) = (721f6820, 721f6800)
>> 
>> 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 
>> Signed-off-by: Aneesh Kumar K.V 
>> ---
>>  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


Re: [PATCH] powerpc/book3s64/radix/tlb: Determine hugepage flush correctly

2020-05-12 Thread Nicholas Piggin
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) = (721f680d, 721f680e) results in
> (hstart, hend) = (721f6820, 721f6800)
> 
> 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 
> Signed-off-by: Aneesh Kumar K.V 
> ---
>  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 



[PATCH] powerpc/book3s64/radix/tlb: Determine hugepage flush correctly

2020-05-12 Thread Aneesh Kumar K.V
With a 64K page size flush with start and end value as below
(start, end) = (721f680d, 721f680e) results in
(hstart, hend) = (721f6820, 721f6800)

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 
Signed-off-by: Aneesh Kumar K.V 
---
 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