linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove
@ 2017-06-06 17:35 Jérôme Glisse
  2017-06-06 19:50 ` Logan Gunthorpe
  2017-06-07 10:47 ` Kirill A. Shutemov
  0 siblings, 2 replies; 4+ messages in thread
From: Jérôme Glisse @ 2017-06-06 17:35 UTC (permalink / raw)
  To: linux-kernel, linux-mm
  Cc: Jérôme Glisse, Andy Lutomirski, Ingo Molnar,
	Kirill A . Shutemov, Logan Gunthorpe

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 code re-added that code f2a6a705 and
thus we now trigger a BUG_ON() l128 in sync_global_pgds()

This patch remove free_pud() like in af2cf278ef4f

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>
---
 arch/x86/mm/init_64.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index a8a9972..8cf7e99 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -772,24 +772,6 @@ static void __meminit free_pmd_table(pmd_t *pmd_start, pud_t *pud)
 	spin_unlock(&init_mm.page_table_lock);
 }
 
-static void __meminit free_pud_table(pud_t *pud_start, p4d_t *p4d)
-{
-	pud_t *pud;
-	int i;
-
-	for (i = 0; i < PTRS_PER_PUD; i++) {
-		pud = pud_start + i;
-		if (!pud_none(*pud))
-			return;
-	}
-
-	/* free a pud talbe */
-	free_pagetable(p4d_page(*p4d), 0);
-	spin_lock(&init_mm.page_table_lock);
-	p4d_clear(p4d);
-	spin_unlock(&init_mm.page_table_lock);
-}
-
 static void __meminit
 remove_pte_table(pte_t *pte_start, unsigned long addr, unsigned long end,
 		 bool direct)
@@ -991,7 +973,6 @@ 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);
 	}
 
 	if (direct)
-- 
2.9.3

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

* Re: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove
  2017-06-06 17:35 [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove Jérôme Glisse
@ 2017-06-06 19:50 ` Logan Gunthorpe
  2017-06-07 10:47 ` Kirill A. Shutemov
  1 sibling, 0 replies; 4+ messages in thread
From: Logan Gunthorpe @ 2017-06-06 19:50 UTC (permalink / raw)
  To: Jérôme Glisse, linux-kernel, linux-mm
  Cc: Andy Lutomirski, Ingo Molnar, Kirill A . Shutemov

Thanks Jerome! This indeed fixes the bug I reported.

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

Logan


On 06/06/17 11:35 AM, Jérôme Glisse wrote:
> 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 code re-added that code f2a6a705 and
> thus we now trigger a BUG_ON() l128 in sync_global_pgds()
> 
> This patch remove free_pud() like in af2cf278ef4f
> 
> 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>
> ---
>  arch/x86/mm/init_64.c | 19 -------------------
>  1 file changed, 19 deletions(-)
> 
> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> index a8a9972..8cf7e99 100644
> --- a/arch/x86/mm/init_64.c
> +++ b/arch/x86/mm/init_64.c
> @@ -772,24 +772,6 @@ static void __meminit free_pmd_table(pmd_t *pmd_start, pud_t *pud)
>  	spin_unlock(&init_mm.page_table_lock);
>  }
>  
> -static void __meminit free_pud_table(pud_t *pud_start, p4d_t *p4d)
> -{
> -	pud_t *pud;
> -	int i;
> -
> -	for (i = 0; i < PTRS_PER_PUD; i++) {
> -		pud = pud_start + i;
> -		if (!pud_none(*pud))
> -			return;
> -	}
> -
> -	/* free a pud talbe */
> -	free_pagetable(p4d_page(*p4d), 0);
> -	spin_lock(&init_mm.page_table_lock);
> -	p4d_clear(p4d);
> -	spin_unlock(&init_mm.page_table_lock);
> -}
> -
>  static void __meminit
>  remove_pte_table(pte_t *pte_start, unsigned long addr, unsigned long end,
>  		 bool direct)
> @@ -991,7 +973,6 @@ 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);
>  	}
>  
>  	if (direct)
> 

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

* Re: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove
  2017-06-06 17:35 [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove Jérôme Glisse
  2017-06-06 19:50 ` Logan Gunthorpe
@ 2017-06-07 10:47 ` Kirill A. Shutemov
  2017-06-07 14:49   ` Jerome Glisse
  1 sibling, 1 reply; 4+ messages in thread
From: Kirill A. Shutemov @ 2017-06-07 10:47 UTC (permalink / raw)
  To: Jérôme Glisse
  Cc: linux-kernel, linux-mm, Andy Lutomirski, Ingo Molnar,
	Kirill A . Shutemov, Logan Gunthorpe

On Tue, Jun 06, 2017 at 01:35:12PM -0400, Jérôme Glisse wrote:
> 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 code re-added that code f2a6a705 and
> thus we now trigger a BUG_ON() l128 in sync_global_pgds()
> 
> This patch remove free_pud() like in af2cf278ef4f

Good catch. Thanks!

But I think we only need to skip free_pud_table() for 4-level paging.
If we don't we would leave 513 page tables around instead of one in
5-level paging case.

I don't think it's acceptable.

And please use patch subject lines along with commit hashes to simplify
reading commit message.

-- 
 Kirill A. Shutemov

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

* Re: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove
  2017-06-07 10:47 ` Kirill A. Shutemov
@ 2017-06-07 14:49   ` Jerome Glisse
  0 siblings, 0 replies; 4+ messages in thread
From: Jerome Glisse @ 2017-06-07 14:49 UTC (permalink / raw)
  To: Kirill A. Shutemov
  Cc: linux-kernel, linux-mm, Andy Lutomirski, Ingo Molnar,
	Kirill A . Shutemov, Logan Gunthorpe

On Wed, Jun 07, 2017 at 01:47:15PM +0300, Kirill A. Shutemov wrote:
> On Tue, Jun 06, 2017 at 01:35:12PM -0400, Jérôme Glisse wrote:
> > 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 code re-added that code f2a6a705 and
> > thus we now trigger a BUG_ON() l128 in sync_global_pgds()
> > 
> > This patch remove free_pud() like in af2cf278ef4f
> 
> Good catch. Thanks!
> 
> But I think we only need to skip free_pud_table() for 4-level paging.
> If we don't we would leave 513 page tables around instead of one in
> 5-level paging case.
> 
> I don't think it's acceptable.
> 
> And please use patch subject lines along with commit hashes to simplify
> reading commit message.
> 

I sent a v2 that disable free_pud in 4 level page table config.
Note that your patchset that allow switching between 4 and 5 at
boot time will need to update that code. As this patch is a fix
and your boot time switching is an RFC i assume the fix will go
in first.

Cheers,
Jérôme

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-06 17:35 [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove Jérôme Glisse
2017-06-06 19:50 ` Logan Gunthorpe
2017-06-07 10:47 ` Kirill A. Shutemov
2017-06-07 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).