Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp4789626imc; Mon, 25 Feb 2019 11:03:42 -0800 (PST) X-Google-Smtp-Source: AHgI3IZnqBtiwjqRLGsaCThFYPj0iCGi+QtviUsaETIMo/u/SwgQ6Lidbgcm+/uV9N/kRfj6/Sr9 X-Received: by 2002:a17:902:ba8c:: with SMTP id k12mr2389269pls.193.1551121422891; Mon, 25 Feb 2019 11:03:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551121422; cv=none; d=google.com; s=arc-20160816; b=kHU/iK6ObEkIpUVbJo/FqzxF26DV/EZm4aAeSKCWOtrDypgLNcRT99YqmmuQAfu54J WN0Ik5PCewOV8eloTV+N9fneJlDCKRsw1gD608t9UjHfY3weVmI1sbfvckeHwQv5kXPr QgWcWFbeEvh3uKx6XjLj0FYgBNyT7aC5bi9MM+a+d072szy5eYnn4oM6eRoBUp78X1+M drW4DkU1azYhKUmHWR5mEkQNTwajgvoTKYy2VT6yLIXBQCXPXpbivtpHGyaKOmB3Iw8z PvM+NOedKKn1ocZ6Fbwg5tYpx5pGe2qVNCey5sqK+lwstDHt2ukjzO6OxYW9czWOzSmF ZQxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:in-reply-to:references:date :from:cc:to:subject; bh=wTpfmsZuic2HvDF5hoBzln3PVoDtdFMJRGlcBqYIJwE=; b=dJfCxQbYqTr+PRA1F/M8ZmXHZBzmhNoHCLyKJl0fYkns818COfeOt7lVJbfLr3Yf5q F6bpPALUZPDT19K24cUTnhikNNS2gKQV7WVJKB7SxK78n+tJBWIG3hXyehzx5Qb/aLRl kBokfD0IzofnArGVEM/58YllKOH/h1hsAAXKDaIhfqsO7kqu/8BE63wMLvCCZq7Ka1Mw AtlP5fPPwXBpMLQ/oPAJ1+8MaMCOi96KTl1gPdvkigEAr9dCV9NxP59FjV9rPBkbY0nX 1AFFaXR7hvLSUy9jP7bJkNBpti964C+o5+ioxC5nPgqECsmaIN4+7tlUl1pqVHwnQDTk dNcg== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l1si10389077pld.386.2019.02.25.11.03.26; Mon, 25 Feb 2019 11:03:42 -0800 (PST) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727084AbfBYTCy (ORCPT + 99 others); Mon, 25 Feb 2019 14:02:54 -0500 Received: from mga03.intel.com ([134.134.136.65]:60203 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726625AbfBYTCm (ORCPT ); Mon, 25 Feb 2019 14:02:42 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Feb 2019 11:02:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,412,1544515200"; d="scan'208";a="118984325" Received: from viggo.jf.intel.com (HELO localhost.localdomain) ([10.54.77.144]) by orsmga006.jf.intel.com with ESMTP; 25 Feb 2019 11:02:42 -0800 Subject: [PATCH 4/5] mm/resource: let walk_system_ram_range() search child resources To: linux-kernel@vger.kernel.org Cc: Dave Hansen , keith.busch@intel.com, dan.j.williams@intel.com, dave.jiang@intel.com, zwisler@kernel.org, vishal.l.verma@intel.com, thomas.lendacky@amd.com, akpm@linux-foundation.org, mhocko@suse.com, linux-nvdimm@lists.01.org, linux-mm@kvack.org, ying.huang@intel.com, fengguang.wu@intel.com, bp@suse.de, bhelgaas@google.com, baiyaowei@cmss.chinamobile.com, tiwai@suse.de, jglisse@redhat.com From: Dave Hansen Date: Mon, 25 Feb 2019 10:57:38 -0800 References: <20190225185727.BCBD768C@viggo.jf.intel.com> In-Reply-To: <20190225185727.BCBD768C@viggo.jf.intel.com> Message-Id: <20190225185738.F6C24E62@viggo.jf.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Hansen In the process of onlining memory, we use walk_system_ram_range() to find the actual RAM areas inside of the area being onlined. However, it currently only finds memory resources which are "top-level" iomem_resources. Children are not currently searched which causes it to skip System RAM in areas like this (in the format of /proc/iomem): a0000000-bfffffff : Persistent Memory (legacy) a0000000-afffffff : System RAM Changing the true->false here allows children to be searched as well. We need this because we add a new "System RAM" resource underneath the "persistent memory" resource when we use persistent memory in a volatile mode. Signed-off-by: Dave Hansen Cc: Keith Busch Cc: Dan Williams Cc: Dave Jiang Cc: Ross Zwisler Cc: Vishal Verma Cc: Tom Lendacky Cc: Andrew Morton Cc: Michal Hocko Cc: linux-nvdimm@lists.01.org Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org Cc: Huang Ying Cc: Fengguang Wu Cc: Borislav Petkov Cc: Bjorn Helgaas Cc: Yaowei Bai Cc: Takashi Iwai Cc: Jerome Glisse --- b/kernel/resource.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff -puN kernel/resource.c~mm-walk_system_ram_range-search-child-resources kernel/resource.c --- a/kernel/resource.c~mm-walk_system_ram_range-search-child-resources 2019-02-25 10:56:50.750908026 -0800 +++ b/kernel/resource.c 2019-02-25 10:56:50.754908026 -0800 @@ -454,6 +454,9 @@ int walk_mem_res(u64 start, u64 end, voi * This function calls the @func callback against all memory ranges of type * System RAM which are marked as IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY. * It is to be used only for System RAM. + * + * This will find System RAM ranges that are children of top-level resources + * in addition to top-level System RAM resources. */ int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, void *arg, int (*func)(unsigned long, unsigned long, void *)) @@ -469,7 +472,7 @@ int walk_system_ram_range(unsigned long flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY; while (start < end && !find_next_iomem_res(start, end, flags, IORES_DESC_NONE, - true, &res)) { + false, &res)) { pfn = (res.start + PAGE_SIZE - 1) >> PAGE_SHIFT; end_pfn = (res.end + 1) >> PAGE_SHIFT; if (end_pfn > pfn) _