diff mbox series

[v4,27/36] x86: Implement the new page table range API

Message ID 20230315051444.3229621-28-willy@infradead.org (mailing list archive)
State New
Headers show
Series New page table range API | expand

Commit Message

Matthew Wilcox March 15, 2023, 5:14 a.m. UTC
Add PFN_PTE_SHIFT and a noop update_mmu_cache_range().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
---
 arch/x86/include/asm/pgtable.h | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Mike Rapoport March 15, 2023, 10:12 a.m. UTC | #1
On Wed, Mar 15, 2023 at 05:14:35AM +0000, Matthew Wilcox (Oracle) wrote:
> Add PFN_PTE_SHIFT and a noop update_mmu_cache_range().
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: x86@kernel.org
> Cc: "H. Peter Anvin" <hpa@zytor.com>

Acked-by: Mike Rapoport (IBM) <rppt@kernel.org>

> ---
>  arch/x86/include/asm/pgtable.h | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
> index 1031025730d0..b237878061c4 100644
> --- a/arch/x86/include/asm/pgtable.h
> +++ b/arch/x86/include/asm/pgtable.h
> @@ -184,6 +184,8 @@ static inline int pte_special(pte_t pte)
>  
>  static inline u64 protnone_mask(u64 val);
>  
> +#define PFN_PTE_SHIFT	PAGE_SHIFT
> +
>  static inline unsigned long pte_pfn(pte_t pte)
>  {
>  	phys_addr_t pfn = pte_val(pte);
> @@ -1019,13 +1021,6 @@ static inline pud_t native_local_pudp_get_and_clear(pud_t *pudp)
>  	return res;
>  }
>  
> -static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
> -			      pte_t *ptep, pte_t pte)
> -{
> -	page_table_check_ptes_set(mm, addr, ptep, pte, 1);
> -	set_pte(ptep, pte);
> -}
> -
>  static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
>  			      pmd_t *pmdp, pmd_t pmd)
>  {
> @@ -1291,6 +1286,10 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
>  		unsigned long addr, pte_t *ptep)
>  {
>  }
> +static inline void update_mmu_cache_range(struct vm_area_struct *vma,
> +		unsigned long addr, pte_t *ptep, unsigned int nr)
> +{
> +}
>  static inline void update_mmu_cache_pmd(struct vm_area_struct *vma,
>  		unsigned long addr, pmd_t *pmd)
>  {
> -- 
> 2.39.2
> 
>
Peter Zijlstra March 15, 2023, 10:34 a.m. UTC | #2
On Wed, Mar 15, 2023 at 05:14:35AM +0000, Matthew Wilcox (Oracle) wrote:
> Add PFN_PTE_SHIFT and a noop update_mmu_cache_range().
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: x86@kernel.org
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> ---
>  arch/x86/include/asm/pgtable.h | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
> index 1031025730d0..b237878061c4 100644
> --- a/arch/x86/include/asm/pgtable.h
> +++ b/arch/x86/include/asm/pgtable.h
> @@ -184,6 +184,8 @@ static inline int pte_special(pte_t pte)
>  
>  static inline u64 protnone_mask(u64 val);
>  
> +#define PFN_PTE_SHIFT	PAGE_SHIFT
> +
>  static inline unsigned long pte_pfn(pte_t pte)
>  {
>  	phys_addr_t pfn = pte_val(pte);
> @@ -1019,13 +1021,6 @@ static inline pud_t native_local_pudp_get_and_clear(pud_t *pudp)
>  	return res;
>  }
>  
> -static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
> -			      pte_t *ptep, pte_t pte)
> -{
> -	page_table_check_ptes_set(mm, addr, ptep, pte, 1);
> -	set_pte(ptep, pte);
> -}
> -

And remove set_pte_at() apparently.. whut?!?

>  static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
>  			      pmd_t *pmdp, pmd_t pmd)
>  {
> @@ -1291,6 +1286,10 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
>  		unsigned long addr, pte_t *ptep)
>  {
>  }
> +static inline void update_mmu_cache_range(struct vm_area_struct *vma,
> +		unsigned long addr, pte_t *ptep, unsigned int nr)
> +{
> +}
>  static inline void update_mmu_cache_pmd(struct vm_area_struct *vma,
>  		unsigned long addr, pmd_t *pmd)
>  {
> -- 
> 2.39.2
>
Mike Rapoport March 15, 2023, 11:16 a.m. UTC | #3
On Wed, Mar 15, 2023 at 11:34:36AM +0100, Peter Zijlstra wrote:
> On Wed, Mar 15, 2023 at 05:14:35AM +0000, Matthew Wilcox (Oracle) wrote:
> > Add PFN_PTE_SHIFT and a noop update_mmu_cache_range().
> > 
> > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Cc: Borislav Petkov <bp@alien8.de>
> > Cc: Dave Hansen <dave.hansen@linux.intel.com>
> > Cc: x86@kernel.org
> > Cc: "H. Peter Anvin" <hpa@zytor.com>
> > ---
> >  arch/x86/include/asm/pgtable.h | 13 ++++++-------
> >  1 file changed, 6 insertions(+), 7 deletions(-)
> > 
> > diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
> > index 1031025730d0..b237878061c4 100644
> > --- a/arch/x86/include/asm/pgtable.h
> > +++ b/arch/x86/include/asm/pgtable.h
> > @@ -184,6 +184,8 @@ static inline int pte_special(pte_t pte)
> >  
> >  static inline u64 protnone_mask(u64 val);
> >  
> > +#define PFN_PTE_SHIFT	PAGE_SHIFT
> > +
> >  static inline unsigned long pte_pfn(pte_t pte)
> >  {
> >  	phys_addr_t pfn = pte_val(pte);
> > @@ -1019,13 +1021,6 @@ static inline pud_t native_local_pudp_get_and_clear(pud_t *pudp)
> >  	return res;
> >  }
> >  
> > -static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
> > -			      pte_t *ptep, pte_t pte)
> > -{
> > -	page_table_check_ptes_set(mm, addr, ptep, pte, 1);
> > -	set_pte(ptep, pte);
> > -}
> > -
> 
> And remove set_pte_at() apparently.. whut?!?

It's now in include/linux/pgtable.h
 
> >  static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
> >  			      pmd_t *pmdp, pmd_t pmd)
> >  {
> > @@ -1291,6 +1286,10 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
> >  		unsigned long addr, pte_t *ptep)
> >  {
> >  }
> > +static inline void update_mmu_cache_range(struct vm_area_struct *vma,
> > +		unsigned long addr, pte_t *ptep, unsigned int nr)
> > +{
> > +}
> >  static inline void update_mmu_cache_pmd(struct vm_area_struct *vma,
> >  		unsigned long addr, pmd_t *pmd)
> >  {
> > -- 
> > 2.39.2
> > 
>
Peter Zijlstra March 15, 2023, 11:19 a.m. UTC | #4
On Wed, Mar 15, 2023 at 01:16:24PM +0200, Mike Rapoport wrote:
> On Wed, Mar 15, 2023 at 11:34:36AM +0100, Peter Zijlstra wrote:
> > On Wed, Mar 15, 2023 at 05:14:35AM +0000, Matthew Wilcox (Oracle) wrote:
> > > Add PFN_PTE_SHIFT and a noop update_mmu_cache_range().
> > > 
> > > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> > > Cc: Thomas Gleixner <tglx@linutronix.de>
> > > Cc: Ingo Molnar <mingo@redhat.com>
> > > Cc: Borislav Petkov <bp@alien8.de>
> > > Cc: Dave Hansen <dave.hansen@linux.intel.com>
> > > Cc: x86@kernel.org
> > > Cc: "H. Peter Anvin" <hpa@zytor.com>
> > > ---
> > >  arch/x86/include/asm/pgtable.h | 13 ++++++-------
> > >  1 file changed, 6 insertions(+), 7 deletions(-)
> > > 
> > > diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
> > > index 1031025730d0..b237878061c4 100644
> > > --- a/arch/x86/include/asm/pgtable.h
> > > +++ b/arch/x86/include/asm/pgtable.h
> > > @@ -184,6 +184,8 @@ static inline int pte_special(pte_t pte)
> > >  
> > >  static inline u64 protnone_mask(u64 val);
> > >  
> > > +#define PFN_PTE_SHIFT	PAGE_SHIFT
> > > +
> > >  static inline unsigned long pte_pfn(pte_t pte)
> > >  {
> > >  	phys_addr_t pfn = pte_val(pte);
> > > @@ -1019,13 +1021,6 @@ static inline pud_t native_local_pudp_get_and_clear(pud_t *pudp)
> > >  	return res;
> > >  }
> > >  
> > > -static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
> > > -			      pte_t *ptep, pte_t pte)
> > > -{
> > > -	page_table_check_ptes_set(mm, addr, ptep, pte, 1);
> > > -	set_pte(ptep, pte);
> > > -}
> > > -
> > 
> > And remove set_pte_at() apparently.. whut?!?
> 
> It's now in include/linux/pgtable.h

All I have is this one patch -- and the changelog doesn't mention this.
HTF am I supposed to know that?
Matthew Wilcox March 15, 2023, 4:12 p.m. UTC | #5
On Wed, Mar 15, 2023 at 12:19:41PM +0100, Peter Zijlstra wrote:
> On Wed, Mar 15, 2023 at 01:16:24PM +0200, Mike Rapoport wrote:
> > On Wed, Mar 15, 2023 at 11:34:36AM +0100, Peter Zijlstra wrote:
> > > On Wed, Mar 15, 2023 at 05:14:35AM +0000, Matthew Wilcox (Oracle) wrote:
> > > > Add PFN_PTE_SHIFT and a noop update_mmu_cache_range().
> > > > 
> > > > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> > > > Cc: Thomas Gleixner <tglx@linutronix.de>
> > > > Cc: Ingo Molnar <mingo@redhat.com>
> > > > Cc: Borislav Petkov <bp@alien8.de>
> > > > Cc: Dave Hansen <dave.hansen@linux.intel.com>
> > > > Cc: x86@kernel.org
> > > > Cc: "H. Peter Anvin" <hpa@zytor.com>
> > > > ---
> > > >  arch/x86/include/asm/pgtable.h | 13 ++++++-------
> > > >  1 file changed, 6 insertions(+), 7 deletions(-)
> > > > 
> > > > diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
> > > > index 1031025730d0..b237878061c4 100644
> > > > --- a/arch/x86/include/asm/pgtable.h
> > > > +++ b/arch/x86/include/asm/pgtable.h
> > > > @@ -184,6 +184,8 @@ static inline int pte_special(pte_t pte)
> > > >  
> > > >  static inline u64 protnone_mask(u64 val);
> > > >  
> > > > +#define PFN_PTE_SHIFT	PAGE_SHIFT
> > > > +
> > > >  static inline unsigned long pte_pfn(pte_t pte)
> > > >  {
> > > >  	phys_addr_t pfn = pte_val(pte);
> > > > @@ -1019,13 +1021,6 @@ static inline pud_t native_local_pudp_get_and_clear(pud_t *pudp)
> > > >  	return res;
> > > >  }
> > > >  
> > > > -static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
> > > > -			      pte_t *ptep, pte_t pte)
> > > > -{
> > > > -	page_table_check_ptes_set(mm, addr, ptep, pte, 1);
> > > > -	set_pte(ptep, pte);
> > > > -}
> > > > -
> > > 
> > > And remove set_pte_at() apparently.. whut?!?
> > 
> > It's now in include/linux/pgtable.h
> 
> All I have is this one patch -- and the changelog doesn't mention this.
> HTF am I supposed to know that?

You should be subscribed to linux-arch.  I literally can't cc all arch
maintainers on every patch; many of the mailing lists will reject the
emails based on "too many recipients".  That's what linux-arch is _for_.
diff mbox series

Patch

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 1031025730d0..b237878061c4 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -184,6 +184,8 @@  static inline int pte_special(pte_t pte)
 
 static inline u64 protnone_mask(u64 val);
 
+#define PFN_PTE_SHIFT	PAGE_SHIFT
+
 static inline unsigned long pte_pfn(pte_t pte)
 {
 	phys_addr_t pfn = pte_val(pte);
@@ -1019,13 +1021,6 @@  static inline pud_t native_local_pudp_get_and_clear(pud_t *pudp)
 	return res;
 }
 
-static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
-			      pte_t *ptep, pte_t pte)
-{
-	page_table_check_ptes_set(mm, addr, ptep, pte, 1);
-	set_pte(ptep, pte);
-}
-
 static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
 			      pmd_t *pmdp, pmd_t pmd)
 {
@@ -1291,6 +1286,10 @@  static inline void update_mmu_cache(struct vm_area_struct *vma,
 		unsigned long addr, pte_t *ptep)
 {
 }
+static inline void update_mmu_cache_range(struct vm_area_struct *vma,
+		unsigned long addr, pte_t *ptep, unsigned int nr)
+{
+}
 static inline void update_mmu_cache_pmd(struct vm_area_struct *vma,
 		unsigned long addr, pmd_t *pmd)
 {