Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1259975imu; Wed, 16 Jan 2019 15:54:27 -0800 (PST) X-Google-Smtp-Source: ALg8bN62l5vtkeHNz+igd13AhCMCnOLyu8EYmYx9S0xlwfkE9hFs96IYxBY34dAHZK6Q+okw8/YT X-Received: by 2002:a63:f844:: with SMTP id v4mr11223599pgj.82.1547682867490; Wed, 16 Jan 2019 15:54:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547682867; cv=none; d=google.com; s=arc-20160816; b=k3ZBJq/NeMoFQzzEpEOivtkGpHkbkEylN13yfgvFCJ052LxCppuq/BZwFYahtib8TE iywhwF2hF0syB09iAOxyvV8HJy1JPpa6sIGSnk7v2gX0Rbz8C6/PgRTQG2jxdKZu9iLb hIHywAGkgRU17seljeR0fy7wcCb25jI5Une43y4WFHO04ON1NLaU7xMHm/RPCjVybntZ yUt4TjHhLs8Ip4+mWPWEzmzV2y28cBVxEgzMDFX99xg04NqYD4Eyqf/MGd97ZIgoCjW4 PSgvcPguGTNPFvBL5SBReLUHgovNPOAGvt6Y2Giw9E+xvxEWYVG1Xu0mCqSXmq6r0V6O rcLw== 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=Cw56qJD87uy/pg1Cu85XBjBCwAnxWxaIy0eAzSm3c2Q=; b=j6iqbfwzXDya0Q4ivJuGTzs8wY1HGaUjZJ5M0ti3XGu/q/ZpkzOYIgViCWijmsuHll B59m+e+GlykQH6+ZJb88/TU8je6Uab8f+/uuXoRC5jWDHtSPd3scj0DVGjRoSeSrzCVC /RvFja2YNI+qEf00QAUobrg7Mfw6Eof5UW6/+t5diNnlwwTpRDRaxtBVq3RluuPpN0Dl 6eLjYqE4UPfE0A3jkBtHT5rsOHdq24oDmISYAhSIAD7wYHpjEv2FURopaQ+cjpUuMaKc lTfAzfg8eCbng/8pBSI97kBJ4YbsAwX6u9rTGcqNqfeJCMBT7BC1xIHewKCfeGyhqq08 UlUQ== 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 m63si7791652pld.132.2019.01.16.15.54.09; Wed, 16 Jan 2019 15:54:27 -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 S1728664AbfAPSZy (ORCPT + 99 others); Wed, 16 Jan 2019 13:25:54 -0500 Received: from mga14.intel.com ([192.55.52.115]:10058 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728597AbfAPSZm (ORCPT ); Wed, 16 Jan 2019 13:25:42 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jan 2019 10:25:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,487,1539673200"; d="scan'208";a="292082790" Received: from viggo.jf.intel.com (HELO localhost.localdomain) ([10.54.77.144]) by orsmga005.jf.intel.com with ESMTP; 16 Jan 2019 10:25:41 -0800 Subject: [PATCH 3/4] dax/kmem: let walk_system_ram_range() search child resources To: dave@sr71.net Cc: Dave Hansen , 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-kernel@vger.kernel.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 From: Dave Hansen Date: Wed, 16 Jan 2019 10:19:04 -0800 References: <20190116181859.D1504459@viggo.jf.intel.com> In-Reply-To: <20190116181859.D1504459@viggo.jf.intel.com> Message-Id: <20190116181904.D24AF5FE@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. 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 Signed-off-by: Dave Hansen --- 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 2018-12-20 11:48:42.824771932 -0800 +++ b/kernel/resource.c 2018-12-20 11:48:42.827771932 -0800 @@ -445,6 +445,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 *)) @@ -460,7 +463,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) _