From patchwork Wed Mar 6 10:28:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zhijian X-Patchwork-Id: 13583819 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDDD6C54E5D for ; Wed, 6 Mar 2024 10:29:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 57C7D6B008A; Wed, 6 Mar 2024 05:29:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5016D6B008C; Wed, 6 Mar 2024 05:29:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 272346B0095; Wed, 6 Mar 2024 05:29:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id E7A5D6B008C for ; Wed, 6 Mar 2024 05:29:20 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id C687DC04F1 for ; Wed, 6 Mar 2024 10:29:20 +0000 (UTC) X-FDA: 81866242080.14.33733B2 Received: from esa11.hc1455-7.c3s2.iphmx.com (esa11.hc1455-7.c3s2.iphmx.com [207.54.90.137]) by imf14.hostedemail.com (Postfix) with ESMTP id 5F0AF10000B for ; Wed, 6 Mar 2024 10:29:18 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=fujitsu.com header.s=fj2 header.b=r9nH0COm; spf=pass (imf14.hostedemail.com: domain of lizhijian@fujitsu.com designates 207.54.90.137 as permitted sender) smtp.mailfrom=lizhijian@fujitsu.com; dmarc=pass (policy=quarantine) header.from=fujitsu.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709720958; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=y5BbRNkr/KdSy9UgwxOtt4RHBFENlawQJP+9F0EibOE=; b=51YDC05U1mDcxE83NAJKoH9Y11xC9kCFFGdke5AKyirF/rYSpsvEy5X5e6nsduIxSsERoz 5DIXVRQ25b2z3+hEmAbExqrsIhaU4muXL8O77r0RxLj/VYmD6ctD2Ulh4C5pafg++gh7qy Cn5yEolhDzIIw+br3/eIKDkx6dyy/eg= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=fujitsu.com header.s=fj2 header.b=r9nH0COm; spf=pass (imf14.hostedemail.com: domain of lizhijian@fujitsu.com designates 207.54.90.137 as permitted sender) smtp.mailfrom=lizhijian@fujitsu.com; dmarc=pass (policy=quarantine) header.from=fujitsu.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709720958; a=rsa-sha256; cv=none; b=k2bCLtq/5uqwX/JL1HEM6JTkdDMRuUFl8ek4Hnifbh822QjE3iPSH4u0h6W4Np9GSuKssS yP0R9sx9uMaTF6loIkXQsBYxCBIptKw7runN1gCx0VJn+14sYndbb8RKQviV32abCIzJU8 dO0wBTnhg7g1ddR/vDC4o3fPx/xhWO0= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1709720959; x=1741256959; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZZY/OmJnWGlv4sXJ9ctR7zLIBkL6jlFxWOynKDfrnCI=; b=r9nH0COmNp3bZYlgnErxZCO+esBdafH5wuDmO/mbCPXPhTOWN6rB+5Mw AlGJZ/TdnG2ZFMmqzkLWUwXuYDWUPD8lG88I73/4QMTVhNg7X8OSlT5dz vUDwNDphei6wx9OZ2trSyutU2pL+GgSkHL+0lskTLt3LiAnOkr2ucMWjb JM40C6/dXTUV+dTODajl2cbmaoeFCKGbsQQ/fhwyzNUJVZ0f5Q9pr6R30 1thyQPrIvd7YmDVGaMRbWP3J2SKYjLGae7u8cUWxtlsT7pLR+SrKmU7Tu CK8MkWpSTtblsxBJoMNFY8Ml8w9Fb/L7x8KQ1Ww4cl0N1EyHix0jbx+0j w==; X-IronPort-AV: E=McAfee;i="6600,9927,11004"; a="130783557" X-IronPort-AV: E=Sophos;i="6.06,208,1705330800"; d="scan'208";a="130783557" Received: from unknown (HELO oym-r1.gw.nic.fujitsu.com) ([210.162.30.89]) by esa11.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2024 19:29:16 +0900 Received: from oym-m4.gw.nic.fujitsu.com (oym-nat-oym-m4.gw.nic.fujitsu.com [192.168.87.61]) by oym-r1.gw.nic.fujitsu.com (Postfix) with ESMTP id 296E9D4801 for ; Wed, 6 Mar 2024 19:29:11 +0900 (JST) Received: from kws-ab3.gw.nic.fujitsu.com (kws-ab3.gw.nic.fujitsu.com [192.51.206.21]) by oym-m4.gw.nic.fujitsu.com (Postfix) with ESMTP id 1F13DD5D17 for ; Wed, 6 Mar 2024 19:29:10 +0900 (JST) Received: from edo.cn.fujitsu.com (edo.cn.fujitsu.com [10.167.33.5]) by kws-ab3.gw.nic.fujitsu.com (Postfix) with ESMTP id 96F09202CB587 for ; Wed, 6 Mar 2024 19:29:09 +0900 (JST) Received: from localhost.localdomain (unknown [10.167.226.45]) by edo.cn.fujitsu.com (Postfix) with ESMTP id A5E001A006A; Wed, 6 Mar 2024 18:29:08 +0800 (CST) From: Li Zhijian To: linux-kernel@vger.kernel.org Cc: y-goto@fujitsu.com, Alison Schofield , Andrew Morton , Baoquan He , Borislav Petkov , Dan Williams , Dave Hansen , Dave Jiang , Greg Kroah-Hartman , hpa@zytor.com, Ingo Molnar , Ira Weiny , Thomas Gleixner , Vishal Verma , linux-cxl@vger.kernel.org, linux-mm@kvack.org, nvdimm@lists.linux.dev, x86@kernel.org, kexec@lists.infradead.org, Li Zhijian Subject: [PATCH v3 4/7] dax: pmem: assign a parent resource for vmemmap region for the devdax Date: Wed, 6 Mar 2024 18:28:43 +0800 Message-Id: <20240306102846.1020868-5-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240306102846.1020868-1-lizhijian@fujitsu.com> References: <20240306102846.1020868-1-lizhijian@fujitsu.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSS-9.1.0.1417-9.0.0.1002-28234.006 X-TM-AS-User-Approved-Sender: Yes X-TMASE-Version: IMSS-9.1.0.1417-9.0.1002-28234.006 X-TMASE-Result: 10--5.083400-10.000000 X-TMASE-MatchedRID: Q3OJUoK6MKVXk4HjwySOxykMR2LAnMRpFInyGi5rPwK4GyTmeN+AbD13 GoPFA1HFIvrftAIhWmLy9zcRSkKatS9AD6DbcToHEVuC0eNRYvKZIt4iAQN6P6oDeu6wu7bqj26 lKB/EzKHoHOpl9ZcDR4Ay6p60ZV62fJ5/bZ6npdg7AFczfjr/7Cf8pL7Z+mamZiZ008tHBX0M7U m3uTFNcAFzvFI3lI92rZlDJo+ExYU= X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 X-Rspamd-Queue-Id: 5F0AF10000B X-Rspam-User: X-Stat-Signature: j9iyn8mtzix51q68pbk8ch4ohzui1u8g X-Rspamd-Server: rspam01 X-HE-Tag: 1709720958-779410 X-HE-Meta: U2FsdGVkX1+Sl1Qzpm5inVpbr6PacZKru8T40BrK/BE4kQWoFoYpcv2yqAl3Hp8J2NBnxuJYO25X47GArAm4gvbud5ImIvKPKn2ke9cRaQpx3gyHX2xCjhdHOFm9ID65dqmTqYpj3TRVtaOvv5mZ8CLHjyeUzDeuLJyME4l4HNCdoWGCZjjQtjPLcIvdq9PJu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jjs2PCjGCM2c9iUSt+rER3z+uqo2kDDziYS5GdKJZCEWgFzzMcqDA8bqmx+6JgXOJPCOJIPT3c4WWFa5N68ZMPucMAixfdr9TpOoV 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: List-Subscribe: List-Unsubscribe: When the pmem is configured as devdax, set the vmemmap region as a child of the namespace region so that it can be registered as a separate resource later. CC: Dan Williams CC: Vishal Verma CC: Dave Jiang CC: Baoquan He CC: nvdimm@lists.linux.dev CC: linux-cxl@vger.kernel.org Signed-off-by: Li Zhijian --- drivers/dax/pmem.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/dax/pmem.c b/drivers/dax/pmem.c index f3c6c67b8412..6ffeb81e6c7c 100644 --- a/drivers/dax/pmem.c +++ b/drivers/dax/pmem.c @@ -21,6 +21,7 @@ static struct dev_dax *__dax_pmem_probe(struct device *dev) struct nd_dax *nd_dax = to_nd_dax(dev); struct nd_pfn *nd_pfn = &nd_dax->nd_pfn; struct nd_region *nd_region = to_nd_region(dev->parent); + struct resource *parent; ndns = nvdimm_namespace_common_probe(dev); if (IS_ERR(ndns)) @@ -39,8 +40,9 @@ static struct dev_dax *__dax_pmem_probe(struct device *dev) pfn_sb = nd_pfn->pfn_sb; offset = le64_to_cpu(pfn_sb->dataoff); nsio = to_nd_namespace_io(&ndns->dev); - if (!devm_request_mem_region(dev, nsio->res.start, offset, - dev_name(&ndns->dev))) { + parent = devm_request_mem_region(dev, nsio->res.start, offset, + dev_name(&ndns->dev)); + if (!parent) { dev_warn(dev, "could not reserve metadata\n"); return ERR_PTR(-EBUSY); } @@ -66,6 +68,8 @@ static struct dev_dax *__dax_pmem_probe(struct device *dev) .memmap_on_memory = false, }; + pgmap_parent_resource(&pgmap, parent); + return devm_create_dev_dax(&data); }