linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: jglisse@redhat.com
To: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org,
	"Jérôme Glisse" <jglisse@redhat.com>,
	"Andy Lutomirski" <luto@kernel.org>,
	"Ingo Molnar" <mingo@kernel.org>,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	"Logan Gunthorpe" <logang@deltatee.com>
Subject: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v2
Date: Wed,  7 Jun 2017 10:46:20 -0400	[thread overview]
Message-ID: <1496846780-17393-1-git-send-email-jglisse@redhat.com> (raw)

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

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

             reply	other threads:[~2017-06-07 14:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-07 14:46 jglisse [this message]
2017-06-07 16:14 ` [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v2 Logan Gunthorpe
2017-06-07 17:03 ` Kirill A. Shutemov
2017-06-07 17:06   ` Kirill A. Shutemov
2017-06-07 17:38     ` Jerome Glisse
2017-06-07 18:17       ` Kirill A. Shutemov
2017-06-23 19:48         ` Jerome Glisse
2017-06-24  6:45           ` Ingo Molnar
2017-06-24 18:05             ` Jerome Glisse

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=1496846780-17393-1-git-send-email-jglisse@redhat.com \
    --to=jglisse@redhat.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=logang@deltatee.com \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    /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).