linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v3
@ 2017-06-24 18:05 jglisse
  2017-06-26  9:43 ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: jglisse @ 2017-06-24 18:05 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-kernel, Jérôme Glisse, Andy Lutomirski,
	Ingo Molnar, Logan Gunthorpe, Andrew Morton

From: JA(C)rA'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: JA(C)rA'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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v3
  2017-06-24 18:05 [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v3 jglisse
@ 2017-06-26  9:43 ` Ingo Molnar
  2017-06-26 14:49   ` Jerome Glisse
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2017-06-26  9:43 UTC (permalink / raw)
  To: jglisse
  Cc: linux-mm, linux-kernel, Andy Lutomirski, Logan Gunthorpe, Andrew Morton


* jglisse@redhat.com <jglisse@redhat.com> wrote:

> From: Jerome 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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v3
  2017-06-26  9:43 ` Ingo Molnar
@ 2017-06-26 14:49   ` Jerome Glisse
  0 siblings, 0 replies; 3+ messages in thread
From: Jerome Glisse @ 2017-06-26 14:49 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-mm, linux-kernel, Andy Lutomirski, Logan Gunthorpe, Andrew Morton

On Mon, Jun 26, 2017 at 11:43:04AM +0200, Ingo Molnar wrote:
> 
> * jglisse@redhat.com <jglisse@redhat.com> wrote:
> 
> > From: Jerome 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.

Jerome

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2017-06-26 14:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-24 18:05 [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v3 jglisse
2017-06-26  9:43 ` Ingo Molnar
2017-06-26 14:49   ` Jerome Glisse

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