Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1659864 > unrolled thread

[PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v2

Started byjglisse@redhat.com
First post2017-06-07 16:50 +0200
Last post2017-06-07 20:20 +0200
Articles 6 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v2 jglisse@redhat.com - 2017-06-07 16:50 +0200
    Re: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not  freeing pud v2 Logan Gunthorpe <logang@deltatee.com> - 2017-06-07 18:20 +0200
    Re: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not  freeing pud v2 "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-06-07 19:10 +0200
      Re: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not  freeing pud v2 "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-06-07 19:10 +0200
        Re: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not  freeing pud v2 Jerome Glisse <jglisse@redhat.com> - 2017-06-07 19:40 +0200
          Re: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not  freeing pud v2 "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-06-07 20:20 +0200

#1659864 — [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v2

Fromjglisse@redhat.com
Date2017-06-07 16:50 +0200
Subject[PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v2
Message-ID<tPKrv-7Vi-5@gated-at.bofh.it>
From: Jérôme Glisse <jglisse@redhat.com>

With commit af2cf278ef4f we no longer free pud so that we do not
have synchronize all pgd on hotremove/vfree. But the new 5 level
page table patchset reverted that for 4 level page table.

This patch restore af2cf278ef4f and disable free_pud() if we are
in the 4 level page table case thus avoiding BUG_ON() after hot-
remove.

af2cf278ef4f x86/mm/hotplug: Don't remove PGD entries in remove_pagetable()

Changed since v1:
  - make free_pud() conditional on the number of page table
    level
  - improved commit message

Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Logan Gunthorpe <logang@deltatee.com>
> thus we now trigger a BUG_ON() l128 in sync_global_pgds()
>
> This patch remove free_pud() like in af2cf278ef4f
---
 arch/x86/mm/init_64.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 95651dc..61028bc 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -771,6 +771,16 @@ static void __meminit free_pmd_table(pmd_t *pmd_start, pud_t *pud)
 	spin_unlock(&init_mm.page_table_lock);
 }
 
+/*
+ * For 4 levels page table we do not want to free puds but for 5 levels
+ * we should free them. This code also need to change to adapt for boot
+ * time switching between 4 and 5 level.
+ */
+#if CONFIG_PGTABLE_LEVELS == 4
+static inline void free_pud_table(pud_t *pud_start, p4d_t *p4d)
+{
+}
+#else /* CONFIG_PGTABLE_LEVELS == 4 */
 static void __meminit free_pud_table(pud_t *pud_start, p4d_t *p4d)
 {
 	pud_t *pud;
@@ -788,6 +798,7 @@ static void __meminit free_pud_table(pud_t *pud_start, p4d_t *p4d)
 	p4d_clear(p4d);
 	spin_unlock(&init_mm.page_table_lock);
 }
+#endif /* CONFIG_PGTABLE_LEVELS == 4 */
 
 static void __meminit
 remove_pte_table(pte_t *pte_start, unsigned long addr, unsigned long end,
-- 
2.7.5

[toc] | [next] | [standalone]


#1659982 — Re: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v2

FromLogan Gunthorpe <logang@deltatee.com>
Date2017-06-07 18:20 +0200
SubjectRe: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v2
Message-ID<tPLQD-wa-49@gated-at.bofh.it>
In reply to#1659864
This patch still fixes my bug.

Tested-by: Logan Gunthorpe <logang@deltatee.com>

Thanks,

Logan

On 07/06/17 08:46 AM, jglisse@redhat.com wrote:
> From: Jérôme Glisse <jglisse@redhat.com>
> 
> With commit af2cf278ef4f we no longer free pud so that we do not
> have synchronize all pgd on hotremove/vfree. But the new 5 level
> page table patchset reverted that for 4 level page table.
> 
> This patch restore af2cf278ef4f and disable free_pud() if we are
> in the 4 level page table case thus avoiding BUG_ON() after hot-
> remove.
> 
> af2cf278ef4f x86/mm/hotplug: Don't remove PGD entries in remove_pagetable()
> 
> Changed since v1:
>   - make free_pud() conditional on the number of page table
>     level
>   - improved commit message
> 
> Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Logan Gunthorpe <logang@deltatee.com>
>> thus we now trigger a BUG_ON() l128 in sync_global_pgds()
>>
>> This patch remove free_pud() like in af2cf278ef4f
> ---
>  arch/x86/mm/init_64.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> index 95651dc..61028bc 100644
> --- a/arch/x86/mm/init_64.c
> +++ b/arch/x86/mm/init_64.c
> @@ -771,6 +771,16 @@ static void __meminit free_pmd_table(pmd_t *pmd_start, pud_t *pud)
>  	spin_unlock(&init_mm.page_table_lock);
>  }
>  
> +/*
> + * For 4 levels page table we do not want to free puds but for 5 levels
> + * we should free them. This code also need to change to adapt for boot
> + * time switching between 4 and 5 level.
> + */
> +#if CONFIG_PGTABLE_LEVELS == 4
> +static inline void free_pud_table(pud_t *pud_start, p4d_t *p4d)
> +{
> +}
> +#else /* CONFIG_PGTABLE_LEVELS == 4 */
>  static void __meminit free_pud_table(pud_t *pud_start, p4d_t *p4d)
>  {
>  	pud_t *pud;
> @@ -788,6 +798,7 @@ static void __meminit free_pud_table(pud_t *pud_start, p4d_t *p4d)
>  	p4d_clear(p4d);
>  	spin_unlock(&init_mm.page_table_lock);
>  }
> +#endif /* CONFIG_PGTABLE_LEVELS == 4 */
>  
>  static void __meminit
>  remove_pte_table(pte_t *pte_start, unsigned long addr, unsigned long end,
> 

[toc] | [prev] | [next] | [standalone]


#1660019 — Re: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v2

From"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Date2017-06-07 19:10 +0200
SubjectRe: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v2
Message-ID<tPMCZ-11z-1@gated-at.bofh.it>
In reply to#1659864
On Wed, Jun 07, 2017 at 10:46:20AM -0400, jglisse@redhat.com wrote:
> From: Jérôme Glisse <jglisse@redhat.com>
> 
> With commit af2cf278ef4f we no longer free pud so that we do not
> have synchronize all pgd on hotremove/vfree. But the new 5 level
> page table patchset reverted that for 4 level page table.
> 
> This patch restore af2cf278ef4f and disable free_pud() if we are
> in the 4 level page table case thus avoiding BUG_ON() after hot-
> remove.
> 
> af2cf278ef4f x86/mm/hotplug: Don't remove PGD entries in remove_pagetable()
> 
> Changed since v1:
>   - make free_pud() conditional on the number of page table
>     level
>   - improved commit message
> 
> Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Logan Gunthorpe <logang@deltatee.com>
> > thus we now trigger a BUG_ON() l128 in sync_global_pgds()
> >
> > This patch remove free_pud() like in af2cf278ef4f
> ---
>  arch/x86/mm/init_64.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> index 95651dc..61028bc 100644
> --- a/arch/x86/mm/init_64.c
> +++ b/arch/x86/mm/init_64.c
> @@ -771,6 +771,16 @@ static void __meminit free_pmd_table(pmd_t *pmd_start, pud_t *pud)
>  	spin_unlock(&init_mm.page_table_lock);
>  }
>  
> +/*
> + * For 4 levels page table we do not want to free puds but for 5 levels
> + * we should free them. This code also need to change to adapt for boot
> + * time switching between 4 and 5 level.
> + */
> +#if CONFIG_PGTABLE_LEVELS == 4
> +static inline void free_pud_table(pud_t *pud_start, p4d_t *p4d)
> +{
> +}

Just "if (CONFIG_PGTABLE_LEVELS > 4)" before calling free_pud_table(), but
okay -- I'll rework it anyway for boot-time switching.

-- 
 Kirill A. Shutemov

[toc] | [prev] | [next] | [standalone]


#1660021 — Re: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v2

From"Kirill A. Shutemov" <kirill@shutemov.name>
Date2017-06-07 19:10 +0200
SubjectRe: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v2
Message-ID<tPMD0-11z-13@gated-at.bofh.it>
In reply to#1660019
On Wed, Jun 07, 2017 at 08:03:25PM +0300, Kirill A. Shutemov wrote:
> On Wed, Jun 07, 2017 at 10:46:20AM -0400, jglisse@redhat.com wrote:
> > From: Jérôme Glisse <jglisse@redhat.com>
> > 
> > With commit af2cf278ef4f we no longer free pud so that we do not
> > have synchronize all pgd on hotremove/vfree. But the new 5 level
> > page table patchset reverted that for 4 level page table.
> > 
> > This patch restore af2cf278ef4f and disable free_pud() if we are
> > in the 4 level page table case thus avoiding BUG_ON() after hot-
> > remove.
> > 
> > af2cf278ef4f x86/mm/hotplug: Don't remove PGD entries in remove_pagetable()
> > 
> > Changed since v1:
> >   - make free_pud() conditional on the number of page table
> >     level
> >   - improved commit message
> > 
> > Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
> > Cc: Andy Lutomirski <luto@kernel.org>
> > Cc: Ingo Molnar <mingo@kernel.org>
> > Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > Cc: Logan Gunthorpe <logang@deltatee.com>
> > > thus we now trigger a BUG_ON() l128 in sync_global_pgds()
> > >
> > > This patch remove free_pud() like in af2cf278ef4f
> > ---
> >  arch/x86/mm/init_64.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> > index 95651dc..61028bc 100644
> > --- a/arch/x86/mm/init_64.c
> > +++ b/arch/x86/mm/init_64.c
> > @@ -771,6 +771,16 @@ static void __meminit free_pmd_table(pmd_t *pmd_start, pud_t *pud)
> >  	spin_unlock(&init_mm.page_table_lock);
> >  }
> >  
> > +/*
> > + * For 4 levels page table we do not want to free puds but for 5 levels
> > + * we should free them. This code also need to change to adapt for boot
> > + * time switching between 4 and 5 level.
> > + */
> > +#if CONFIG_PGTABLE_LEVELS == 4
> > +static inline void free_pud_table(pud_t *pud_start, p4d_t *p4d)
> > +{
> > +}
> 
> Just "if (CONFIG_PGTABLE_LEVELS > 4)" before calling free_pud_table(), but
> okay -- I'll rework it anyway for boot-time switching.

Err. "if (CONFIG_PGTABLE_LEVELS == 4)" obviously.

-- 
 Kirill A. Shutemov

[toc] | [prev] | [next] | [standalone]


#1660040 — Re: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v2

FromJerome Glisse <jglisse@redhat.com>
Date2017-06-07 19:40 +0200
SubjectRe: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v2
Message-ID<tPN61-1bu-7@gated-at.bofh.it>
In reply to#1660021
> On Wed, Jun 07, 2017 at 08:03:25PM +0300, Kirill A. Shutemov wrote:
> > On Wed, Jun 07, 2017 at 10:46:20AM -0400, jglisse@redhat.com wrote:
> > > From: Jérôme Glisse <jglisse@redhat.com>
> > > 
> > > With commit af2cf278ef4f we no longer free pud so that we do not
> > > have synchronize all pgd on hotremove/vfree. But the new 5 level
> > > page table patchset reverted that for 4 level page table.
> > > 
> > > This patch restore af2cf278ef4f and disable free_pud() if we are
> > > in the 4 level page table case thus avoiding BUG_ON() after hot-
> > > remove.
> > > 
> > > af2cf278ef4f x86/mm/hotplug: Don't remove PGD entries in
> > > remove_pagetable()
> > > 
> > > Changed since v1:
> > >   - make free_pud() conditional on the number of page table
> > >     level
> > >   - improved commit message
> > > 
> > > Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
> > > Cc: Andy Lutomirski <luto@kernel.org>
> > > Cc: Ingo Molnar <mingo@kernel.org>
> > > Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > > Cc: Logan Gunthorpe <logang@deltatee.com>
> > > > thus we now trigger a BUG_ON() l128 in sync_global_pgds()
> > > >
> > > > This patch remove free_pud() like in af2cf278ef4f
> > > ---
> > >  arch/x86/mm/init_64.c | 11 +++++++++++
> > >  1 file changed, 11 insertions(+)
> > > 
> > > diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> > > index 95651dc..61028bc 100644
> > > --- a/arch/x86/mm/init_64.c
> > > +++ b/arch/x86/mm/init_64.c
> > > @@ -771,6 +771,16 @@ static void __meminit free_pmd_table(pmd_t
> > > *pmd_start, pud_t *pud)
> > >  	spin_unlock(&init_mm.page_table_lock);
> > >  }
> > >  
> > > +/*
> > > + * For 4 levels page table we do not want to free puds but for 5 levels
> > > + * we should free them. This code also need to change to adapt for boot
> > > + * time switching between 4 and 5 level.
> > > + */
> > > +#if CONFIG_PGTABLE_LEVELS == 4
> > > +static inline void free_pud_table(pud_t *pud_start, p4d_t *p4d)
> > > +{
> > > +}
> > 
> > Just "if (CONFIG_PGTABLE_LEVELS > 4)" before calling free_pud_table(), but
> > okay -- I'll rework it anyway for boot-time switching.
> 
> Err. "if (CONFIG_PGTABLE_LEVELS == 4)" obviously.

You want me to respawn a v3 or is that good enough until you finish
boot time 5 level page table ?

Cheers,
Jérôme

[toc] | [prev] | [next] | [standalone]


#1660057 — Re: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v2

From"Kirill A. Shutemov" <kirill@shutemov.name>
Date2017-06-07 20:20 +0200
SubjectRe: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v2
Message-ID<tPNIJ-1Ge-9@gated-at.bofh.it>
In reply to#1660040
On Wed, Jun 07, 2017 at 01:38:00PM -0400, Jerome Glisse wrote:
> > On Wed, Jun 07, 2017 at 08:03:25PM +0300, Kirill A. Shutemov wrote:
> > > On Wed, Jun 07, 2017 at 10:46:20AM -0400, jglisse@redhat.com wrote:
> > > > From: Jérôme Glisse <jglisse@redhat.com>
> > > > 
> > > > With commit af2cf278ef4f we no longer free pud so that we do not
> > > > have synchronize all pgd on hotremove/vfree. But the new 5 level
> > > > page table patchset reverted that for 4 level page table.
> > > > 
> > > > This patch restore af2cf278ef4f and disable free_pud() if we are
> > > > in the 4 level page table case thus avoiding BUG_ON() after hot-
> > > > remove.
> > > > 
> > > > af2cf278ef4f x86/mm/hotplug: Don't remove PGD entries in
> > > > remove_pagetable()
> > > > 
> > > > Changed since v1:
> > > >   - make free_pud() conditional on the number of page table
> > > >     level
> > > >   - improved commit message
> > > > 
> > > > Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
> > > > Cc: Andy Lutomirski <luto@kernel.org>
> > > > Cc: Ingo Molnar <mingo@kernel.org>
> > > > Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > > > Cc: Logan Gunthorpe <logang@deltatee.com>
> > > > > thus we now trigger a BUG_ON() l128 in sync_global_pgds()
> > > > >
> > > > > This patch remove free_pud() like in af2cf278ef4f
> > > > ---
> > > >  arch/x86/mm/init_64.c | 11 +++++++++++
> > > >  1 file changed, 11 insertions(+)
> > > > 
> > > > diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> > > > index 95651dc..61028bc 100644
> > > > --- a/arch/x86/mm/init_64.c
> > > > +++ b/arch/x86/mm/init_64.c
> > > > @@ -771,6 +771,16 @@ static void __meminit free_pmd_table(pmd_t
> > > > *pmd_start, pud_t *pud)
> > > >  	spin_unlock(&init_mm.page_table_lock);
> > > >  }
> > > >  
> > > > +/*
> > > > + * For 4 levels page table we do not want to free puds but for 5 levels
> > > > + * we should free them. This code also need to change to adapt for boot
> > > > + * time switching between 4 and 5 level.
> > > > + */
> > > > +#if CONFIG_PGTABLE_LEVELS == 4
> > > > +static inline void free_pud_table(pud_t *pud_start, p4d_t *p4d)
> > > > +{
> > > > +}
> > > 
> > > Just "if (CONFIG_PGTABLE_LEVELS > 4)" before calling free_pud_table(), but
> > > okay -- I'll rework it anyway for boot-time switching.
> > 
> > Err. "if (CONFIG_PGTABLE_LEVELS == 4)" obviously.
> 
> You want me to respawn a v3 or is that good enough until you finish
> boot time 5 level page table ?

It doesn't matter for me. Upto Ingo.

-- 
 Kirill A. Shutemov

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web