Received: by 10.213.65.68 with SMTP id h4csp82045imn; Thu, 15 Mar 2018 17:50:52 -0700 (PDT) X-Google-Smtp-Source: AG47ELsF/YufHIXMc1cWiSP8VydIiqAEStTPuP08udYEke5fuPjlIO8P2ZuKMMWrn/umtAqEiwEL X-Received: by 2002:a17:902:2803:: with SMTP id e3-v6mr10383816plb.238.1521161452343; Thu, 15 Mar 2018 17:50:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521161452; cv=none; d=google.com; s=arc-20160816; b=TYnuUY112/VVM4hV32Mxr/yi2NEsebACHzPj2euvB6nvqCRnTyFKyNZflkGA1oJfbq 4vzpUdPJ72e4p38glZ0Bcq+gYSRpaKsc5F05335Z167YmDAXv5atGo2Lqf21Qk9pjU1v JN2vmQXBa+dTqX1F9am5efWdjV6GljOiuj6BX0ytzSRRUx1vnDZ01+Hn83rYANbTPHv2 ZVRGozipPA0odEqOOCPRGm0ti06nFEcZdcHAbp2h9CEHd77kuysbCiMv9turR5jsoDwQ unyqjwIcfTI3UZp0/3b/LP/Zb+cfvmrzP74IFJoRDX06iad06eZQVTpsysa6VOoDv552 213g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:dkim-signature:arc-authentication-results; bh=+mFFyw5uwpjoa7C5lstRC3riFAWDB8WSCYbkzkPT6Vc=; b=zSSA6a5yUYTa5PbsC9lTFEGitG0x3HFC1RgqIQ/sAn1FvOzxvhHk/O1rADvVnCCxbQ O+T7T0R4gUataWdCdWXj88xI053VGgIqblmDW2EJCrqXBiKflzP5vtbF8Bz/qG5SYCLq GQjXIFV8HuXNw/ccMx9qZTmGLZvoegPolNbfieO2b4DSd5VPtEoep8hF066eF6417vCY 4gt/cV4T7cVJwYtLyxq8HkiInYZOaItD2Cu4Yyi6hX/1ycP8qVItXJqbzM2ZToH6Gb+y h1HscA5OzWjrfOlK3G73QlMNAjzUg7nM+uE6kedQtYtFQSzYfgXz2EsTkXcby/mcmR+T VJMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qOj4wUZ+; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p11si4664715pfl.127.2018.03.15.17.50.37; Thu, 15 Mar 2018 17:50:52 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qOj4wUZ+; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932998AbeCPApq (ORCPT + 99 others); Thu, 15 Mar 2018 20:45:46 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:36563 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932094AbeCPApo (ORCPT ); Thu, 15 Mar 2018 20:45:44 -0400 Received: by mail-pl0-f65.google.com with SMTP id 61-v6so4883163plf.3; Thu, 15 Mar 2018 17:45:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=+mFFyw5uwpjoa7C5lstRC3riFAWDB8WSCYbkzkPT6Vc=; b=qOj4wUZ+i8xRL6K+yYBO0pK2uKEu6D47a6fzEeaOhLsJeZkVFP+x4L0n/FB3qsvB0g O8AAjwfK6X+y7r3L3Nor+N422MmW9BG/OqU6Zv9LF6XQcxznpH+PV74Uujy4uwD8a5oc knbWr6hQSGN2s19rpskRMXirOyqwN2TcKgr7bCyauiSZM5tcbS7d1Sd2ihn2WfTO5Y06 /gIULjWZTy+vgAa8PlY+/lUVi2xBj+h2fB6I4QJvhpZNPYJsmipUpkk/WSG3c9mP/NUy bjv+26rES2kPMNyf8hpSQDvzwXuXdMGm7Mm5MOI49mWLcrDT6sLHgqelmQa/vtPpGdDL gTJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=+mFFyw5uwpjoa7C5lstRC3riFAWDB8WSCYbkzkPT6Vc=; b=glLSOKhjMrMRUcmBG1NwDdIRpjTVRJm4uB2vklLdjZVIIIAKXKhHVLTyLvDAmjICOi bQrJJKL55FCXirAkkzI3nU/XeNvZJoAo3ro/bdrT0mAH71xwRjk1/ECPVSKnMlWXU/dM /a9iDyy77grDKOuAgabM8nRxuArCqvuQfBelI3mzIFITTFp6B3mj57H9/nUM0fpC1JSG YKMCDIzOEWBMfq0nCpb33gVKjf4Hw8EIDixxbHFdJRFitMcPF0t7cNYmOB3EvLUJfYea 75zdNh7nYbzMs4Nbnje7D6A0/1XZAhu6FcrhJmaL4QWBlfO9xSQo87MOiQWofwGZ5lwi SSSw== X-Gm-Message-State: AElRT7ENK60CDLK6TA3qfPqMLF+ASnr8iQ+DSWVFjeBvMRNBYWXjYyKQ 75pkljkMOkxipxnbufEYqoE= X-Received: by 2002:a17:902:aa03:: with SMTP id be3-v6mr9968001plb.211.1521161144268; Thu, 15 Mar 2018 17:45:44 -0700 (PDT) Received: from [0.0.0.0] (67.216.217.169.16clouds.com. [67.216.217.169]) by smtp.gmail.com with ESMTPSA id e23sm11029250pfi.76.2018.03.15.17.45.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Mar 2018 17:45:43 -0700 (PDT) Subject: Re: [PATCH] mm/page_alloc: fix boot hang in memmap_init_zone To: Daniel Vacek 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 References: <20180313224240.25295-1-neelx@redhat.com> <049a38e2-c446-85f4-656c-91d4e5bb1c0d@gmail.com> From: Jia He Message-ID: Date: Fri, 16 Mar 2018 08:45:32 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/15/2018 11:39 PM, Daniel Vacek Wrote: > 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? sure. [    0.000000] NUMA: Faking a node at [mem 0x0000000000000000-0x00000017ffffffff] [    0.000000] NUMA: NODE_DATA [mem 0x17ffffcb80-0x17ffffffff] [    0.000000] Zone ranges: [    0.000000]   DMA32    [mem 0x0000000000200000-0x00000000ffffffff] [    0.000000]   Normal   [mem 0x0000000100000000-0x00000017ffffffff] [    0.000000] Movable zone start for each node [    0.000000] Early memory node ranges [    0.000000]   node   0: [mem 0x0000000000200000-0x000000000021ffff] [    0.000000]   node   0: [mem 0x0000000000820000-0x000000000307ffff] [    0.000000]   node   0: [mem 0x0000000003080000-0x000000000308ffff] [    0.000000]   node   0: [mem 0x0000000003090000-0x00000000031fffff] [    0.000000]   node   0: [mem 0x0000000003200000-0x00000000033fffff] [    0.000000]   node   0: [mem 0x0000000003410000-0x000000000563ffff] [    0.000000]   node   0: [mem 0x0000000005640000-0x000000000567ffff] [    0.000000]   node   0: [mem 0x0000000005680000-0x00000000056dffff] [    0.000000]   node   0: [mem 0x00000000056e0000-0x00000000086fffff] [    0.000000]   node   0: [mem 0x0000000008700000-0x000000000871ffff] [    0.000000]   node   0: [mem 0x0000000008720000-0x000000000894ffff] [    0.000000]   node   0: [mem 0x0000000008950000-0x0000000008baffff] [    0.000000]   node   0: [mem 0x0000000008bb0000-0x0000000008bcffff] [    0.000000]   node   0: [mem 0x0000000008bd0000-0x0000000008c4ffff] [    0.000000]   node   0: [mem 0x0000000008c50000-0x0000000008e2ffff] [    0.000000]   node   0: [mem 0x0000000008e30000-0x0000000008e4ffff] [    0.000000]   node   0: [mem 0x0000000008e50000-0x0000000008fcffff] [    0.000000]   node   0: [mem 0x0000000008fd0000-0x000000000910ffff] [    0.000000]   node   0: [mem 0x0000000009110000-0x00000000092effff] [    0.000000]   node   0: [mem 0x00000000092f0000-0x000000000930ffff] [    0.000000]   node   0: [mem 0x0000000009310000-0x000000000963ffff] [    0.000000]   node   0: [mem 0x0000000009640000-0x000000000e61ffff] [    0.000000]   node   0: [mem 0x000000000e620000-0x000000000e64ffff] [    0.000000]   node   0: [mem 0x000000000e650000-0x000000000fffffff] [    0.000000]   node   0: [mem 0x0000000010800000-0x0000000017feffff] [    0.000000]   node   0: [mem 0x000000001c000000-0x000000001c00ffff] [    0.000000]   node   0: [mem 0x000000001c010000-0x000000001c7fffff] [    0.000000]   node   0: [mem 0x000000001c810000-0x000000007efbffff] [    0.000000]   node   0: [mem 0x000000007efc0000-0x000000007efdffff] [    0.000000]   node   0: [mem 0x000000007efe0000-0x000000007efeffff] [    0.000000]   node   0: [mem 0x000000007eff0000-0x000000007effffff] [    0.000000]   node   0: [mem 0x000000007f000000-0x00000017ffffffff] [    0.000000] Initmem setup node 0 [mem 0x0000000000200000-0x00000017ffffffff] -- Cheers, Jia