From patchwork Wed Mar 6 10:28:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zhijian X-Patchwork-Id: 13583817 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 F2D16C5475B for ; Wed, 6 Mar 2024 10:29:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 48D2A6B0088; Wed, 6 Mar 2024 05:29:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C80C6B0089; Wed, 6 Mar 2024 05:29:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1CCA66B008A; Wed, 6 Mar 2024 05:29:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 04B586B0088 for ; Wed, 6 Mar 2024 05:29:20 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D239E1402DD for ; Wed, 6 Mar 2024 10:29:19 +0000 (UTC) X-FDA: 81866242038.15.BB63AAA Received: from esa1.hc1455-7.c3s2.iphmx.com (esa1.hc1455-7.c3s2.iphmx.com [207.54.90.47]) by imf10.hostedemail.com (Postfix) with ESMTP id 8857CC0007 for ; Wed, 6 Mar 2024 10:29:17 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=fujitsu.com header.s=fj2 header.b=RIqetOi6; dmarc=pass (policy=quarantine) header.from=fujitsu.com; spf=pass (imf10.hostedemail.com: domain of lizhijian@fujitsu.com designates 207.54.90.47 as permitted sender) smtp.mailfrom=lizhijian@fujitsu.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709720957; 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=N4fPy9O32HWXOLWELOHx74LJrJKVRpVaZoQKDGw+uY0=; b=c4gp0f3DMalb9GpPPVjLqEW9eoZvOWvmicyeoyFcf0NpVTSlPxvQXjKStjwwc8i2/ilBYI MF6ic+oa8GH1toRN2OgQpnSSTLrDrmjqk4jWUq1iCFSmyPXa01Wit5P18fAuSX+bchA35X u4MrfYsZlUa7LRu/DykWJhQGFl4weAY= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=fujitsu.com header.s=fj2 header.b=RIqetOi6; dmarc=pass (policy=quarantine) header.from=fujitsu.com; spf=pass (imf10.hostedemail.com: domain of lizhijian@fujitsu.com designates 207.54.90.47 as permitted sender) smtp.mailfrom=lizhijian@fujitsu.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709720957; a=rsa-sha256; cv=none; b=IwJfNkN8i3PsbSVZZqqhKHG6T90l93xJD/nDQNICvolM0tRPqiryqb29K+Qgcm+abmGfUN miadUTCnKvORyW8OkH3ZJxj4Nfs5VyL2Zsw9byNPBKvPTMRBnfU6jCL6PbS5iC2T6qo460 q1jY2my0S/7CGGIfaLiaGW127gFTR70= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1709720957; x=1741256957; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8m938ej88oP8CU4LRmFGqeZ2eI8zznrXHFjHuzUAi80=; b=RIqetOi6rtPZ1SoTQflNwiNwVgUtbt9AYbs1rCE/RTAFuQp18ouWajdA KbSdUqqYEM/Ak+w/ARjaPcpmb/GSlCKCXB5Elbomz2PLt2+4vq45SAgju zm408zVvuB9mPuiW9omlzH2n/MRVutxEF4zxGsSgxdE/mz7BxUFazbEul TXD3fA8/g3CLOpk5LuZmejs/1kaFdNzqY0kx/BVEpRkuZ8bPnnHJA2rmU V/cLMk9tBPt4Ahe4UAn5w9rzjYSwOWIMWU1tdrATkPnlm/CLHLL09Hb22 aLvDtWtTUmz0K0SXA4UYrbzEQ3ia2KAWzCwGbSGOACuzA7lkxzLfPCWuv Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11004"; a="151260037" X-IronPort-AV: E=Sophos;i="6.06,208,1705330800"; d="scan'208";a="151260037" Received: from unknown (HELO yto-r2.gw.nic.fujitsu.com) ([218.44.52.218]) by esa1.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2024 19:29:15 +0900 Received: from yto-m1.gw.nic.fujitsu.com (yto-nat-yto-m1.gw.nic.fujitsu.com [192.168.83.64]) by yto-r2.gw.nic.fujitsu.com (Postfix) with ESMTP id 1D752C68AC for ; Wed, 6 Mar 2024 19:29:10 +0900 (JST) Received: from kws-ab3.gw.nic.fujitsu.com (kws-ab3.gw.nic.fujitsu.com [192.51.206.21]) by yto-m1.gw.nic.fujitsu.com (Postfix) with ESMTP id 52C5AD2BA6 for ; Wed, 6 Mar 2024 19:29:09 +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 C4B93202CB587 for ; Wed, 6 Mar 2024 19:29:08 +0900 (JST) Received: from localhost.localdomain (unknown [10.167.226.45]) by edo.cn.fujitsu.com (Postfix) with ESMTP id D32BA1A006D; Wed, 6 Mar 2024 18:29:07 +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 3/7] nvdimm: pmem: assign a parent resource for vmemmap region for the fsdax Date: Wed, 6 Mar 2024 18:28:42 +0800 Message-Id: <20240306102846.1020868-4-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--1.564400-10.000000 X-TMASE-MatchedRID: BlFNdihulaZXk4HjwySOxykMR2LAnMRpFInyGi5rPwK4GyTmeN+AbL8F Hrw7frluf146W0iUu2tDc4lSgrowpWptPhjDCRug9k5nZzZVBSBULRRq00o2mZsoi2XrUn/Jn6K dMrRsL14qtq5d3cxkNU8XOMKR+RhSziRYTTEaxycNH0kK2Y6lBnFLca4Td9YkovbRRC+8RtSqnf dPSmIOZvdj0cn+WGO3HBgXAGNBpen5KWrl6H4maf8jyjqYHnMRFcUQf3Yp/ridO0/GUi4gFb0fO PzpgdcEKeJ/HkAZ8Is= X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 X-Rspamd-Queue-Id: 8857CC0007 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 1fmq3aozfi5b6mgp9z65wi1e5emo8f9b X-HE-Tag: 1709720957-565614 X-HE-Meta: U2FsdGVkX19QzCwntlbzKfXcCwwa3nr6/QjAB4ztFtGluHSOPkq5laWMV3Muja9tYTft9GbIL0VAhNtMOKZi2QAvDh6rr1nOQcfznF/MH4VVu+UntxuaJ3dlaIWA3hL0f9qIWmGZosq5nyc4zgiGtzWFNLfGJms6hwDi6JSvmqRbBT8st2yCwtg+wrgoPj42OuxjR2U8LdJtMuYd94Dhf/mciMZ7bME9/wbwGnRBefIWbDaamIq/AiEKg88OaNZ1z6ruo8a8f6j8ZpxBSOIZ8WEZaTX5Up8k2LX2vwe5lNusEktux4d2D/76eicTqenJAwquikHPmZbSQe+tY1FHKdpx5TG25QbcsUExrrPQo3iw32TITDvOa7h8eaZLrRk2n4xhAVRVpDNcRxsFzIScnqUBL2Otg2M9X/TphmZqQ30Ne8v5a/BPnud6vLCU2u/GeX8rJwoLwF38MHAWi8Am+9/PvVppMbWI5ilPkzJXC22lcIUPKHw171SyZ/++Z8iXtX+uAWX1EdjaK5D2EJ3O1fComnUKlz9bWNIO/NGeUc7TGXMkZ1x/lUNRtcSIXn9/XK6oBbVlYEgbvkhl9GpM1+MkCcAM6fkjFsORzI6bCZWdSsT+HDRLFz9qH1rv/AXz0RSPfKvBR/bkJpxeRG9dow/paTfNgRYLDJ6121JKpdHAIfPgJXbVZ+44bZoQRh2z9SRSpQL7VCVISYomRmb3hJH7fB7UCjt5lU2esdSWa7/fThF/PZmHgR5Uq9MI/eSB63SZBCV/1xcF223dxcTueWjOZna6CirY5N8cUM7cwaYbYqJ+wRYdEahzOrkl2o82PVfdWng6xxxdcyLyUT9URXzHfU09+AfAwd/G2QLFt2o2NqFukZqt1Q78v1eoy9ubnJpPcqpvpXrRs5avA7fNemaLe6Gj9fNAuybtN3c1cnEh3Ei6lSrwBV4utVLlAGaxXWLxd4DsfKI= 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 fsdax, 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: Ira Weiny CC: Baoquan He CC: nvdimm@lists.linux.dev Signed-off-by: Li Zhijian --- drivers/nvdimm/pmem.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index 4e8fdcb3f1c8..b2640a3fb693 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -452,7 +452,7 @@ static int pmem_attach_disk(struct device *dev, struct nd_namespace_io *nsio = to_nd_namespace_io(&ndns->dev); struct nd_region *nd_region = to_nd_region(dev->parent); int nid = dev_to_node(dev), fua; - struct resource *res = &nsio->res; + struct resource *res = &nsio->res, *parent; struct range bb_range; struct nd_pfn *nd_pfn = NULL; struct dax_device *dax_dev; @@ -491,12 +491,15 @@ static int pmem_attach_disk(struct device *dev, fua = 0; } - if (!devm_request_mem_region(dev, res->start, resource_size(res), - dev_name(&ndns->dev))) { + parent = devm_request_mem_region(dev, res->start, resource_size(res), + dev_name(&ndns->dev)); + if (!res) { dev_warn(dev, "could not reserve region %pR\n", res); return -EBUSY; } + pgmap_parent_resource(&pmem->pgmap, parent); + disk = blk_alloc_disk(nid); if (!disk) return -ENOMEM;