From patchwork Mon Oct 22 20:13:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Hansen X-Patchwork-Id: 10652443 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C200C14BB for ; Mon, 22 Oct 2018 20:19:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD1DE2916B for ; Mon, 22 Oct 2018 20:19:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0A6F2916E; Mon, 22 Oct 2018 20:19:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F3492916B for ; Mon, 22 Oct 2018 20:19:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E93056B026A; Mon, 22 Oct 2018 16:18:50 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id DCC0F6B026B; Mon, 22 Oct 2018 16:18:50 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C1BC76B026C; Mon, 22 Oct 2018 16:18:50 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by kanga.kvack.org (Postfix) with ESMTP id 760066B026A for ; Mon, 22 Oct 2018 16:18:50 -0400 (EDT) Received: by mail-pg1-f199.google.com with SMTP id x2-v6so30236805pgr.8 for ; Mon, 22 Oct 2018 13:18:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:subject:to:cc :from:date:references:in-reply-to:message-id; bh=sClhAVcJP/TIupWRfcVTdTIK5HemsoApwdW9D6IlpV4=; b=sWD+y393lZhEsZi+HcZXJZ3FBT4dQOE3173S2dshR4lSrSXsRbwz1nVFfDWtoywI1a dCF0OYu7s9UJSMWgga4IPtBjH/4+8R3jeNuErI31+zWapMHownui2lftC/H8EL3JSLYR LDY7IzRyTHVNydJ2Epfohg3pKuNZ3FfJsDaSsI9zTptNJCpfpUSwbwePxV7tUrTurvM/ o17/pFIg+pxuK4b+jCc3VZWKEd9x74DaoJ7tpAziaT4czU1cSbd2EU9hk8Ik6NPnXcm2 9jYgiuPnPK1fcVkfDDOXyEyw1J7xw8j9JFQshyeB9h8bcZJF4zqKft4obwMSBYahb7Jg 3AHA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dave.hansen@linux.intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=dave.hansen@linux.intel.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: ABuFfohJxzvdCydgg3g9o3WREOJQJfBkKx0pnm5D7nka9XegBzbccbFl IAf6jtj+0tSndNQN0sMHPBy/6YPlH9BbxqAK1rzx+JCt6NXnrYBenwed+Y1KC83XSTO4yCsm0rw qaaWFez8lfNLSzmjV2xcqfVPbSkj061tjHIJm1zntxsIeHxtVih6M+1oQDpMSwg4tHA== X-Received: by 2002:a17:902:45a5:: with SMTP id n34-v6mr40053568pld.341.1540239530138; Mon, 22 Oct 2018 13:18:50 -0700 (PDT) X-Google-Smtp-Source: ACcGV62p+8213tQmnbltVQ4zn7ApdePmiebhhvOJO6xz19UfiLGR8jF0RNRFLw5BZGNCA3n59pZF X-Received: by 2002:a17:902:45a5:: with SMTP id n34-v6mr40053536pld.341.1540239529404; Mon, 22 Oct 2018 13:18:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540239529; cv=none; d=google.com; s=arc-20160816; b=RO2fTRNzI9+vjaGKQrixkFpMpXQbYW/Xhddp39vxnzw3+nHWDowronQHGR3aUtGRm/ +f2ZtKLqVfUxMdd4gIgbRMPZOpO145ll0BhxZ91A18ESBtVkMGuo8QUpGKG7n4lvYtEe XsjmIJB+ExETOBsNN8BvXtFqqjb0I2sgJHej4/tShVArUsnal3E5nvA62pp4mCmUwQok KXENYSrOP+S4z06uubqp8g0ggnmqJcaISggOAMFzGj7A1JMmBromappddckUuGBeTTfe N/y6NOMIG4fb9fC9FcH0dvQEvvF7pIEXHLrJt3/UWjuk+ffDe/TGVMwH/Zc7NnABckAH wc8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:in-reply-to:references:date:from:cc:to:subject; bh=sClhAVcJP/TIupWRfcVTdTIK5HemsoApwdW9D6IlpV4=; b=LrxDWkc6LJcIHQfD5lJJsZwjN0Lu7w3dX7OQFkTPs3V9DH6aD2uyY2StrmYUgxvMpC /21bakFFM/fFl7ISZ9T/+5fFARTOmIVLJ7rpdzC5I3ID5kLT5CnPcZb9UZnn1gYfuzQD 3F82r9eLRXJCo/Zm5mfxFTobGM1yKT9f9do2MHODNw8IgK/5bxYBcYGknzxjBL+14QGs Q7yRBih3nTUywYJUM6qlPm5fWzlmRFG+hB590EPdbQoXkBTk1xkfOw0ZADq5ukwc9VGA b+Shh9iVH2LilIH8snAq6hA/hArVPcrv19siQzpCKTDP6vNOQimpkzumLamiHhkTLWye uhtA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dave.hansen@linux.intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=dave.hansen@linux.intel.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga05.intel.com (mga05.intel.com. [192.55.52.43]) by mx.google.com with ESMTPS id g10-v6si32754692plt.212.2018.10.22.13.18.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Oct 2018 13:18:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dave.hansen@linux.intel.com designates 192.55.52.43 as permitted sender) client-ip=192.55.52.43; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dave.hansen@linux.intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=dave.hansen@linux.intel.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Oct 2018 13:18:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,413,1534834800"; d="scan'208";a="101693469" Received: from viggo.jf.intel.com (HELO localhost.localdomain) ([10.54.77.144]) by orsmga001.jf.intel.com with ESMTP; 22 Oct 2018 13:18:48 -0700 Subject: [PATCH 8/9] 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 From: Dave Hansen Date: Mon, 22 Oct 2018 13:13:31 -0700 References: <20181022201317.8558C1D8@viggo.jf.intel.com> In-Reply-To: <20181022201317.8558C1D8@viggo.jf.intel.com> Message-Id: <20181022201331.8DDC3CDD@viggo.jf.intel.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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-10-22 13:12:24.565930386 -0700 +++ b/kernel/resource.c 2018-10-22 13:12:24.572930386 -0700 @@ -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)