Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2565611imu; Thu, 24 Jan 2019 15:22:33 -0800 (PST) X-Google-Smtp-Source: ALg8bN6o0zsiaa8T1UhLNVt59eyKpDGIQgE0xAMqX8teJrSWzmpjwQdF5AzgRoSRLG4HD0ZIluFQ X-Received: by 2002:a17:902:f64:: with SMTP id 91mr8497270ply.132.1548372153727; Thu, 24 Jan 2019 15:22:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548372153; cv=none; d=google.com; s=arc-20160816; b=XJkifrc6L5oo8mwkzkxcOo6jtWqJFi1nR5U65zYEMFMOGDNLSWlQwx68qy88VwC/Jr 5ujG7ORJa0uyNLGSjVbvMgj0DLh65c3jQZebJRXAyOysJ5YeaYw+kSRN+ZSGBSOEF3wQ QIoeo2Ymvt+Niq6pYkozIQfJVQ36I0RgUquxSlRA3jhGX7rwnTm5q46clv7J6WzuglgW fDokWuNsb8aga4EZ01Rui3BLBeOZlfToMqKDEH633LypitoXvE8psJ6i7BaBp21BjDLe cVWPP7HrX882PbOX2rBvHexS9+vLLTiQHg3iPjVnjqp6qWFg6SPYbpggTEtUWf4x/Qs3 fugw== 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=pLfVhbANs+dHRF061J8403dGvp1pUAcAUzYH31HwZOg=; b=w1R4ltZntCZ88h6Q3ZNWC8KO0tA/UbRa0ONnA0+92tk43ba1oPpNM/TgPVaF79/yA0 JHjDy9yE3kk9IlBA4UqyhIaq2+GFe15cjZ6cSCFgRfkZkeG57toZ8NjHdkQ0XZbdBfL3 WBoQP9kEr5qcEU1jeQD55+jy0JGf86fVasLUu4/vgKE+mrcCbJSzY03413M79zrPXk11 qV7341ysUrUM44QnoenS+EsNSesS0Lat9Yz3MIxTPn2WnpYlpmBRqPu3Otdr94YXpfhv DzndZFwsTqRQfLdResMSjTgAqKZ8OhCHwvpmbDYpvuAQfEXOD33c5gNMWd0iBm5l2Xd5 zaGQ== 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 t3si23041842plo.69.2019.01.24.15.22.18; Thu, 24 Jan 2019 15:22:33 -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 S1728143AbfAXXV6 (ORCPT + 99 others); Thu, 24 Jan 2019 18:21:58 -0500 Received: from mga11.intel.com ([192.55.52.93]:37749 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728004AbfAXXV5 (ORCPT ); Thu, 24 Jan 2019 18:21:57 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jan 2019 15:21:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,518,1539673200"; d="scan'208";a="109574602" Received: from viggo.jf.intel.com (HELO localhost.localdomain) ([10.54.77.144]) by orsmga007.jf.intel.com with ESMTP; 24 Jan 2019 15:21:56 -0800 Subject: [PATCH 4/5] dax/kmem: let walk_system_ram_range() search child resources To: linux-kernel@vger.kernel.org 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-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: Thu, 24 Jan 2019 15:14:47 -0800 References: <20190124231441.37A4A305@viggo.jf.intel.com> In-Reply-To: <20190124231441.37A4A305@viggo.jf.intel.com> Message-Id: <20190124231447.74358AA5@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: 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-01-24 15:13:15.482199536 -0800 +++ b/kernel/resource.c 2019-01-24 15:13:15.486199536 -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) _