linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] powerpc/32s: Don't flush all TLBs when flushing one page
@ 2020-02-01  8:04 Christophe Leroy
  2020-02-01 16:27 ` Christophe Leroy
  2020-03-06  0:27 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe Leroy @ 2020-02-01  8:04 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: linux-kernel, linuxppc-dev

When flushing any memory range, the flushing function
flushes all TLBs.

When (start) and (end - 1) are in the same memory page,
flush that page instead.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
v2: Reworked the test as the previous one was always false (end - start was PAGE_SIZE - 1 for a single page)
---
 arch/powerpc/mm/book3s32/tlb.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/mm/book3s32/tlb.c b/arch/powerpc/mm/book3s32/tlb.c
index 2fcd321040ff..724c0490fb17 100644
--- a/arch/powerpc/mm/book3s32/tlb.c
+++ b/arch/powerpc/mm/book3s32/tlb.c
@@ -79,11 +79,14 @@ static void flush_range(struct mm_struct *mm, unsigned long start,
 	int count;
 	unsigned int ctx = mm->context.id;
 
+	start &= PAGE_MASK;
 	if (!Hash) {
-		_tlbia();
+		if (end - start <= PAGE_SIZE)
+			_tlbie(start);
+		else
+			_tlbia();
 		return;
 	}
-	start &= PAGE_MASK;
 	if (start >= end)
 		return;
 	end = (end - 1) | ~PAGE_MASK;
-- 
2.25.0


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

* Re: [PATCH v2] powerpc/32s: Don't flush all TLBs when flushing one page
  2020-02-01  8:04 [PATCH v2] powerpc/32s: Don't flush all TLBs when flushing one page Christophe Leroy
@ 2020-02-01 16:27 ` Christophe Leroy
  2020-03-06  0:27 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Christophe Leroy @ 2020-02-01 16:27 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: linuxppc-dev, linux-kernel



Le 01/02/2020 à 09:04, Christophe Leroy a écrit :
> When flushing any memory range, the flushing function
> flushes all TLBs.
> 
> When (start) and (end - 1) are in the same memory page,
> flush that page instead.
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>

Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>

> ---
> v2: Reworked the test as the previous one was always false (end - start was PAGE_SIZE - 1 for a single page)
> ---
>   arch/powerpc/mm/book3s32/tlb.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/mm/book3s32/tlb.c b/arch/powerpc/mm/book3s32/tlb.c
> index 2fcd321040ff..724c0490fb17 100644
> --- a/arch/powerpc/mm/book3s32/tlb.c
> +++ b/arch/powerpc/mm/book3s32/tlb.c
> @@ -79,11 +79,14 @@ static void flush_range(struct mm_struct *mm, unsigned long start,
>   	int count;
>   	unsigned int ctx = mm->context.id;
>   
> +	start &= PAGE_MASK;
>   	if (!Hash) {
> -		_tlbia();
> +		if (end - start <= PAGE_SIZE)
> +			_tlbie(start);
> +		else
> +			_tlbia();
>   		return;
>   	}
> -	start &= PAGE_MASK;
>   	if (start >= end)
>   		return;
>   	end = (end - 1) | ~PAGE_MASK;
> 

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

* Re: [PATCH v2] powerpc/32s: Don't flush all TLBs when flushing one page
  2020-02-01  8:04 [PATCH v2] powerpc/32s: Don't flush all TLBs when flushing one page Christophe Leroy
  2020-02-01 16:27 ` Christophe Leroy
@ 2020-03-06  0:27 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2020-03-06  0:27 UTC (permalink / raw)
  To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras
  Cc: linuxppc-dev, linux-kernel

On Sat, 2020-02-01 at 08:04:31 UTC, Christophe Leroy wrote:
> When flushing any memory range, the flushing function
> flushes all TLBs.
> 
> When (start) and (end - 1) are in the same memory page,
> flush that page instead.
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/030e347430957f6f7f29db9099368f8b86c0bf76

cheers

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

end of thread, other threads:[~2020-03-06  0:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-01  8:04 [PATCH v2] powerpc/32s: Don't flush all TLBs when flushing one page Christophe Leroy
2020-02-01 16:27 ` Christophe Leroy
2020-03-06  0:27 ` Michael Ellerman

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).