Message ID | 159457119303.754248.2238364198589067082.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=9IWZ=AX=kvack.org=owner-linux-mm@kernel.org> Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA49F60D for <patchwork-linux-mm@patchwork.kernel.org>; Sun, 12 Jul 2020 16:42:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C1495206B6 for <patchwork-linux-mm@patchwork.kernel.org>; Sun, 12 Jul 2020 16:42:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C1495206B6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EB9666B000A; Sun, 12 Jul 2020 12:42:51 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E905B6B000C; Sun, 12 Jul 2020 12:42:51 -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 D7E466B000D; Sun, 12 Jul 2020 12:42:51 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0146.hostedemail.com [216.40.44.146]) by kanga.kvack.org (Postfix) with ESMTP id C1DD06B000A for <linux-mm@kvack.org>; Sun, 12 Jul 2020 12:42:51 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 85820180AD815 for <linux-mm@kvack.org>; Sun, 12 Jul 2020 16:42:51 +0000 (UTC) X-FDA: 77029992942.11.place63_1205ef426ee1 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 5A821180F8B87 for <linux-mm@kvack.org>; Sun, 12 Jul 2020 16:42:51 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,dan.j.williams@intel.com,,RULES_HIT:30054:30064:30079,0,RBL:134.134.136.65:@intel.com:.lbl8.mailshell.net-62.18.0.100 64.95.201.95;04yfw4sbnq4bigk177q1kmwe1miy9ocnx4idhtwymbyezwtzhqcdwexyjnhuain.twkgkrc1f1zgznfaw5a86jpkohmytxibmx9kqj4jdyudr5xoaqzwoc5oewac1b6.y-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:26,LUA_SUMMARY:none X-HE-Tag: place63_1205ef426ee1 X-Filterd-Recvd-Size: 3861 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by imf30.hostedemail.com (Postfix) with ESMTP for <linux-mm@kvack.org>; Sun, 12 Jul 2020 16:42:49 +0000 (UTC) IronPort-SDR: FxdKmz00KxwMTQxTS0mYNnOZha/cPKb8G9FYGioKTjdPyXuBiHwyJiq9CxN115ss0p83mI6B7/ ggf7jcWw3GEw== X-IronPort-AV: E=McAfee;i="6000,8403,9680"; a="148511444" X-IronPort-AV: E=Sophos;i="5.75,344,1589266800"; d="scan'208";a="148511444" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2020 09:42:49 -0700 IronPort-SDR: ZzOMBq0ET8igwu4TZFb4M2OdcM55gg/QlESleodkOsbeBEKm9gKJZLYMr9qCqV6UMIu2eGNtXI gaVJXoQw7NRA== X-IronPort-AV: E=Sophos;i="5.75,344,1589266800"; d="scan'208";a="458998362" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2020 09:42:48 -0700 Subject: [PATCH v2 05/22] resource: Report parent to walk_iomem_res_desc() callback From: Dan Williams <dan.j.williams@intel.com> To: linux-nvdimm@lists.01.org Cc: Jason Gunthorpe <jgg@mellanox.com>, Dave Hansen <dave.hansen@linux.intel.com>, Wei Yang <richardw.yang@linux.intel.com>, Tom Lendacky <thomas.lendacky@amd.com>, peterz@infradead.org, vishal.l.verma@intel.com, ard.biesheuvel@linaro.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, hch@lst.de, joao.m.martins@oracle.com Date: Sun, 12 Jul 2020 09:26:33 -0700 Message-ID: <159457119303.754248.2238364198589067082.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <159457116473.754248.7879464730875147365.stgit@dwillia2-desk3.amr.corp.intel.com> References: <159457116473.754248.7879464730875147365.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 5A821180F8B87 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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: <linux-mm.kvack.org> |
Series |
device-dax: Support sub-dividing soft-reserved ranges
|
expand
|
diff --git a/kernel/resource.c b/kernel/resource.c index 841737bbda9e..f1175ce93a1d 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -382,10 +382,13 @@ static int find_next_iomem_res(resource_size_t start, resource_size_t end, if (p) { /* copy data */ - res->start = max(start, p->start); - res->end = min(end, p->end); - res->flags = p->flags; - res->desc = p->desc; + *res = (struct resource) { + .start = max(start, p->start), + .end = min(end, p->end), + .flags = p->flags, + .desc = p->desc, + .parent = p->parent, + }; } read_unlock(&resource_lock);
In support of detecting whether a resource might have been been claimed, report the parent to the walk_iomem_res_desc() callback. For example, the ACPI HMAT parser publishes "hmem" platform devices per target range. However, if the HMAT is disabled / missing a fallback driver can attach devices to the raw memory ranges as a fallback if it sees unclaimed / orphan "Soft Reserved" resources in the resource tree. Otherwise, find_next_iomem_res() returns a resource with garbage data from the stack allocation in __walk_iomem_res_desc() for the res->parent field. There are currently no users that expect ->child and ->sibling to be valid, and the resource_lock would be needed to traverse them. Use a compound literal to implicitly zero initialize the fields that are not being returned in addition to setting ->parent. Cc: Jason Gunthorpe <jgg@mellanox.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Wei Yang <richardw.yang@linux.intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- kernel/resource.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)