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


Groups > linux.kernel > #1674117 > unrolled thread

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

Started byjglisse@redhat.com
First post2017-06-24 20:10 +0200
Last post2017-06-27 09:30 +0200
Articles 4 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v3 jglisse@redhat.com - 2017-06-24 20:10 +0200
    Re: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not  freeing pud v3 Ingo Molnar <mingo@kernel.org> - 2017-06-26 11:50 +0200
      Re: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not  freeing pud v3 Jerome Glisse <jglisse@redhat.com> - 2017-06-26 16:50 +0200
    [tip:x86/urgent] x86/mm/hotplug: Fix BUG_ON() after hot-remove by  not freeing PUD "tip-bot for Jérôme Glisse" <tipbot@zytor.com> - 2017-06-27 09:30 +0200

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

Fromjglisse@redhat.com
Date2017-06-24 20:10 +0200
Subject[PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v3
Message-ID<tVXFo-2HS-15@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 v2:
  - nove to if the callsite instead of having special version of
    free_pud for 4 level page table
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>
Reviwed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Logan Gunthorpe <logang@deltatee.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
 arch/x86/mm/init_64.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 95651dc58e09..dc4c99f9ca58 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -990,7 +990,13 @@ remove_p4d_table(p4d_t *p4d_start, unsigned long addr, unsigned long end,
 
 		pud_base = pud_offset(p4d, 0);
 		remove_pud_table(pud_base, addr, next, direct);
-		free_pud_table(pud_base, p4d);
+		/*
+		 * 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 == 5)
+			free_pud_table(pud_base, p4d);
 	}
 
 	if (direct)
-- 
2.13.0

[toc] | [next] | [standalone]


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

FromIngo Molnar <mingo@kernel.org>
Date2017-06-26 11:50 +0200
SubjectRe: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v3
Message-ID<tWyOC-EC-9@gated-at.bofh.it>
In reply to#1674117
* jglisse@redhat.com <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()

Am I correct that the _real_ buggy commit that introduced the breakage in v4.12 
is:

  f2a6a7050109: ("x86: Convert the rest of the code to support p4d_t")

... right?

Thanks,

	Ingo

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


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

FromJerome Glisse <jglisse@redhat.com>
Date2017-06-26 16:50 +0200
SubjectRe: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v3
Message-ID<tWDuX-3Bo-39@gated-at.bofh.it>
In reply to#1674574
On Mon, Jun 26, 2017 at 11:43:04AM +0200, Ingo Molnar wrote:
> 
> * jglisse@redhat.com <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()
> 
> Am I correct that the _real_ buggy commit that introduced the breakage in v4.12 
> is:
> 
>   f2a6a7050109: ("x86: Convert the rest of the code to support p4d_t")
> 
> ... right?

Correct.

Jérôme

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


#1675355 — [tip:x86/urgent] x86/mm/hotplug: Fix BUG_ON() after hot-remove by not freeing PUD

From"tip-bot for Jérôme Glisse" <tipbot@zytor.com>
Date2017-06-27 09:30 +0200
Subject[tip:x86/urgent] x86/mm/hotplug: Fix BUG_ON() after hot-remove by not freeing PUD
Message-ID<tWT6G-5BT-13@gated-at.bofh.it>
In reply to#1674117
Commit-ID:  98fe3633c5a44e5ee3d642907739eb0210407886
Gitweb:     http://git.kernel.org/tip/98fe3633c5a44e5ee3d642907739eb0210407886
Author:     Jérôme Glisse <jglisse@redhat.com>
AuthorDate: Sat, 24 Jun 2017 14:05:14 -0400
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 26 Jun 2017 11:44:19 +0200

x86/mm/hotplug: Fix BUG_ON() after hot-remove by not freeing PUD

Since commit:

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

we no longer free PUDs so that we do not have to synchronize
all PGDs on hot-remove/vfree().

But the new 5-level page table patchset reverted that for 4-level
page tables, in the following commit:

  f2a6a7050109: ("x86: Convert the rest of the code to support p4d_t")

This patch restores the damage and disables free_pud() if we are in the
4-level page table case, thus avoiding BUG_ON() after hot-remove.

Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
[ Clarified the changelog and the code comments. ]
Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Logan Gunthorpe <logang@deltatee.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-mm@kvack.org
Link: http://lkml.kernel.org/r/20170624180514.3821-1-jglisse@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/mm/init_64.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 95651dc..0a59daf 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -990,7 +990,13 @@ remove_p4d_table(p4d_t *p4d_start, unsigned long addr, unsigned long end,
 
 		pud_base = pud_offset(p4d, 0);
 		remove_pud_table(pud_base, addr, next, direct);
-		free_pud_table(pud_base, p4d);
+		/*
+		 * For 4-level page tables we do not want to free PUDs, but in the
+		 * 5-level case we should free them. This code will have to change
+		 * to adapt for boot-time switching between 4 and 5 level page tables.
+		 */
+		if (CONFIG_PGTABLE_LEVELS == 5)
+			free_pud_table(pud_base, p4d);
 	}
 
 	if (direct)

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web