Received: by 10.213.65.68 with SMTP id h4csp30904imn; Thu, 15 Mar 2018 08:40:26 -0700 (PDT) X-Google-Smtp-Source: AG47ELs+pT9vufDDGva/TbZF6J5Ns/AsyNaJUBPLGmGLkPJOqXuDQCN0477UbjaBfoIPDwKijoCI X-Received: by 2002:a17:902:68c4:: with SMTP id x4-v6mr8766108plm.198.1521128426648; Thu, 15 Mar 2018 08:40:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521128426; cv=none; d=google.com; s=arc-20160816; b=j3e1xXsfouI5pMuxAXpaLbgX4wIzq4hlwgeFQVOcsg4DbvLzNekS+YGE6hXKCaAnnS m/g51+voha+qd625c90la4OwR3Ax7fIXLL0BurAUlZurB+SxeAg8DFU6eXy981JSvDtK ljtrLspJ9NoGXgeV0/oQBsdYQLPKtLouTq0q7oAIZSX4NeuwHGIFNjCdPIvZO4x9o7vR y3b9aPQGU0VczxJxjMKlCW25+xwAR7a4tbUF0rrYGTRGYhDDoqCowiCY1nK6uQRMoCZx KmaENgLh0Qk19R806DGMZ+1HPBB3MSekp/XWzzFXvmhdyWZ6g1DqdW4RJxzgaZvllVhc lJxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:arc-authentication-results; bh=GJd8pivFQhI61eFC9kG01wLxGh9JXTMy24OOowZH4DU=; b=M6iKyhjeQ57VPixa5f1tFYgR4T28Hn1fRD5aFVNEquDHC4PHwig+gbFCHmWEhWyFXy yK6hP9gs3FSOD8GcPO2aeJY6Oj6EG2jtl5BxygslhubbxaYKt1uDrek5k8pkQcEElRco HE5OElP9AHp/Kwfi04cFa9uxKf14d7m+d1Unf0fzN5TUvdIj2FcezS3Tg4T1WHWzRx1D PbubJe1APSHp7+LL1HurIqXU09DXivFGukQkA+Xb2ueUB1nj62rVsJz8o1TEwCQcgNub MgPHwSWUQBhMcPoMSi/1z2Qsk50Ph9H1KATVBJvdAWPDjUm3qge30MzwpLBmJdJa9rRH /gUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 97-v6si4154425ple.349.2018.03.15.08.40.12; Thu, 15 Mar 2018 08:40:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752754AbeCOPjK (ORCPT + 99 others); Thu, 15 Mar 2018 11:39:10 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:33570 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751918AbeCOPjG (ORCPT ); Thu, 15 Mar 2018 11:39:06 -0400 Received: by mail-oi0-f68.google.com with SMTP id e9so6077079oii.0 for ; Thu, 15 Mar 2018 08:39:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=GJd8pivFQhI61eFC9kG01wLxGh9JXTMy24OOowZH4DU=; b=XKFCquVQMkFp8j/Y91zuciuslj/q9FdyA7VUezsQabyVyyPfIEQVGSvcHYRKq7g7iD TT85Tc5DgI8H+THfZY36qAsgH+ZfpUYP1KFGFRMToc5MVEL1f4hDLfHISugirRvRfKCP Dy6af9Rs45OOaViY4zeCi+hmtrxIfPzVLuvT+K7x1nDWAGaXOZwEMR1PApR4RAEYl2u1 5bDscpReekDsPsTflOK7aHNt9+p4q+a0DB2D/8MKL2dkzpVLx+BMIqyGhnhzSKWe7DiY di8CuvFJAy6p/2JHaLJU+VZrazXZTIHlbIWMCAhBmUoR4dnS2YPmPesEofKOiQGWbo+m RpZg== X-Gm-Message-State: AElRT7HMuhrKTijzNhEWYKISU0BkHELVi2PoK9RO++6MAbZlpYzUnIcc Tg9tQdtP2/7vcpc3N8xjBFi98fi+Ti8MzQd588j1Yw== X-Received: by 10.202.236.130 with SMTP id k124mr5326629oih.33.1521128345472; Thu, 15 Mar 2018 08:39:05 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:39f6:0:0:0:0:0 with HTTP; Thu, 15 Mar 2018 08:39:04 -0700 (PDT) In-Reply-To: <049a38e2-c446-85f4-656c-91d4e5bb1c0d@gmail.com> References: <20180313224240.25295-1-neelx@redhat.com> <049a38e2-c446-85f4-656c-91d4e5bb1c0d@gmail.com> From: Daniel Vacek Date: Thu, 15 Mar 2018 16:39:04 +0100 Message-ID: Subject: Re: [PATCH] mm/page_alloc: fix boot hang in memmap_init_zone To: Jia He Cc: open list , linux-mm@kvack.org, Sudeep Holla , Naresh Kamboju , Andrew Morton , Mel Gorman , Michal Hocko , Paul Burton , Pavel Tatashin , Vlastimil Babka , stable , Ard Biesheuvel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 15, 2018 at 3:08 PM, Jia He wrote: > Hi Daniel > > > > On 3/14/2018 6:42 AM, Daniel Vacek Wrote: >> >> On some architectures (reported on arm64) commit 864b75f9d6b01 >> ("mm/page_alloc: fix memmap_init_zone pageblock alignment") >> causes a boot hang. This patch fixes the hang making sure the alignment >> never steps back. >> >> Link: >> http://lkml.kernel.org/r/0485727b2e82da7efbce5f6ba42524b429d0391a.1520011945.git.neelx@redhat.com >> Fixes: 864b75f9d6b01 ("mm/page_alloc: fix memmap_init_zone pageblock >> alignment") >> Signed-off-by: Daniel Vacek >> Tested-by: Sudeep Holla >> Tested-by: Naresh Kamboju >> Cc: Andrew Morton >> Cc: Mel Gorman >> Cc: Michal Hocko >> Cc: Paul Burton >> Cc: Pavel Tatashin >> Cc: Vlastimil Babka >> Cc: >> --- >> mm/page_alloc.c | 7 ++++++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/mm/page_alloc.c b/mm/page_alloc.c >> index 3d974cb2a1a1..e033a6895c6f 100644 >> --- a/mm/page_alloc.c >> +++ b/mm/page_alloc.c >> @@ -5364,9 +5364,14 @@ void __meminit memmap_init_zone(unsigned long size, >> int nid, unsigned long zone, >> * is not. move_freepages_block() can shift ahead >> of >> * the valid region but still depends on correct >> page >> * metadata. >> + * Also make sure we never step back. >> */ >> - pfn = (memblock_next_valid_pfn(pfn, end_pfn) & >> + unsigned long next_pfn; >> + >> + next_pfn = (memblock_next_valid_pfn(pfn, end_pfn) >> & >> ~(pageblock_nr_pages-1)) - 1; >> + if (next_pfn > pfn) >> + pfn = next_pfn; > > It didn't resolve the booting hang issue in my arm64 server. > what if memblock_next_valid_pfn(pfn, end_pfn) is 32 and pageblock_nr_pages > is 8196? > Thus, next_pfn will be (unsigned long)-1 and be larger than pfn. > So still there is an infinite loop here. Hi Jia, Yeah, looks like another uncovered case. Noone reported this so far. Anyways upstream reverted all this for now and we're discussing the right approach here. In any case thanks for this report. Can you share something like below from your machine? Booting Linux on physical CPU 0x0000000000 [0x410fd034] Linux version 4.16.0-rc5-00004-gfc6eabbbf8ef-dirty (ard@dogfood) ... Machine model: Socionext Developer Box earlycon: pl11 at MMIO 0x000000002a400000 (options '') bootconsole [pl11] enabled efi: Getting EFI parameters from FDT: efi: EFI v2.70 by Linaro efi: SMBIOS 3.0=0xff580000 ESRT=0xf9948198 MEMATTR=0xf83b1a98 RNG=0xff7ac898 random: fast init done efi: seeding entropy pool esrt: Reserving ESRT space from 0x00000000f9948198 to 0x00000000f99481d0. cma: Reserved 16 MiB at 0x00000000fd800000 NUMA: No NUMA configuration found NUMA: Faking a node at [mem 0x0000000000000000-0x0000000fffffffff] NUMA: NODE_DATA [mem 0xffffd8d80-0xffffda87f] Zone ranges: DMA32 [mem 0x0000000080000000-0x00000000ffffffff] Normal [mem 0x0000000100000000-0x0000000fffffffff] Movable zone start for each node Early memory node ranges node 0: [mem 0x0000000080000000-0x00000000febeffff] node 0: [mem 0x00000000febf0000-0x00000000fefcffff] node 0: [mem 0x00000000fefd0000-0x00000000ff43ffff] node 0: [mem 0x00000000ff440000-0x00000000ff7affff] node 0: [mem 0x00000000ff7b0000-0x00000000ffffffff] node 0: [mem 0x0000000880000000-0x0000000fffffffff] Initmem setup node 0 [mem 0x0000000080000000-0x0000000fffffffff] Thank you. --nX > Cheers, > Jia He >> >> #endif >> continue; >> } > > > -- > Cheers, > Jia >