Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1291967ybi; Fri, 14 Jun 2019 11:59:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqzG+xTuXSv0ik8CGqtT0/n6yBT5pKIAjSdV8qyk/X37im+lppk/onlTYhP4dvRlBJZ8CUOo X-Received: by 2002:a17:90a:9a83:: with SMTP id e3mr12299598pjp.105.1560538758980; Fri, 14 Jun 2019 11:59:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560538758; cv=none; d=google.com; s=arc-20160816; b=mC/2049ZxWMs2vgHBYTvzNfT6u0E7fbt0kJKQeZGxwzhbhc/vkpwxbKX/JfAAvkm3N 5KMSlFo0P/IAnV33da12DgTbWfxgdI7R6TGBezJORKDBSF0YBLYkqpK3qZSNyiIPK+pY kkdLz/DIS3+FMnA5smIJSSxlcY0+xae4aSEpygCeQHp68Z5NzWpk9ub8Lfgrvz8gtn5H xvixrD1rIxtRi9RUgCwqRys26DR9/PQgdQ6KDemtB6vKySIuRZhCQooSDTeBIAxOkZdL fcgecvDcyWdxXIgIWkKL5upGTowWQ9dvjs3qQS73DZzV2rEbam3weiI2FeDtxuFonwl7 z/3Q== 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 :in-reply-to:references:mime-version:dkim-signature; bh=oY348vpCG95iTNSMF3TDF4pbwXas3ck/kElwYiwrsvw=; b=c7ENojXMhU7O6oJr0lquF1DAoHvZ8trbkoyGNMgf5joj1AkcE+kMPVez43CvRk9V52 /6GuV3zCOdQ4QTDBTR3w5Qjf7sYpTOycql80BLHm9madaZDcFFONm8XMnmc5RbbXd1qL JIX2+y5ozKvTecyDgFUQTNQHef0Y4JxD6ImtYsR4ycjpOmC1kXtyciqKQwkFn12u3hUE K2A7vUl5mDcLbIwB6Ag9iCVC/UCYo5cCSbeVerx+B3SnnqFt2mD5Oe2QMoiKKXLaPhwg VtW/v1zLlzYjR4nPuhJDJZIF/VvSuD+A/7aVmzTqh/R+GGfml1TjNTMVuQ+lMcXYStGa MN7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=F85MjR0g; 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 97si2806843plc.181.2019.06.14.11.59.03; Fri, 14 Jun 2019 11:59:18 -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=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=F85MjR0g; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726184AbfFNS55 (ORCPT + 99 others); Fri, 14 Jun 2019 14:57:57 -0400 Received: from mail-oi1-f196.google.com ([209.85.167.196]:43330 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726046AbfFNS55 (ORCPT ); Fri, 14 Jun 2019 14:57:57 -0400 Received: by mail-oi1-f196.google.com with SMTP id w79so2698988oif.10 for ; Fri, 14 Jun 2019 11:57:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=oY348vpCG95iTNSMF3TDF4pbwXas3ck/kElwYiwrsvw=; b=F85MjR0gN90YTSSPhCUn9lf3+gAUAMWR5V9MYVfBOrCJQ1H3hiLjul2ugj7VnpOTBa i9Sp+K18uEQofN4tumrHUXaqcMNxTu6cGGZm6yttT/JpXMgr1xATwuYNtg+gZXBCVGhv +mT01bZVNXo9pF/l9GffY/mlArCMf2aa3APCyIJWkZmcBddGaH8yofAJhPmyebNaOItK N8sIZN8LJ3WJtxM2h/reyObc1JIGEWlLWAB5zVkxh/YE/W9nGbnxAAcfvDIFMf4k5Cqq x5e4uXA4P1jBGWyObYdHmdFkNCTlR8nUiUTvIRg4KrDsp+lPH7/kprCmsmkBnMQBnyoi M7KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oY348vpCG95iTNSMF3TDF4pbwXas3ck/kElwYiwrsvw=; b=aN+e18zH2zy6vD5UD7m5nH5rbRGq9t0XaAejI2D0+4fUS3JrJ7gtM0FrIPiIiEugTD D0dNX/pXLM9GOI87+6TORyQV7AYzybICe2IWUBMOOMQA4Np0DX/4xj1WiMRLsgFpXsZZ S3SIE9RW5SjVTY68nkN9lvZH4hNxSp0zFE60bAgZC/DNBEUyf4Sou40+8V8xMKfRCllF N0m3yPD7SAMSI3wdWxHUxPIy9jvWCZ8zDMMPxK8DaI8Q+ifGXoupx8DYSh1mLi/6ei+X gulVeCBmQfxxt4wZ9s9sVz3ADSF5uJxr32503P9AiEiI8IL4mMj8DG3/fDaBsWqKCtx8 d2kw== X-Gm-Message-State: APjAAAUWH+dTZW83q7djYpXQO2tuG5QVnhxkJz7JGzzh58S4rCTu7fPw fdueQmVn4cJq2U6pgaQFxcV56yKRtpbQKwKIinZPrg== X-Received: by 2002:aca:4208:: with SMTP id p8mr2892814oia.105.1560538675845; Fri, 14 Jun 2019 11:57:55 -0700 (PDT) MIME-Version: 1.0 References: <1560366952-10660-1-git-send-email-cai@lca.pw> <1560376072.5154.6.camel@lca.pw> <87lfy4ilvj.fsf@linux.ibm.com> <1560524365.5154.21.camel@lca.pw> In-Reply-To: From: Dan Williams Date: Fri, 14 Jun 2019 11:57:44 -0700 Message-ID: Subject: Re: [PATCH -next] mm/hotplug: skip bad PFNs from pfn_to_online_page() To: Qian Cai Cc: "Aneesh Kumar K.V" , Andrew Morton , Oscar Salvador , Linux MM , Linux Kernel Mailing List Content-Type: multipart/mixed; boundary="0000000000006edde2058b4d3902" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --0000000000006edde2058b4d3902 Content-Type: text/plain; charset="UTF-8" On Fri, Jun 14, 2019 at 11:03 AM Dan Williams wrote: > > On Fri, Jun 14, 2019 at 7:59 AM Qian Cai wrote: > > > > On Fri, 2019-06-14 at 14:28 +0530, Aneesh Kumar K.V wrote: > > > Qian Cai writes: > > > > > > > > > > 1) offline is busted [1]. It looks like test_pages_in_a_zone() missed the > > > > same > > > > pfn_section_valid() check. > > > > > > > > 2) powerpc booting is generating endless warnings [2]. In > > > > vmemmap_populated() at > > > > arch/powerpc/mm/init_64.c, I tried to change PAGES_PER_SECTION to > > > > PAGES_PER_SUBSECTION, but it alone seems not enough. > > > > > > > > > > Can you check with this change on ppc64. I haven't reviewed this series yet. > > > I did limited testing with change . Before merging this I need to go > > > through the full series again. The vmemmap poplulate on ppc64 needs to > > > handle two translation mode (hash and radix). With respect to vmemap > > > hash doesn't setup a translation in the linux page table. Hence we need > > > to make sure we don't try to setup a mapping for a range which is > > > arleady convered by an existing mapping. > > > > It works fine. > > Strange... it would only change behavior if valid_section() is true > when pfn_valid() is not or vice versa. They "should" be identical > because subsection-size == section-size on PowerPC, at least with the > current definition of SUBSECTION_SHIFT. I suspect maybe > free_area_init_nodes() is too late to call subsection_map_init() for > PowerPC. Can you give the attached incremental patch a try? This will break support for doing sub-section hot-add in a section that was only partially populated early at init, but that can be repaired later in the series. First things first, don't regress. diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 874eb22d22e4..520c83aa0fec 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7286,12 +7286,10 @@ void __init free_area_init_nodes(unsigned long *max_zone_pfn) /* Print out the early node map */ pr_info("Early memory node ranges\n"); - for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, &nid) { + for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, &nid) pr_info(" node %3d: [mem %#018Lx-%#018Lx]\n", nid, (u64)start_pfn << PAGE_SHIFT, ((u64)end_pfn << PAGE_SHIFT) - 1); - subsection_map_init(start_pfn, end_pfn - start_pfn); - } /* Initialise every node */ mminit_verify_pageflags_layout(); diff --git a/mm/sparse.c b/mm/sparse.c index 0baa2e55cfdd..bca8e6fa72d2 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -533,6 +533,7 @@ static void __init sparse_init_nid(int nid, unsigned long pnum_begin, } check_usemap_section_nr(nid, usage); sparse_init_one_section(__nr_to_section(pnum), pnum, map, usage); + subsection_map_init(section_nr_to_pfn(pnum), PAGES_PER_SECTION); usage = (void *) usage + mem_section_usage_size(); } sparse_buffer_fini(); --0000000000006edde2058b4d3902 Content-Type: text/x-patch; charset="US-ASCII"; name="fix.patch" Content-Disposition: attachment; filename="fix.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jwwgclts0 ZGlmZiAtLWdpdCBhL21tL3BhZ2VfYWxsb2MuYyBiL21tL3BhZ2VfYWxsb2MuYwppbmRleCA4NzRl YjIyZDIyZTQuLjUyMGM4M2FhMGZlYyAxMDA2NDQKLS0tIGEvbW0vcGFnZV9hbGxvYy5jCisrKyBi L21tL3BhZ2VfYWxsb2MuYwpAQCAtNzI4NiwxMiArNzI4NiwxMCBAQCB2b2lkIF9faW5pdCBmcmVl X2FyZWFfaW5pdF9ub2Rlcyh1bnNpZ25lZCBsb25nICptYXhfem9uZV9wZm4pCiAKIAkvKiBQcmlu dCBvdXQgdGhlIGV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