linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Benjamin Gray <bgray@linux.ibm.com>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Cc: "jniethe5@gmail.com" <jniethe5@gmail.com>,
	"cmr@bluescreens.de" <cmr@bluescreens.de>,
	"ajd@linux.ibm.com" <ajd@linux.ibm.com>,
	"npiggin@gmail.com" <npiggin@gmail.com>
Subject: Re: [PATCH v10 7/9] powerpc/tlb: Add local flush for page given mm_struct and psize
Date: Wed, 9 Nov 2022 06:18:51 +0000	[thread overview]
Message-ID: <e3e8a201-a2be-e21e-304d-5934e90e40a4@csgroup.eu> (raw)
In-Reply-To: <20221109045112.187069-8-bgray@linux.ibm.com>



Le 09/11/2022 à 05:51, Benjamin Gray a écrit :
> Adds a local TLB flush operation that works given an mm_struct, VA to
> flush, and page size representation. Most implementations mirror the
> surrounding code. The book3s/32/tlbflush.h implementation is left as
> a BUILD_BUG because it is more complicated and not required for
> anything as yet.
> 
> This removes the need to create a vm_area_struct, which the temporary
> patching mm work does not need.
> 
> Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>

Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>

> ---
> v10:	* Change warning to BUILD_BUG
> v9:	* Replace book3s/32/tlbflush.h implementation with warning
> ---
>   arch/powerpc/include/asm/book3s/32/tlbflush.h | 9 +++++++++
>   arch/powerpc/include/asm/book3s/64/tlbflush.h | 7 +++++++
>   arch/powerpc/include/asm/nohash/tlbflush.h    | 7 +++++++
>   arch/powerpc/mm/nohash/tlb.c                  | 8 ++++++++
>   4 files changed, 31 insertions(+)
> 
> diff --git a/arch/powerpc/include/asm/book3s/32/tlbflush.h b/arch/powerpc/include/asm/book3s/32/tlbflush.h
> index ba1743c52b56..4be572908124 100644
> --- a/arch/powerpc/include/asm/book3s/32/tlbflush.h
> +++ b/arch/powerpc/include/asm/book3s/32/tlbflush.h
> @@ -2,6 +2,8 @@
>   #ifndef _ASM_POWERPC_BOOK3S_32_TLBFLUSH_H
>   #define _ASM_POWERPC_BOOK3S_32_TLBFLUSH_H
>   
> +#include <linux/build_bug.h>
> +
>   #define MMU_NO_CONTEXT      (0)
>   /*
>    * TLB flushing for "classic" hash-MMU 32-bit CPUs, 6xx, 7xx, 7xxx
> @@ -74,6 +76,13 @@ static inline void local_flush_tlb_page(struct vm_area_struct *vma,
>   {
>   	flush_tlb_page(vma, vmaddr);
>   }
> +
> +static inline void local_flush_tlb_page_psize(struct mm_struct *mm,
> +					      unsigned long vmaddr, int psize)
> +{
> +	BUILD_BUG();
> +}
> +
>   static inline void local_flush_tlb_mm(struct mm_struct *mm)
>   {
>   	flush_tlb_mm(mm);
> diff --git a/arch/powerpc/include/asm/book3s/64/tlbflush.h b/arch/powerpc/include/asm/book3s/64/tlbflush.h
> index c56a0aee8124..dd39313242b4 100644
> --- a/arch/powerpc/include/asm/book3s/64/tlbflush.h
> +++ b/arch/powerpc/include/asm/book3s/64/tlbflush.h
> @@ -86,6 +86,13 @@ static inline void local_flush_tlb_page(struct vm_area_struct *vma,
>   		radix__local_flush_tlb_page(vma, vmaddr);
>   }
>   
> +static inline void local_flush_tlb_page_psize(struct mm_struct *mm,
> +					      unsigned long vmaddr, int psize)
> +{
> +	if (radix_enabled())
> +		radix__local_flush_tlb_page_psize(mm, vmaddr, psize);
> +}
> +
>   static inline void tlb_flush(struct mmu_gather *tlb)
>   {
>   	if (radix_enabled())
> diff --git a/arch/powerpc/include/asm/nohash/tlbflush.h b/arch/powerpc/include/asm/nohash/tlbflush.h
> index 0cef5e4f8d92..d98de9e3896f 100644
> --- a/arch/powerpc/include/asm/nohash/tlbflush.h
> +++ b/arch/powerpc/include/asm/nohash/tlbflush.h
> @@ -44,6 +44,12 @@ static inline void local_flush_tlb_page(struct vm_area_struct *vma, unsigned lon
>   	asm volatile ("tlbie %0; sync" : : "r" (vmaddr) : "memory");
>   }
>   
> +static inline void local_flush_tlb_page_psize(struct mm_struct *mm,
> +					      unsigned long vmaddr, int psize)
> +{
> +	asm volatile ("tlbie %0; sync" : : "r" (vmaddr) : "memory");
> +}
> +
>   static inline void flush_tlb_kernel_range(unsigned long start, unsigned long end)
>   {
>   	start &= PAGE_MASK;
> @@ -57,6 +63,7 @@ static inline void flush_tlb_kernel_range(unsigned long start, unsigned long end
>   void flush_tlb_kernel_range(unsigned long start, unsigned long end);
>   void local_flush_tlb_mm(struct mm_struct *mm);
>   void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
> +void local_flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr, int psize);
>   
>   void __local_flush_tlb_page(struct mm_struct *mm, unsigned long vmaddr,
>   			    int tsize, int ind);
> diff --git a/arch/powerpc/mm/nohash/tlb.c b/arch/powerpc/mm/nohash/tlb.c
> index 2c15c86c7015..a903b308acc5 100644
> --- a/arch/powerpc/mm/nohash/tlb.c
> +++ b/arch/powerpc/mm/nohash/tlb.c
> @@ -184,6 +184,14 @@ void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
>   			       mmu_get_tsize(mmu_virtual_psize), 0);
>   }
>   EXPORT_SYMBOL(local_flush_tlb_page);
> +
> +void local_flush_tlb_page_psize(struct mm_struct *mm,
> +				unsigned long vmaddr, int psize)
> +{
> +	__local_flush_tlb_page(mm, vmaddr, mmu_get_tsize(psize), 0);
> +}
> +EXPORT_SYMBOL(local_flush_tlb_page_psize);
> +
>   #endif
>   
>   /*

  reply	other threads:[~2022-11-09  6:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09  4:51 [PATCH v10 0/9] powerpc/code-patching: Use temporary mm for Radix MMU Benjamin Gray
2022-11-09  4:51 ` [PATCH v10 1/9] powerpc: Allow clearing and restoring registers independent of saved breakpoint state Benjamin Gray
2022-11-09  4:51 ` [PATCH v10 2/9] powerpc/code-patching: Use WARN_ON and fix check in poking_init Benjamin Gray
2022-11-09  6:12   ` Christophe Leroy
2022-11-09  4:51 ` [PATCH v10 3/9] powerpc/mm: Remove extern from function prototypes Benjamin Gray
2022-11-09  6:16   ` Christophe Leroy
2022-11-25  3:12   ` Andrew Donnellan
2022-11-09  4:51 ` [PATCH v10 4/9] powerpc/mm: Remove empty hash__ functions Benjamin Gray
2022-11-09  6:16   ` Christophe Leroy
2022-11-09  4:51 ` [PATCH v10 5/9] cxl: Use radix__flush_all_mm instead of generic flush_all_mm Benjamin Gray
2022-11-09  6:16   ` Christophe Leroy
2022-11-25  2:42   ` Andrew Donnellan
2022-11-09  4:51 ` [PATCH v10 6/9] powerpc/mm: Remove flush_all_mm, local_flush_all_mm Benjamin Gray
2022-11-09  6:17   ` Christophe Leroy
2022-11-09  4:51 ` [PATCH v10 7/9] powerpc/tlb: Add local flush for page given mm_struct and psize Benjamin Gray
2022-11-09  6:18   ` Christophe Leroy [this message]
2022-11-09  4:51 ` [PATCH v10 8/9] powerpc/code-patching: Use temporary mm for Radix MMU Benjamin Gray
2022-12-15 20:17   ` Nathan Chancellor
2022-12-16  0:23     ` Michael Ellerman
2022-11-09  4:51 ` [PATCH v10 9/9] powerpc/code-patching: Consolidate and cache per-cpu patching context Benjamin Gray
2022-11-09  6:23   ` Christophe Leroy
2022-12-08 12:39 ` [PATCH v10 0/9] powerpc/code-patching: Use temporary mm for Radix MMU Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e3e8a201-a2be-e21e-304d-5934e90e40a4@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=ajd@linux.ibm.com \
    --cc=bgray@linux.ibm.com \
    --cc=cmr@bluescreens.de \
    --cc=jniethe5@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=npiggin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).