From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751824AbdFGRiG convert rfc822-to-8bit (ORCPT ); Wed, 7 Jun 2017 13:38:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55670 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751794AbdFGRiC (ORCPT ); Wed, 7 Jun 2017 13:38:02 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3245180E4A Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jglisse@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3245180E4A Date: Wed, 7 Jun 2017 13:38:00 -0400 (EDT) From: Jerome Glisse To: "Kirill A. Shutemov" Cc: "Kirill A. Shutemov" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andy Lutomirski , Ingo Molnar , Logan Gunthorpe Message-ID: <1169495863.31360420.1496857080560.JavaMail.zimbra@redhat.com> In-Reply-To: <20170607170651.exful7yvxvrjaolz@node.shutemov.name> References: <1496846780-17393-1-git-send-email-jglisse@redhat.com> <20170607170325.65ex46hoqjalprnu@black.fi.intel.com> <20170607170651.exful7yvxvrjaolz@node.shutemov.name> Subject: Re: [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Originating-IP: [10.10.120.3, 10.4.195.1] Thread-Topic: x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v2 Thread-Index: Ozd6EBFYl97xQqMhJ+Xo9YbD9s0zaw== X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 07 Jun 2017 17:38:02 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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 > > > > > > 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 > > > Cc: Andy Lutomirski > > > Cc: Ingo Molnar > > > Cc: Kirill A. Shutemov > > > Cc: Logan Gunthorpe > > > > 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