From patchwork Wed Jan 24 20:03:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 191750 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp1233566dyi; Wed, 24 Jan 2024 12:19:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IF4jVLuUxoXGAiGIEHj5ntkZbFA8RimEm1Ct767jd7urwl5UjD+jL+NNjZdo+BNRQpD+/At X-Received: by 2002:a17:90a:5588:b0:291:25a7:ecdf with SMTP id c8-20020a17090a558800b0029125a7ecdfmr86632pji.53.1706127546161; Wed, 24 Jan 2024 12:19:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706127546; cv=pass; d=google.com; s=arc-20160816; b=udEE1meFOkYMDTSqiuzF97L/X4v5MpYmKNBPAXrWK87T5iWVKzW7+vMTanY6vysFrh 8MdQOM40iwBHWwCXIhtzxN2q/j1fWAE5sBKRJ0eG5zk2019aHy5KuJXDOPom5UFt3RNn L4nuwW0/VGw/KdbKzi8p9QwTNjiPGveTzgRpoTRqrRbw/EzzF1uF8Q985f37ZN3JvZc6 YcF6yMw8LtMsm15NypCXyRbDtY5l8A3K49ldaH5J/Yhh2h1rBwhPLTUMX1AnsZZdLusV k+/rxA/zHEi/wc9/dvASmwQrUJao011rtdwi4X4+HVdTTN77UwSBqqvSZTuvrerYuTVI CasA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=x3NMPmSjdzn5PoJGblKVVqBtL8cNU4oLXt55rtggBJM=; fh=+BeaWZRadguR9y+9h7pbJ5UtmwqKwJoFWKh1eOMbEo0=; b=dJEJzq1JSv41SDQW3d9qMjHVDO6MfLqL4dsHjsdNdfquOE1YUL5uaBZhr7lKkg+l9w c2quF6i7R8cht4qP3IJ6fYICzlKmcvtX+emgJcKT1PtRn5j/hhkCrXIT1o4sP04QCwMu gpW2/zuT0BH/XUVfCfGCyrFmG8iRQtx7vCa9DsrFwRtoqvI/AzfdH5yU8uL4XWVWKM1b Hd8cpNRvLBVqWvRNDBzZYSG5L9GwXfc5/SMGoluni2vZSGp2GJG/uDrWdyh4qBv2Rv3h IQM2PXaQfPUK1M6XhHAHwW7Qi4aXBJXO13X7LoIviM7xQ4qk6ZkumHMwbXnb4WKPgHXY 44tg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WlaPMOhO; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-37625-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37625-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id q11-20020a17090a304b00b002907545330dsi68400pjl.89.2024.01.24.12.19.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 12:19:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37625-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WlaPMOhO; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-37625-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37625-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id A8DCCB227CC for ; Wed, 24 Jan 2024 20:05:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E13E91350F9; Wed, 24 Jan 2024 20:04:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WlaPMOhO" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3CDD132C26; Wed, 24 Jan 2024 20:04:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706126665; cv=none; b=YnmqMw+Kb6Vk5n7EVsj5FVLNns+h7aLMsrl7w77121Ly3QyITstwbw/rfGtvygB2zPtfKC2lhUFQY6WDdoe3a06WEYKZPFWE9i0dFKZZgu9RXb8LYdzdF0B2xL1D4qQhj2UHDh8auy/AabnCoWAu+3xlgI1ObTzpsI3L/TN2jwQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706126665; c=relaxed/simple; bh=z6bfTONvTKy2Dv6F2DgzIglLVmzBa9MpFrVu5VmluWs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gEXcjPjjk30sA84U/6+uBbTgw5fHZ2/69zL0ih04im6fWPBEDTvQ5c1lp3uSaD8NLu9S2O+BVs47vjTp0JutaimR9YaedRrkYNAiDco7gVx1QyF0u6NVNzclScYSx/PJM+bBT5dYqAxUjVwVh3Q1SMAW+pRAnOsdgTyd1/bMcX8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=WlaPMOhO; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706126663; x=1737662663; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=z6bfTONvTKy2Dv6F2DgzIglLVmzBa9MpFrVu5VmluWs=; b=WlaPMOhOKKnf7MTwxzzO02kgp6CSbPJrWIBi8VE8tYjDUroVdsMO4sUg eDyRCTQYAaxy3xu9sBWBBs553/P8AZGE8CpYmhCDKK49SScOUCS03Low6 uYiVqmtFdwumuSHnKkknzembbs5U09DYG0Pz5owaQrn5TDG+nIvnBvxyq iU6pxqUWIfHm4l30i9/FzDKrWb5m7kUiObvyRUnk6NU9cqPvYLASPHLSf pTgrRG92P73vPmMhEsGfeAFqBxriQ2iYAp7l/rglwY7NQZSj7cMbk34JQ ZA1G04snrXKbKorPslLuvjAh+3EEMIdacgdA6EO0nIDMnEdyH5MB56o8K Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="1836091" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="1836091" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2024 12:04:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="1117735117" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="1117735117" Received: from vverma7-mobl3.amr.corp.intel.com (HELO [10.0.0.223]) ([10.251.14.61]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2024 12:04:20 -0800 From: Vishal Verma Date: Wed, 24 Jan 2024 12:03:46 -0800 Subject: [PATCH v7 1/5] dax/bus.c: replace driver-core lock usage by a local rwsem Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240124-vv-dax_abi-v7-1-20d16cb8d23d@intel.com> References: <20240124-vv-dax_abi-v7-0-20d16cb8d23d@intel.com> In-Reply-To: <20240124-vv-dax_abi-v7-0-20d16cb8d23d@intel.com> To: Dan Williams , Vishal Verma , Dave Jiang , Andrew Morton , Oscar Salvador Cc: linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, David Hildenbrand , Dave Hansen , Huang Ying , Greg Kroah-Hartman , Matthew Wilcox , linux-mm@kvack.org X-Mailer: b4 0.13-dev-a684c X-Developer-Signature: v=1; a=openpgp-sha256; l=15115; i=vishal.l.verma@intel.com; h=from:subject:message-id; bh=z6bfTONvTKy2Dv6F2DgzIglLVmzBa9MpFrVu5VmluWs=; b=owGbwMvMwCXGf25diOft7jLG02pJDKkbc51O5uTq3p8jHv17fob9PPetu5yuljjb5DLHMd+5f VBhS41oRykLgxgXg6yYIsvfPR8Zj8ltz+cJTHCEmcPKBDKEgYtTACbi1cbwP+HLTeWpMhrz4/d/ mrTk9bWt08V2SxzUmr4rpD03Nu90+itGhv67b9d0X7jxQ+7sovrYt5+f1D8/9zj118s/ZvXzZih eXc4NAA== X-Developer-Key: i=vishal.l.verma@intel.com; a=openpgp; fpr=F8682BE134C67A12332A2ED07AFA61BEA3B84DFF X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789004397976491156 X-GMAIL-MSGID: 1789004397976491156 The dax driver incorrectly used driver-core device locks to protect internal dax region and dax device configuration structures. Replace the device lock usage with a local rwsem, one each for dax region configuration and dax device configuration. As a result of this conversion, no device_lock() usage remains in dax/bus.c. Cc: Dan Williams Reported-by: Greg Kroah-Hartman Signed-off-by: Vishal Verma Reviewed-by: Alison Schofield --- drivers/dax/bus.c | 220 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 157 insertions(+), 63 deletions(-) diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c index 1ff1ab5fa105..cb148f74ceda 100644 --- a/drivers/dax/bus.c +++ b/drivers/dax/bus.c @@ -12,6 +12,18 @@ static DEFINE_MUTEX(dax_bus_lock); +/* + * All changes to the dax region configuration occur with this lock held + * for write. + */ +DECLARE_RWSEM(dax_region_rwsem); + +/* + * All changes to the dax device configuration occur with this lock held + * for write. + */ +DECLARE_RWSEM(dax_dev_rwsem); + #define DAX_NAME_LEN 30 struct dax_id { struct list_head list; @@ -180,7 +192,7 @@ static u64 dev_dax_size(struct dev_dax *dev_dax) u64 size = 0; int i; - device_lock_assert(&dev_dax->dev); + WARN_ON_ONCE(!rwsem_is_locked(&dax_dev_rwsem)); for (i = 0; i < dev_dax->nr_range; i++) size += range_len(&dev_dax->ranges[i].range); @@ -194,8 +206,15 @@ static int dax_bus_probe(struct device *dev) struct dev_dax *dev_dax = to_dev_dax(dev); struct dax_region *dax_region = dev_dax->region; int rc; + u64 size; - if (dev_dax_size(dev_dax) == 0 || dev_dax->id < 0) + rc = down_read_interruptible(&dax_dev_rwsem); + if (rc) + return rc; + size = dev_dax_size(dev_dax); + up_read(&dax_dev_rwsem); + + if (size == 0 || dev_dax->id < 0) return -ENXIO; rc = dax_drv->probe(dev_dax); @@ -283,7 +302,7 @@ static unsigned long long dax_region_avail_size(struct dax_region *dax_region) resource_size_t size = resource_size(&dax_region->res); struct resource *res; - device_lock_assert(dax_region->dev); + WARN_ON_ONCE(!rwsem_is_locked(&dax_region_rwsem)); for_each_dax_region_resource(dax_region, res) size -= resource_size(res); @@ -295,10 +314,13 @@ static ssize_t available_size_show(struct device *dev, { struct dax_region *dax_region = dev_get_drvdata(dev); unsigned long long size; + int rc; - device_lock(dev); + rc = down_read_interruptible(&dax_region_rwsem); + if (rc) + return rc; size = dax_region_avail_size(dax_region); - device_unlock(dev); + up_read(&dax_region_rwsem); return sprintf(buf, "%llu\n", size); } @@ -314,10 +336,12 @@ static ssize_t seed_show(struct device *dev, if (is_static(dax_region)) return -EINVAL; - device_lock(dev); + rc = down_read_interruptible(&dax_region_rwsem); + if (rc) + return rc; seed = dax_region->seed; rc = sprintf(buf, "%s\n", seed ? dev_name(seed) : ""); - device_unlock(dev); + up_read(&dax_region_rwsem); return rc; } @@ -333,14 +357,18 @@ static ssize_t create_show(struct device *dev, if (is_static(dax_region)) return -EINVAL; - device_lock(dev); + rc = down_read_interruptible(&dax_region_rwsem); + if (rc) + return rc; youngest = dax_region->youngest; rc = sprintf(buf, "%s\n", youngest ? dev_name(youngest) : ""); - device_unlock(dev); + up_read(&dax_region_rwsem); return rc; } +static struct dev_dax *__devm_create_dev_dax(struct dev_dax_data *data); + static ssize_t create_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { @@ -358,7 +386,9 @@ static ssize_t create_store(struct device *dev, struct device_attribute *attr, if (val != 1) return -EINVAL; - device_lock(dev); + rc = down_write_killable(&dax_region_rwsem); + if (rc) + return rc; avail = dax_region_avail_size(dax_region); if (avail == 0) rc = -ENOSPC; @@ -369,7 +399,7 @@ static ssize_t create_store(struct device *dev, struct device_attribute *attr, .id = -1, .memmap_on_memory = false, }; - struct dev_dax *dev_dax = devm_create_dev_dax(&data); + struct dev_dax *dev_dax = __devm_create_dev_dax(&data); if (IS_ERR(dev_dax)) rc = PTR_ERR(dev_dax); @@ -387,7 +417,7 @@ static ssize_t create_store(struct device *dev, struct device_attribute *attr, rc = len; } } - device_unlock(dev); + up_write(&dax_region_rwsem); return rc; } @@ -417,7 +447,7 @@ static void trim_dev_dax_range(struct dev_dax *dev_dax) struct range *range = &dev_dax->ranges[i].range; struct dax_region *dax_region = dev_dax->region; - device_lock_assert(dax_region->dev); + WARN_ON_ONCE(!rwsem_is_locked(&dax_region_rwsem)); dev_dbg(&dev_dax->dev, "delete range[%d]: %#llx:%#llx\n", i, (unsigned long long)range->start, (unsigned long long)range->end); @@ -435,7 +465,7 @@ static void free_dev_dax_ranges(struct dev_dax *dev_dax) trim_dev_dax_range(dev_dax); } -static void unregister_dev_dax(void *dev) +static void __unregister_dev_dax(void *dev) { struct dev_dax *dev_dax = to_dev_dax(dev); @@ -447,6 +477,17 @@ static void unregister_dev_dax(void *dev) put_device(dev); } +static void unregister_dev_dax(void *dev) +{ + if (rwsem_is_locked(&dax_region_rwsem)) + return __unregister_dev_dax(dev); + + if (WARN_ON_ONCE(down_write_killable(&dax_region_rwsem) != 0)) + return; + __unregister_dev_dax(dev); + up_write(&dax_region_rwsem); +} + static void dax_region_free(struct kref *kref) { struct dax_region *dax_region; @@ -463,11 +504,10 @@ static void dax_region_put(struct dax_region *dax_region) /* a return value >= 0 indicates this invocation invalidated the id */ static int __free_dev_dax_id(struct dev_dax *dev_dax) { - struct device *dev = &dev_dax->dev; struct dax_region *dax_region; int rc = dev_dax->id; - device_lock_assert(dev); + WARN_ON_ONCE(!rwsem_is_locked(&dax_dev_rwsem)); if (!dev_dax->dyn_id || dev_dax->id < 0) return -1; @@ -480,12 +520,13 @@ static int __free_dev_dax_id(struct dev_dax *dev_dax) static int free_dev_dax_id(struct dev_dax *dev_dax) { - struct device *dev = &dev_dax->dev; int rc; - device_lock(dev); + rc = down_write_killable(&dax_dev_rwsem); + if (rc) + return rc; rc = __free_dev_dax_id(dev_dax); - device_unlock(dev); + up_write(&dax_dev_rwsem); return rc; } @@ -519,8 +560,14 @@ static ssize_t delete_store(struct device *dev, struct device_attribute *attr, if (!victim) return -ENXIO; - device_lock(dev); - device_lock(victim); + rc = down_write_killable(&dax_region_rwsem); + if (rc) + return rc; + rc = down_write_killable(&dax_dev_rwsem); + if (rc) { + up_write(&dax_region_rwsem); + return rc; + } dev_dax = to_dev_dax(victim); if (victim->driver || dev_dax_size(dev_dax)) rc = -EBUSY; @@ -541,12 +588,12 @@ static ssize_t delete_store(struct device *dev, struct device_attribute *attr, } else rc = -EBUSY; } - device_unlock(victim); + up_write(&dax_dev_rwsem); /* won the race to invalidate the device, clean it up */ if (do_del) devm_release_action(dev, unregister_dev_dax, victim); - device_unlock(dev); + up_write(&dax_region_rwsem); put_device(victim); return rc; @@ -658,16 +705,15 @@ static void dax_mapping_release(struct device *dev) put_device(parent); } -static void unregister_dax_mapping(void *data) +static void __unregister_dax_mapping(void *data) { struct device *dev = data; struct dax_mapping *mapping = to_dax_mapping(dev); struct dev_dax *dev_dax = to_dev_dax(dev->parent); - struct dax_region *dax_region = dev_dax->region; dev_dbg(dev, "%s\n", __func__); - device_lock_assert(dax_region->dev); + WARN_ON_ONCE(!rwsem_is_locked(&dax_region_rwsem)); dev_dax->ranges[mapping->range_id].mapping = NULL; mapping->range_id = -1; @@ -675,28 +721,37 @@ static void unregister_dax_mapping(void *data) device_unregister(dev); } +static void unregister_dax_mapping(void *data) +{ + if (rwsem_is_locked(&dax_region_rwsem)) + return __unregister_dax_mapping(data); + + if (WARN_ON_ONCE(down_write_killable(&dax_region_rwsem) != 0)) + return; + __unregister_dax_mapping(data); + up_write(&dax_region_rwsem); +} + static struct dev_dax_range *get_dax_range(struct device *dev) { struct dax_mapping *mapping = to_dax_mapping(dev); struct dev_dax *dev_dax = to_dev_dax(dev->parent); - struct dax_region *dax_region = dev_dax->region; + int rc; - device_lock(dax_region->dev); + rc = down_write_killable(&dax_region_rwsem); + if (rc) + return NULL; if (mapping->range_id < 0) { - device_unlock(dax_region->dev); + up_write(&dax_region_rwsem); return NULL; } return &dev_dax->ranges[mapping->range_id]; } -static void put_dax_range(struct dev_dax_range *dax_range) +static void put_dax_range(void) { - struct dax_mapping *mapping = dax_range->mapping; - struct dev_dax *dev_dax = to_dev_dax(mapping->dev.parent); - struct dax_region *dax_region = dev_dax->region; - - device_unlock(dax_region->dev); + up_write(&dax_region_rwsem); } static ssize_t start_show(struct device *dev, @@ -709,7 +764,7 @@ static ssize_t start_show(struct device *dev, if (!dax_range) return -ENXIO; rc = sprintf(buf, "%#llx\n", dax_range->range.start); - put_dax_range(dax_range); + put_dax_range(); return rc; } @@ -725,7 +780,7 @@ static ssize_t end_show(struct device *dev, if (!dax_range) return -ENXIO; rc = sprintf(buf, "%#llx\n", dax_range->range.end); - put_dax_range(dax_range); + put_dax_range(); return rc; } @@ -741,7 +796,7 @@ static ssize_t pgoff_show(struct device *dev, if (!dax_range) return -ENXIO; rc = sprintf(buf, "%#lx\n", dax_range->pgoff); - put_dax_range(dax_range); + put_dax_range(); return rc; } @@ -775,7 +830,7 @@ static int devm_register_dax_mapping(struct dev_dax *dev_dax, int range_id) struct device *dev; int rc; - device_lock_assert(dax_region->dev); + WARN_ON_ONCE(!rwsem_is_locked(&dax_region_rwsem)); if (dev_WARN_ONCE(&dev_dax->dev, !dax_region->dev->driver, "region disabled\n")) @@ -821,7 +876,7 @@ static int alloc_dev_dax_range(struct dev_dax *dev_dax, u64 start, struct resource *alloc; int i, rc; - device_lock_assert(dax_region->dev); + WARN_ON_ONCE(!rwsem_is_locked(&dax_region_rwsem)); /* handle the seed alloc special case */ if (!size) { @@ -875,13 +930,12 @@ static int adjust_dev_dax_range(struct dev_dax *dev_dax, struct resource *res, r { int last_range = dev_dax->nr_range - 1; struct dev_dax_range *dax_range = &dev_dax->ranges[last_range]; - struct dax_region *dax_region = dev_dax->region; bool is_shrink = resource_size(res) > size; struct range *range = &dax_range->range; struct device *dev = &dev_dax->dev; int rc; - device_lock_assert(dax_region->dev); + WARN_ON_ONCE(!rwsem_is_locked(&dax_region_rwsem)); if (dev_WARN_ONCE(dev, !size, "deletion is handled by dev_dax_shrink\n")) return -EINVAL; @@ -907,10 +961,13 @@ static ssize_t size_show(struct device *dev, { struct dev_dax *dev_dax = to_dev_dax(dev); unsigned long long size; + int rc; - device_lock(dev); + rc = down_write_killable(&dax_dev_rwsem); + if (rc) + return rc; size = dev_dax_size(dev_dax); - device_unlock(dev); + up_write(&dax_dev_rwsem); return sprintf(buf, "%llu\n", size); } @@ -1080,17 +1137,27 @@ static ssize_t size_store(struct device *dev, struct device_attribute *attr, return -EINVAL; } - device_lock(dax_region->dev); + rc = down_write_killable(&dax_region_rwsem); + if (rc) + return rc; if (!dax_region->dev->driver) { - device_unlock(dax_region->dev); - return -ENXIO; + rc = -ENXIO; + goto err_region; } - device_lock(dev); - rc = dev_dax_resize(dax_region, dev_dax, val); - device_unlock(dev); - device_unlock(dax_region->dev); + rc = down_write_killable(&dax_dev_rwsem); + if (rc) + goto err_dev; - return rc == 0 ? len : rc; + rc = dev_dax_resize(dax_region, dev_dax, val); + +err_dev: + up_write(&dax_dev_rwsem); +err_region: + up_write(&dax_region_rwsem); + + if (rc == 0) + return len; + return rc; } static DEVICE_ATTR_RW(size); @@ -1138,18 +1205,24 @@ static ssize_t mapping_store(struct device *dev, struct device_attribute *attr, return rc; rc = -ENXIO; - device_lock(dax_region->dev); + rc = down_write_killable(&dax_region_rwsem); + if (rc) + return rc; if (!dax_region->dev->driver) { - device_unlock(dax_region->dev); + up_write(&dax_region_rwsem); + return rc; + } + rc = down_write_killable(&dax_dev_rwsem); + if (rc) { + up_write(&dax_region_rwsem); return rc; } - device_lock(dev); to_alloc = range_len(&r); if (alloc_is_aligned(dev_dax, to_alloc)) rc = alloc_dev_dax_range(dev_dax, r.start, to_alloc); - device_unlock(dev); - device_unlock(dax_region->dev); + up_write(&dax_dev_rwsem); + up_write(&dax_region_rwsem); return rc == 0 ? len : rc; } @@ -1196,13 +1269,19 @@ static ssize_t align_store(struct device *dev, struct device_attribute *attr, if (!dax_align_valid(val)) return -EINVAL; - device_lock(dax_region->dev); + rc = down_write_killable(&dax_region_rwsem); + if (rc) + return rc; if (!dax_region->dev->driver) { - device_unlock(dax_region->dev); + up_write(&dax_region_rwsem); return -ENXIO; } - device_lock(dev); + rc = down_write_killable(&dax_dev_rwsem); + if (rc) { + up_write(&dax_region_rwsem); + return rc; + } if (dev->driver) { rc = -EBUSY; goto out_unlock; @@ -1214,8 +1293,8 @@ static ssize_t align_store(struct device *dev, struct device_attribute *attr, if (rc) dev_dax->align = align_save; out_unlock: - device_unlock(dev); - device_unlock(dax_region->dev); + up_write(&dax_dev_rwsem); + up_write(&dax_region_rwsem); return rc == 0 ? len : rc; } static DEVICE_ATTR_RW(align); @@ -1325,7 +1404,7 @@ static const struct device_type dev_dax_type = { .groups = dax_attribute_groups, }; -struct dev_dax *devm_create_dev_dax(struct dev_dax_data *data) +static struct dev_dax *__devm_create_dev_dax(struct dev_dax_data *data) { struct dax_region *dax_region = data->dax_region; struct device *parent = dax_region->dev; @@ -1440,6 +1519,21 @@ struct dev_dax *devm_create_dev_dax(struct dev_dax_data *data) return ERR_PTR(rc); } + +struct dev_dax *devm_create_dev_dax(struct dev_dax_data *data) +{ + struct dev_dax *dev_dax; + int rc; + + rc = down_write_killable(&dax_region_rwsem); + if (rc) + return ERR_PTR(rc); + + dev_dax = __devm_create_dev_dax(data); + up_write(&dax_region_rwsem); + + return dev_dax; +} EXPORT_SYMBOL_GPL(devm_create_dev_dax); int __dax_driver_register(struct dax_device_driver *dax_drv, From patchwork Wed Jan 24 20:03:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 191744 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp1226462dyi; Wed, 24 Jan 2024 12:05:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IEALznKfC0MiwVAUSG4TG0ft+0toKzPmpM3PE3V2/gxcPbB3JGjqeQLF71qK6xnHGPdzbyh X-Received: by 2002:a1c:770f:0:b0:40b:5e59:ccdb with SMTP id t15-20020a1c770f000000b0040b5e59ccdbmr1548504wmi.188.1706126733782; Wed, 24 Jan 2024 12:05:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706126733; cv=pass; d=google.com; s=arc-20160816; b=q1i31oenMU/LYbiw3LyRcy0zdMtpfzfLBtYncOXng4qGyF1QgbTqf3qIJvqfhdXk7b 442ZqRsf4jmOOW41CtVHJtJ8f+XfQj/pbL1weI03WhY4q99tfCHZ5NJ+VrXCLKhlsvxQ eKEeXFH2W9lj5cHUk1NYwJuknzrudwCbirYZ1FwfkkitI2nF4kvCJC7CJANUFLGF902w O95oPWP4L2NeCbpXnQ1dacBPLdFc/Q/lgas3lwXDMXhvE4qynYriDv8rU/fOjmr/Z8/9 Hj/pjU82VJyMlt/6eGpDkmp5QuvOpOXmn8tRjHwyjURmQ8pr8+b4AmKfDbnX4aBltvL+ dUWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=AcC6QAOmr8SGg10jtCgJ40Pni6duinW4+w/MW4U+57s=; fh=+BeaWZRadguR9y+9h7pbJ5UtmwqKwJoFWKh1eOMbEo0=; b=DaEpNurLuLJKAySrQa0RADNULlwJKFqVrMlZ5D9a7JVRK8pGocxxu+LCEsabT2DkK0 zmhhNA7QlWVW2c38eyHF9Kt/a0vRsym3XSRLkphTW4JXtzEfdK9r8hiclQtpa+DB4jfZ zv2nikvB/qzj9MPNP0ZTqoi2qmWvSSJ7MkHQ+VkqDts29KXb8IAaHE5zMenmfEX4Dn+3 AG3Z1UCB37dFaiI6A3eNAmF3QnbpeKakK8feIiCnGBRBffpVaAO0283uyxIz+yPRI8uY y2yi0Lzf9v9bkGpS9VGSijtZF5v/fbb4xzzzQg2TNleXMOVNRnrDimG+UgsZ7mcFaESA D8sw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IqnnQdny; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-37626-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37626-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id q18-20020a170906361200b00a2a4a9e8b92si179684ejb.940.2024.01.24.12.05.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 12:05:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37626-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IqnnQdny; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-37626-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37626-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3F16D1F24C56 for ; Wed, 24 Jan 2024 20:05:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D37DC134727; Wed, 24 Jan 2024 20:04:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="IqnnQdny" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA13E7C091; Wed, 24 Jan 2024 20:04:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706126666; cv=none; b=iknnCXm8njK6Y0txn+JKK5LAAhesJBxFfFBa2KYXfBVWQdGOPtDFQeWpGqeN4wt6yHnn3v9iunTjTYYjiohgIkZAELXS8W8Xdq3Ajs3jLwqc/NeBhEWpT19F1z/6CDrFmQkPksUd2QWISodM/Ck85PQ/jrLLJ+V+I3r5NW7qO8g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706126666; c=relaxed/simple; bh=mYxIOVPok7zj5mr8tVu7SKhQQM/JT9jvpgs14KCdT/k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=d7UMchOmWEsdIoKL3Y/w3tRrJ4QRXleNlm69r7rOXnBSydCMQDtzP/p+0x9fqmGJV8B3TzeMTYWe4NR6eoEDTK1pxwUgmfFp80lckbGGQdh1JsCsaH+cCC7mIy39f7iFzcLQyiJXmALBj4LU9t8ssNzrbPJOQZxhc7mQMmAsV3E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=IqnnQdny; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706126665; x=1737662665; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=mYxIOVPok7zj5mr8tVu7SKhQQM/JT9jvpgs14KCdT/k=; b=IqnnQdnyYth76mX8uj/d/jLxPZ+9WJSj5lDRgCFJGYLwQSmZCCWmU+xT OPdBpz3gwOEeW6loZNpbOVD9FCw4RzEbcwodZ05tARsCIwbsOibKL47Ks vzqUZppSXPDIB1DWyjr8q4/il3nRX+vYsyxCActpJ6j8VMR6yb2axnnTZ hh/qwi3BJq7jhVdQ2KkbneKUBSQJi5P5dUv2K86d/aVJY9FQmlJNp6ROi LV6J7fe7OhX6FVNvf+evOs3O8p5cRdg1OeDQxXPocehaqRh9gcJHz8I2l 0yw6PsmnHhN+C6bO7J9HUMUOC1pnOE2E7DPW3nxFCoOAE4VFwRXU1M3Vh w==; X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="1836101" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="1836101" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2024 12:04:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="1117735125" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="1117735125" Received: from vverma7-mobl3.amr.corp.intel.com (HELO [10.0.0.223]) ([10.251.14.61]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2024 12:04:21 -0800 From: Vishal Verma Date: Wed, 24 Jan 2024 12:03:47 -0800 Subject: [PATCH v7 2/5] dax/bus.c: replace several sprintf() with sysfs_emit() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240124-vv-dax_abi-v7-2-20d16cb8d23d@intel.com> References: <20240124-vv-dax_abi-v7-0-20d16cb8d23d@intel.com> In-Reply-To: <20240124-vv-dax_abi-v7-0-20d16cb8d23d@intel.com> To: Dan Williams , Vishal Verma , Dave Jiang , Andrew Morton , Oscar Salvador Cc: linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, David Hildenbrand , Dave Hansen , Huang Ying , Greg Kroah-Hartman , Matthew Wilcox , linux-mm@kvack.org X-Mailer: b4 0.13-dev-a684c X-Developer-Signature: v=1; a=openpgp-sha256; l=5299; i=vishal.l.verma@intel.com; h=from:subject:message-id; bh=mYxIOVPok7zj5mr8tVu7SKhQQM/JT9jvpgs14KCdT/k=; b=owGbwMvMwCXGf25diOft7jLG02pJDKkbc51aNcyLd59M+vAnQJuv9cKWC28PyIbMOhQbrPNRb 5Gwv/eUjlIWBjEuBlkxRZa/ez4yHpPbns8TmOAIM4eVCWQIAxenAExkWxfD/+qY2iizk+avOY5J 8LJd2RK2fdbEB2ZbOKZFZ3Xsal646Bgjw5SvBW9Pvevi+zG/+cnxb//auSw3rG44w/3KtfNY85z J+XwA X-Developer-Key: i=vishal.l.verma@intel.com; a=openpgp; fpr=F8682BE134C67A12332A2ED07AFA61BEA3B84DFF X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789003545922787577 X-GMAIL-MSGID: 1789003545922787577 There were several places where drivers/dax/bus.c uses 'sprintf' to print sysfs data. Since a sysfs_emit() helper is available specifically for this purpose, replace all the sprintf() usage for sysfs with sysfs_emit() in this file. Cc: Dan Williams Reported-by: Greg Kroah-Hartman Signed-off-by: Vishal Verma Reviewed-by: Alison Schofield --- drivers/dax/bus.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c index cb148f74ceda..0fd948a4443e 100644 --- a/drivers/dax/bus.c +++ b/drivers/dax/bus.c @@ -269,7 +269,7 @@ static ssize_t id_show(struct device *dev, { struct dax_region *dax_region = dev_get_drvdata(dev); - return sprintf(buf, "%d\n", dax_region->id); + return sysfs_emit(buf, "%d\n", dax_region->id); } static DEVICE_ATTR_RO(id); @@ -278,8 +278,8 @@ static ssize_t region_size_show(struct device *dev, { struct dax_region *dax_region = dev_get_drvdata(dev); - return sprintf(buf, "%llu\n", (unsigned long long) - resource_size(&dax_region->res)); + return sysfs_emit(buf, "%llu\n", + (unsigned long long)resource_size(&dax_region->res)); } static struct device_attribute dev_attr_region_size = __ATTR(size, 0444, region_size_show, NULL); @@ -289,7 +289,7 @@ static ssize_t region_align_show(struct device *dev, { struct dax_region *dax_region = dev_get_drvdata(dev); - return sprintf(buf, "%u\n", dax_region->align); + return sysfs_emit(buf, "%u\n", dax_region->align); } static struct device_attribute dev_attr_region_align = __ATTR(align, 0400, region_align_show, NULL); @@ -322,7 +322,7 @@ static ssize_t available_size_show(struct device *dev, size = dax_region_avail_size(dax_region); up_read(&dax_region_rwsem); - return sprintf(buf, "%llu\n", size); + return sysfs_emit(buf, "%llu\n", size); } static DEVICE_ATTR_RO(available_size); @@ -340,7 +340,7 @@ static ssize_t seed_show(struct device *dev, if (rc) return rc; seed = dax_region->seed; - rc = sprintf(buf, "%s\n", seed ? dev_name(seed) : ""); + rc = sysfs_emit(buf, "%s\n", seed ? dev_name(seed) : ""); up_read(&dax_region_rwsem); return rc; @@ -361,7 +361,7 @@ static ssize_t create_show(struct device *dev, if (rc) return rc; youngest = dax_region->youngest; - rc = sprintf(buf, "%s\n", youngest ? dev_name(youngest) : ""); + rc = sysfs_emit(buf, "%s\n", youngest ? dev_name(youngest) : ""); up_read(&dax_region_rwsem); return rc; @@ -763,7 +763,7 @@ static ssize_t start_show(struct device *dev, dax_range = get_dax_range(dev); if (!dax_range) return -ENXIO; - rc = sprintf(buf, "%#llx\n", dax_range->range.start); + rc = sysfs_emit(buf, "%#llx\n", dax_range->range.start); put_dax_range(); return rc; @@ -779,7 +779,7 @@ static ssize_t end_show(struct device *dev, dax_range = get_dax_range(dev); if (!dax_range) return -ENXIO; - rc = sprintf(buf, "%#llx\n", dax_range->range.end); + rc = sysfs_emit(buf, "%#llx\n", dax_range->range.end); put_dax_range(); return rc; @@ -795,7 +795,7 @@ static ssize_t pgoff_show(struct device *dev, dax_range = get_dax_range(dev); if (!dax_range) return -ENXIO; - rc = sprintf(buf, "%#lx\n", dax_range->pgoff); + rc = sysfs_emit(buf, "%#lx\n", dax_range->pgoff); put_dax_range(); return rc; @@ -969,7 +969,7 @@ static ssize_t size_show(struct device *dev, size = dev_dax_size(dev_dax); up_write(&dax_dev_rwsem); - return sprintf(buf, "%llu\n", size); + return sysfs_emit(buf, "%llu\n", size); } static bool alloc_is_aligned(struct dev_dax *dev_dax, resource_size_t size) @@ -1233,7 +1233,7 @@ static ssize_t align_show(struct device *dev, { struct dev_dax *dev_dax = to_dev_dax(dev); - return sprintf(buf, "%d\n", dev_dax->align); + return sysfs_emit(buf, "%d\n", dev_dax->align); } static ssize_t dev_dax_validate_align(struct dev_dax *dev_dax) @@ -1311,7 +1311,7 @@ static ssize_t target_node_show(struct device *dev, { struct dev_dax *dev_dax = to_dev_dax(dev); - return sprintf(buf, "%d\n", dev_dax_target_node(dev_dax)); + return sysfs_emit(buf, "%d\n", dev_dax_target_node(dev_dax)); } static DEVICE_ATTR_RO(target_node); @@ -1327,7 +1327,7 @@ static ssize_t resource_show(struct device *dev, else start = dev_dax->ranges[0].range.start; - return sprintf(buf, "%#llx\n", start); + return sysfs_emit(buf, "%#llx\n", start); } static DEVICE_ATTR(resource, 0400, resource_show, NULL); @@ -1338,14 +1338,14 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, * We only ever expect to handle device-dax instances, i.e. the * @type argument to MODULE_ALIAS_DAX_DEVICE() is always zero */ - return sprintf(buf, DAX_DEVICE_MODALIAS_FMT "\n", 0); + return sysfs_emit(buf, DAX_DEVICE_MODALIAS_FMT "\n", 0); } static DEVICE_ATTR_RO(modalias); static ssize_t numa_node_show(struct device *dev, struct device_attribute *attr, char *buf) { - return sprintf(buf, "%d\n", dev_to_node(dev)); + return sysfs_emit(buf, "%d\n", dev_to_node(dev)); } static DEVICE_ATTR_RO(numa_node); From patchwork Wed Jan 24 20:03:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 191746 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp1226556dyi; Wed, 24 Jan 2024 12:05:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IEgtHSg51XOlR/xddITGnlkN1UbYa/ObDrZc8epFEeIAlgf7VNDfFiEU92YvFWPA9SY4Njj X-Received: by 2002:ac2:4188:0:b0:510:c58:e7d1 with SMTP id z8-20020ac24188000000b005100c58e7d1mr727343lfh.208.1706126744508; Wed, 24 Jan 2024 12:05:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706126744; cv=pass; d=google.com; s=arc-20160816; b=bjYoOrR7h98e+pMNNa+83p3R4/qcvItFNH2oSOJ2oPouo7IN/kyp1awZoFSZIiyCAo jE17LwgrC6awCO4o/6Ekyieczn/bboKH2HKG+J4UTYKgcH6pMit/CpHvfAFor9EJ1qkd sYc6Se2xBRiToFpyKufFhJQmo4zOPFEUkLERZoKDqBiraM8uSUFirNUqfLi0vOq6rXaA AtQ0XiKiitr7txM4mQwx9fxI4Q0A+WnfqwthQX1yNzJbtlzezLDCdfmJSij8jtlsNTPZ YLeyc82cRvLBUtHVHhksmXiNUm3sI357svs//+hCGMQOxc2q8n5lCEu24VONhEXZy1fJ DARA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=XUmZz8pgbOQyFoQipuzs/q5/a1ezSTUJLIhuIbBITmw=; fh=+BeaWZRadguR9y+9h7pbJ5UtmwqKwJoFWKh1eOMbEo0=; b=OF90QLrt7+fyTZMVuRghp8wROpEuacvt2bKzLrSumYabxTjdVE6tFk40LDZNQi0Jte 6tyCb4+2gdPVSOqhY6t9U3vi4Hk45GAcy4TNMgSDfBDBEdYYC66xn7hf8H1WqHPeC0YK 4j+EWoIWWuiS3i1uESNBSTBTq0ZFF/3mXL1q5lkLl5SfzvopqBPGktPmTYjDEtB6C1rc w0JnH1zRPaaLkrLy5s0NNHSUfc2SZGpyYi/Gikm3Qnv+JynomGUFhRdo1KpDy8LHsUZW 299QPz9ANuPLT/nSpJDYeEevd86tlPw/AlEMUZkReA54ZV6S95hCG7tLCLxEyiqsM3pS NTOQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MJkM7GP6; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-37627-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37627-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id l11-20020a1709060e0b00b00a30e8b392c4si195130eji.104.2024.01.24.12.05.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 12:05:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37627-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MJkM7GP6; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-37627-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37627-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C7BA71F25278 for ; Wed, 24 Jan 2024 20:05:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8B9951350EA; Wed, 24 Jan 2024 20:04:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="MJkM7GP6" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A544133428; Wed, 24 Jan 2024 20:04:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706126667; cv=none; b=Dmo/ZpGL7uRz9XZJV2GKiLBXDOyZ8bpyAZZcqqgXNntNl/W7VN87X/FG6UDvg5P8OinHB0auP5M/wWrFZXKSDpj70brdzyiFPBaAbrP9PJUafIdzDFtUWuv3ph9LaF7r6a3pvX4LKiQJeexsI7ltOH59Tm8UDSemWC4GDZEgoTI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706126667; c=relaxed/simple; bh=pbx8GN6oF7bpvrPHhUbumLfrIjuzdnl/0AJX9PTq6Qc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rYV+lrMEngZ/PJJRE8VFN9IQJP+x9IAlMunnMLsXBaUiQv5CM/mB3880SZk5wqok1lv+VtKcyl2Xz3pWZR5GBIrtzaaVDWnOQygp45XwnTM2F7D/75O6IoVLaIkbAjXPiYWqIclIr67VmKhi7vheoIz4uYFTDt1q8XExfUC4MqY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=MJkM7GP6; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706126665; x=1737662665; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=pbx8GN6oF7bpvrPHhUbumLfrIjuzdnl/0AJX9PTq6Qc=; b=MJkM7GP6ofo0vuI5UOFie09sf5ecwHE6gd2RQRAMct/WzoSzvtBrYU8H uknLbOAXm2fAX+qMN1jRkGE9goVwm8jj4a18giOe0eEU+nbjPOhqmeFCG HiWWoz44wiFcugfd7XcqdMIosCLS0Af+u4vrcAiRMBTb9rJ6pr7YyzIa4 C9zO6BLlX2KYp/Rmn76pQATnD+UtSSPG9cGRf9SEyK9iTH3+wrqiEZIcC zF+nf3m5EhLmDOJD9Kcr7bs4mLht1WBhBtVywaRp1zLS4mBKOwTLS0waD k3KeL7Qy3pBHVOjo9KPQyXX+8UYeKcDo9Yne6pis+cSxUPguJe6IeIngH A==; X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="1836109" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="1836109" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2024 12:04:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="1117735135" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="1117735135" Received: from vverma7-mobl3.amr.corp.intel.com (HELO [10.0.0.223]) ([10.251.14.61]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2024 12:04:22 -0800 From: Vishal Verma Date: Wed, 24 Jan 2024 12:03:48 -0800 Subject: [PATCH v7 3/5] Documentatiion/ABI: Add ABI documentation for sys-bus-dax Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240124-vv-dax_abi-v7-3-20d16cb8d23d@intel.com> References: <20240124-vv-dax_abi-v7-0-20d16cb8d23d@intel.com> In-Reply-To: <20240124-vv-dax_abi-v7-0-20d16cb8d23d@intel.com> To: Dan Williams , Vishal Verma , Dave Jiang , Andrew Morton , Oscar Salvador Cc: linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, David Hildenbrand , Dave Hansen , Huang Ying , Greg Kroah-Hartman , Matthew Wilcox , linux-mm@kvack.org X-Mailer: b4 0.13-dev-a684c X-Developer-Signature: v=1; a=openpgp-sha256; l=5934; i=vishal.l.verma@intel.com; h=from:subject:message-id; bh=pbx8GN6oF7bpvrPHhUbumLfrIjuzdnl/0AJX9PTq6Qc=; b=owGbwMvMwCXGf25diOft7jLG02pJDKkbc505nke437328TqL7m7B7XeMf4c4z14x5ZK/0LvjS 1xWGTi97ChlYRDjYpAVU2T5u+cj4zG57fk8gQmOMHNYmUCGMHBxCsBEvtQxMmzIv34xu9h1/lQW WXGViZ17Pltryjld/3Ve88XRDX2x874y/LM8U6QgKhpdXrq7oI+tdtmOgq1avXd62RekHvr6/FK NPw8A X-Developer-Key: i=vishal.l.verma@intel.com; a=openpgp; fpr=F8682BE134C67A12332A2ED07AFA61BEA3B84DFF X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789003556992084370 X-GMAIL-MSGID: 1789003556992084370 Add the missing sysfs ABI documentation for the device DAX subsystem. Various ABI attributes under this have been present since v5.1, and more have been added over time. In preparation for adding a new attribute, add this file with the historical details. Cc: Dan Williams Signed-off-by: Vishal Verma --- Documentation/ABI/testing/sysfs-bus-dax | 136 ++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-dax b/Documentation/ABI/testing/sysfs-bus-dax new file mode 100644 index 000000000000..6359f7bc9bf4 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-dax @@ -0,0 +1,136 @@ +What: /sys/bus/dax/devices/daxX.Y/align +Date: October, 2020 +KernelVersion: v5.10 +Contact: nvdimm@lists.linux.dev +Description: + (RW) Provides a way to specify an alignment for a dax device. + Values allowed are constrained by the physical address ranges + that back the dax device, and also by arch requirements. + +What: /sys/bus/dax/devices/daxX.Y/mapping +Date: October, 2020 +KernelVersion: v5.10 +Contact: nvdimm@lists.linux.dev +Description: + (WO) Provides a way to allocate a mapping range under a dax + device. Specified in the format -. + +What: /sys/bus/dax/devices/daxX.Y/mapping[0..N]/start +What: /sys/bus/dax/devices/daxX.Y/mapping[0..N]/end +What: /sys/bus/dax/devices/daxX.Y/mapping[0..N]/page_offset +Date: October, 2020 +KernelVersion: v5.10 +Contact: nvdimm@lists.linux.dev +Description: + (RO) A dax device may have multiple constituent discontiguous + address ranges. These are represented by the different + 'mappingX' subdirectories. The 'start' attribute indicates the + start physical address for the given range. The 'end' attribute + indicates the end physical address for the given range. The + 'page_offset' attribute indicates the offset of the current + range in the dax device. + +What: /sys/bus/dax/devices/daxX.Y/resource +Date: June, 2019 +KernelVersion: v5.3 +Contact: nvdimm@lists.linux.dev +Description: + (RO) The resource attribute indicates the starting physical + address of a dax device. In case of a device with multiple + constituent ranges, it indicates the starting address of the + first range. + +What: /sys/bus/dax/devices/daxX.Y/size +Date: October, 2020 +KernelVersion: v5.10 +Contact: nvdimm@lists.linux.dev +Description: + (RW) The size attribute indicates the total size of a dax + device. For creating subdivided dax devices, or for resizing + an existing device, the new size can be written to this as + part of the reconfiguration process. + +What: /sys/bus/dax/devices/daxX.Y/numa_node +Date: November, 2019 +KernelVersion: v5.5 +Contact: nvdimm@lists.linux.dev +Description: + (RO) If NUMA is enabled and the platform has affinitized the + backing device for this dax device, emit the CPU node + affinity for this device. + +What: /sys/bus/dax/devices/daxX.Y/target_node +Date: February, 2019 +KernelVersion: v5.1 +Contact: nvdimm@lists.linux.dev +Description: + (RO) The target-node attribute is the Linux numa-node that a + device-dax instance may create when it is online. Prior to + being online the device's 'numa_node' property reflects the + closest online cpu node which is the typical expectation of a + device 'numa_node'. Once it is online it becomes its own + distinct numa node. + +What: $(readlink -f /sys/bus/dax/devices/daxX.Y)/../dax_region/available_size +Date: October, 2020 +KernelVersion: v5.10 +Contact: nvdimm@lists.linux.dev +Description: + (RO) The available_size attribute tracks available dax region + capacity. This only applies to volatile hmem devices, not pmem + devices, since pmem devices are defined by nvdimm namespace + boundaries. + +What: $(readlink -f /sys/bus/dax/devices/daxX.Y)/../dax_region/size +Date: July, 2017 +KernelVersion: v5.1 +Contact: nvdimm@lists.linux.dev +Description: + (RO) The size attribute indicates the size of a given dax region + in bytes. + +What: $(readlink -f /sys/bus/dax/devices/daxX.Y)/../dax_region/align +Date: October, 2020 +KernelVersion: v5.10 +Contact: nvdimm@lists.linux.dev +Description: + (RO) The align attribute indicates alignment of the dax region. + Changes on align may not always be valid, when say certain + mappings were created with 2M and then we switch to 1G. This + validates all ranges against the new value being attempted, post + resizing. + +What: $(readlink -f /sys/bus/dax/devices/daxX.Y)/../dax_region/seed +Date: October, 2020 +KernelVersion: v5.10 +Contact: nvdimm@lists.linux.dev +Description: + (RO) The seed device is a concept for dynamic dax regions to be + able to split the region amongst multiple sub-instances. The + seed device, similar to libnvdimm seed devices, is a device + that starts with zero capacity allocated and unbound to a + driver. + +What: $(readlink -f /sys/bus/dax/devices/daxX.Y)/../dax_region/create +Date: October, 2020 +KernelVersion: v5.10 +Contact: nvdimm@lists.linux.dev +Description: + (RW) The create interface to the dax region provides a way to + create a new unconfigured dax device under the given region, which + can then be configured (with a size etc.) and then probed. + +What: $(readlink -f /sys/bus/dax/devices/daxX.Y)/../dax_region/delete +Date: October, 2020 +KernelVersion: v5.10 +Contact: nvdimm@lists.linux.dev +Description: + (WO) The delete interface for a dax region provides for deletion + of any 0-sized and idle dax devices. + +What: $(readlink -f /sys/bus/dax/devices/daxX.Y)/../dax_region/id +Date: July, 2017 +KernelVersion: v5.1 +Contact: nvdimm@lists.linux.dev +Description: + (RO) The id attribute indicates the region id of a dax region. From patchwork Wed Jan 24 20:03:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 191745 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp1226549dyi; Wed, 24 Jan 2024 12:05:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IH7BtW0tmTTvUvpmjcuISlNQTwV6FGlNoncZR9TvGOB4PrpAhugo10h58VnwvN2rr4fYS1E X-Received: by 2002:a17:90a:fb48:b0:28d:c4ff:74a2 with SMTP id iq8-20020a17090afb4800b0028dc4ff74a2mr75284pjb.47.1706126744050; Wed, 24 Jan 2024 12:05:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706126744; cv=pass; d=google.com; s=arc-20160816; b=u6CMnVg4mR07LdBVCQ5Iwyb+L3EjzSxLVuEY0TYiSpv/NZ6556spGOPK5lcRPdksK+ XueD4PMnOvsq/lw4FAZxAkaxWBOc2d1Dyh6OhvepyQaHenaNckcTy4dpgc0q63SjcRKM j6SOoCoLxOI/GIevlnaJZ9PvfsoznSqASCQH3L9nCXvmEakd3uoFvcc5DWJIN1s8nBYz BpyaEhcX4ayPvOJRvJ1ySXPoM00wBv9F2s1pbsrl6+SB+p4b+alm8OObqCw1KTBVSC4O eagGB2qVBj/k0VTqC3TxpUSQql7p7sMc5kQGscoG0eQDdxhflhu7dx9hSB8w2s4Qx7jN dTBQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=a6zYS5tHYyD516jLQ0b49vxvCgIzBSqergsiT+dJduA=; fh=+s/3acKUKKkJiV5DUPberW3D8WEdIhDOOL1Ma9aHTsw=; b=pMkRlPHLnPKXbPGgLu2+TWglbURFDfOZeqnKOtPSwelOSyCKafdVyP33jCoASFZkWY Ue6D7dst9dAPaSVFKuTtQLEXWmVq/b2AWylq9sy0MUGbcxYoG0Ps50nwax2jeVep1SXN jzjTP/4fHT7rVK7B3MJI7aq3EIM9NXVDsxOQ5wWO4ILWgkYMzFcbQxWEhjN4tMI98dVw zPpBvruwDI3wQpx1TuCaS7y2YKOUQLvfWDiuFeb/Col4IN9/LkhdC1nuy8lS2Ok694sz 0SITqOo7T9Dk7fQTnSXBczmDFU9LqitWRtKpjitZ3eW/weLhTGaCcwAMcNGfnHEQcxS5 4gNQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="i2h/fuDS"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-37628-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37628-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id gt7-20020a17090af2c700b002905d813396si48807pjb.173.2024.01.24.12.05.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 12:05:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37628-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="i2h/fuDS"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-37628-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37628-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A4815288C65 for ; Wed, 24 Jan 2024 20:05:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A31F71350F4; Wed, 24 Jan 2024 20:04:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="i2h/fuDS" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BAEEC13343B; Wed, 24 Jan 2024 20:04:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706126667; cv=none; b=cqzUdayesjZoRL9jM1tBTKim0Qgg/3QrPAU42H6TUvXCv/oaIMZd6s21opCdGFq+o8AwBfzuX142H6CW19orVYY8GmEe1XZUS8Zgx+sFDHjiwZRrrut2GMRB9NIx33MPARV20L17bNzX1rRamFaWi5usrCiMntdTEUoe5bJyfFI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706126667; c=relaxed/simple; bh=Orl+mZtfo3P92OAi6zjw0XQv4aRvq83sE++FPaqZvSw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NlSBHs3WoZptY9kH1m9RDNdzWyzlzMxQkK169yXvKl6IiQuLEh6ePqhO7sDHHoFwiB4bEONEhqiDEyf7n5gEAAKUGZcPliV8XY3sm0Rtt4vYHYad67LVDyckqRJ4YncKiAL8evZgOTFs0CiwWcRk2ZKoj5YzeDz2R6WMMdEkivg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=i2h/fuDS; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706126666; x=1737662666; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=Orl+mZtfo3P92OAi6zjw0XQv4aRvq83sE++FPaqZvSw=; b=i2h/fuDSRF3uCSPubHrtZSvLnFwlls3u+9Q97D/gz4IRJC26HrrAL6t/ xh2bObi3s4WjpnAghv9lww6hWaQRe5HKxlNu+rQlwxJ0JQanRij5lysyU 6H4fdfpBHQnQzIC5GA6rGr3K784ZD4xQJjmLIV3wQ8k4Ltjn7ZA82H0jX r39CJWNB+vYByd/5KmLh7a0t14+0KUA/n95AP0St3VS/pkYW9gACVOhY4 kg4bPpzPAX0PKpDEqNvOqh5BjBpN5GL4CxBdzFRiK2li3Df8D51KDuZLD 5xkwKcNsV4bzyMKaRoAIwqfTaN4zA9kG91JvtQLs3LL5t2ZGdd8n22HTy Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="1836117" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="1836117" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2024 12:04:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="1117735142" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="1117735142" Received: from vverma7-mobl3.amr.corp.intel.com (HELO [10.0.0.223]) ([10.251.14.61]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2024 12:04:23 -0800 From: Vishal Verma Date: Wed, 24 Jan 2024 12:03:49 -0800 Subject: [PATCH v7 4/5] mm/memory_hotplug: export mhp_supports_memmap_on_memory() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240124-vv-dax_abi-v7-4-20d16cb8d23d@intel.com> References: <20240124-vv-dax_abi-v7-0-20d16cb8d23d@intel.com> In-Reply-To: <20240124-vv-dax_abi-v7-0-20d16cb8d23d@intel.com> To: Dan Williams , Vishal Verma , Dave Jiang , Andrew Morton , Oscar Salvador Cc: linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, David Hildenbrand , Dave Hansen , Huang Ying , Greg Kroah-Hartman , Matthew Wilcox , linux-mm@kvack.org, Michal Hocko X-Mailer: b4 0.13-dev-a684c X-Developer-Signature: v=1; a=openpgp-sha256; l=4673; i=vishal.l.verma@intel.com; h=from:subject:message-id; bh=Orl+mZtfo3P92OAi6zjw0XQv4aRvq83sE++FPaqZvSw=; b=owGbwMvMwCXGf25diOft7jLG02pJDKkbc523Ta9vOi09a3bGqYv8n6JOx6T18S1boOA25RJ7L P+fjzrKHaUsDGJcDLJiiix/93xkPCa3PZ8nMMERZg4rE8gQBi5OAZjItkpGhoPKq2Z5afNceV/D XRrhep3dROdqhKT6hrTy71VRU+ReCTIybOX1yTxzjmHHz5CFdRe+Lru4J7D9BkOBr/zmL9+PJae u5AIA X-Developer-Key: i=vishal.l.verma@intel.com; a=openpgp; fpr=F8682BE134C67A12332A2ED07AFA61BEA3B84DFF X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789003556698423252 X-GMAIL-MSGID: 1789003556698423252 In preparation for adding sysfs ABI to toggle memmap_on_memory semantics for drivers adding memory, export the mhp_supports_memmap_on_memory() helper. This allows drivers to check if memmap_on_memory support is available before trying to request it, and display an appropriate message if it isn't available. As part of this, remove the size argument to this - with recent updates to allow memmap_on_memory for larger ranges, and the internal splitting of altmaps into respective memory blocks, the size argument is meaningless. Cc: Andrew Morton Cc: David Hildenbrand Cc: Michal Hocko Cc: Oscar Salvador Cc: Dan Williams Cc: Dave Jiang Cc: Dave Hansen Cc: Huang Ying Suggested-by: David Hildenbrand Acked-by: David Hildenbrand Signed-off-by: Vishal Verma --- include/linux/memory_hotplug.h | 6 ++++++ mm/memory_hotplug.c | 17 ++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 7d2076583494..ebc9d528f00c 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -121,6 +121,7 @@ struct mhp_params { bool mhp_range_allowed(u64 start, u64 size, bool need_mapping); struct range mhp_get_pluggable_range(bool need_mapping); +bool mhp_supports_memmap_on_memory(void); /* * Zone resizing functions @@ -262,6 +263,11 @@ static inline bool movable_node_is_enabled(void) return false; } +static bool mhp_supports_memmap_on_memory(void) +{ + return false; +} + static inline void pgdat_kswapd_lock(pg_data_t *pgdat) {} static inline void pgdat_kswapd_unlock(pg_data_t *pgdat) {} static inline void pgdat_kswapd_lock_init(pg_data_t *pgdat) {} diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 21890994c1d3..065fb4804f1b 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1328,7 +1328,7 @@ static inline bool arch_supports_memmap_on_memory(unsigned long vmemmap_size) } #endif -static bool mhp_supports_memmap_on_memory(unsigned long size) +bool mhp_supports_memmap_on_memory(void) { unsigned long vmemmap_size = memory_block_memmap_size(); unsigned long memmap_pages = memory_block_memmap_on_memory_pages(); @@ -1337,17 +1337,11 @@ static bool mhp_supports_memmap_on_memory(unsigned long size) * Besides having arch support and the feature enabled at runtime, we * need a few more assumptions to hold true: * - * a) We span a single memory block: memory onlining/offlinin;g happens - * in memory block granularity. We don't want the vmemmap of online - * memory blocks to reside on offline memory blocks. In the future, - * we might want to support variable-sized memory blocks to make the - * feature more versatile. - * - * b) The vmemmap pages span complete PMDs: We don't want vmemmap code + * a) The vmemmap pages span complete PMDs: We don't want vmemmap code * to populate memory from the altmap for unrelated parts (i.e., * other memory blocks) * - * c) The vmemmap pages (and thereby the pages that will be exposed to + * b) The vmemmap pages (and thereby the pages that will be exposed to * the buddy) have to cover full pageblocks: memory onlining/offlining * code requires applicable ranges to be page-aligned, for example, to * set the migratetypes properly. @@ -1359,7 +1353,7 @@ static bool mhp_supports_memmap_on_memory(unsigned long size) * altmap as an alternative source of memory, and we do not exactly * populate a single PMD. */ - if (!mhp_memmap_on_memory() || size != memory_block_size_bytes()) + if (!mhp_memmap_on_memory()) return false; /* @@ -1382,6 +1376,7 @@ static bool mhp_supports_memmap_on_memory(unsigned long size) return arch_supports_memmap_on_memory(vmemmap_size); } +EXPORT_SYMBOL_GPL(mhp_supports_memmap_on_memory); static void __ref remove_memory_blocks_and_altmaps(u64 start, u64 size) { @@ -1515,7 +1510,7 @@ int __ref add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags) * Self hosted memmap array */ if ((mhp_flags & MHP_MEMMAP_ON_MEMORY) && - mhp_supports_memmap_on_memory(memory_block_size_bytes())) { + mhp_supports_memmap_on_memory()) { ret = create_altmaps_and_memory_blocks(nid, group, start, size); if (ret) goto error; From patchwork Wed Jan 24 20:03:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 191747 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp1226685dyi; Wed, 24 Jan 2024 12:05:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IFCDNUOuHeKPE1D41KlINyKX3AN5TZDFNqmwD2ZDI7PQd0/JXygzISanJEiHDunfBY7P1vm X-Received: by 2002:a17:907:11cd:b0:a1c:616e:cdd2 with SMTP id va13-20020a17090711cd00b00a1c616ecdd2mr951217ejb.35.1706126758872; Wed, 24 Jan 2024 12:05:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706126758; cv=pass; d=google.com; s=arc-20160816; b=tWOQIqRz5AmIh7FqriTkp2gxnrKpb4nbGNcr8PaPouOK1qBRO7ODDCeLIsJyMCVU5J Z2xYMabY5KdSo6ewvnJ6b0o1ssqprNxGbtVDk8Blc7wYTX+a+slLpn3n8Aavct5O/gW5 ZyE8L/Sx/f7AShGSiqnh4rY9SpLG5E3WpFM0Ewu1C0ewyEDD+ALiEzji+nyga1yyz6m8 RYxJUBN9T0uPoHVM+PapFIJbUTOLnM3PYYuV6O1WVLgCKiXj8zFqEjjfPy66OcfZwc7F qyNdNSKv7eD4CkQiAjHK1BTePdmDxlRPxW1EVCHMGksT1PwK8OwZSkZJfjywqvx91qRR 3Xew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=jL8JuNc8RZCQZhaTEBqkvXrxE+HNH+PtKP+EKzsZHzo=; fh=2j25EJF7cmLwTrw9J1scDzf9iW6/mT/DDCknXQiEL0o=; b=XZG7Skbwp5amejZ6eZsF4mSg1uvz/9IFAzl4jo5FFRRv0bXdhpLv/ISCsUVyApc5Dj U/g1hOdlXwfmLCq7R+PA7EV4O0+ED3pJC1ZyVKV8UFSZNKRNwBXRgC5iC6NA5Any1CGG lm0/odM+uqBEDe41wOsZKwfsEmOC2lEkfArBteeH0OTe/D0gCy0ZfotOVAnyOYefLmtr Tiixnp7AwMQu6jZOhMjuE1TKP4E0f659sk7xPpOUcHa1G2LAUAhw9LZ0JFw+eE0fA+th FpWa/aJ9e6MBJN5Po01ceG20KbkwAoGZFCJxbEDDw2EDp3BBGw1irsSJ2rskkNUhhA2Z 0PAg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jFuZahct; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-37629-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37629-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id s21-20020a170906bc5500b00a2f60e5f75esi198141ejv.269.2024.01.24.12.05.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 12:05:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37629-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jFuZahct; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-37629-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37629-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 57AE51F252DB for ; Wed, 24 Jan 2024 20:05:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 72FD31353EC; Wed, 24 Jan 2024 20:04:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="jFuZahct" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D25E41339A1; Wed, 24 Jan 2024 20:04:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706126670; cv=none; b=e3O5nJdt4MIJ4CNfq4H67cDNEAql4Zd4DO/hNpMhsLUx12Zt+r51ycth0J+IKjvWRwKJ7WbE4so6j0Re5aZ1RlEg9BjfArKNIX/93/m5mJNSFtV/RkoH+h5UxukZWFAa3Bx3wudFot4iNu8KZd+RyPwkuTcsz8LfcHjctaTQgGQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706126670; c=relaxed/simple; bh=LlNwsQ9722KaImXgMJUAbGVELQS9Qj5zVBOISdpjDqE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PvyS7mCxYJMx63aqpnqShxOC2gAzRsb48Px3ffQi+XwT1YjlWU/jd314kjUr/xC/Wyi6+4hBF2uty8yN7h4q2hIHGGr9eCE4vFWO4LPo7v+tX1rz0EA2HA0IBcG/EVHw0pJpPjINtUR91ruFPLL4cdPtW9uw5mWxFu+NsxUcYr4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=jFuZahct; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706126667; x=1737662667; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=LlNwsQ9722KaImXgMJUAbGVELQS9Qj5zVBOISdpjDqE=; b=jFuZahctn9V358ON/5NnxJVP3aGmB0Zp54MQRkGjQ5FR0yxZbBmR7fMk h3oaYazLoso+RErHrp3FqeGsPnkxi94FGXt27KNzlVDBOZiOLuNTJ4TM/ vWHOc6w1x8hz6I9tK0Fq62I6iJy8fB8GVkLccbghKOKf2WKEAiYOrUsbM C/2NTfA6vLlxulig55vlx5srSQcOjBstqbFwSBw3IvstTCBe9ox5AfcqY zPmIE4d+HwlPiuqj6zI8LCynuSBrI1H2dfHf4As/rSqczHX66MKVRPf2y dTu9cRsVpnss8c2X9JUI/xvvs/r0Y4bDscjOsg3oSjQ0ode01L8jmQEGe A==; X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="1836126" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="1836126" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2024 12:04:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="1117735146" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="1117735146" Received: from vverma7-mobl3.amr.corp.intel.com (HELO [10.0.0.223]) ([10.251.14.61]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2024 12:04:25 -0800 From: Vishal Verma Date: Wed, 24 Jan 2024 12:03:50 -0800 Subject: [PATCH v7 5/5] dax: add a sysfs knob to control memmap_on_memory behavior Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240124-vv-dax_abi-v7-5-20d16cb8d23d@intel.com> References: <20240124-vv-dax_abi-v7-0-20d16cb8d23d@intel.com> In-Reply-To: <20240124-vv-dax_abi-v7-0-20d16cb8d23d@intel.com> To: Dan Williams , Vishal Verma , Dave Jiang , Andrew Morton , Oscar Salvador Cc: linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, David Hildenbrand , Dave Hansen , Huang Ying , Greg Kroah-Hartman , Matthew Wilcox , linux-mm@kvack.org, Li Zhijian , Jonathan Cameron X-Mailer: b4 0.13-dev-a684c X-Developer-Signature: v=1; a=openpgp-sha256; l=4012; i=vishal.l.verma@intel.com; h=from:subject:message-id; bh=LlNwsQ9722KaImXgMJUAbGVELQS9Qj5zVBOISdpjDqE=; b=owGbwMvMwCXGf25diOft7jLG02pJDKkbc50VeD8v+CjLFhJhfFzu8RSjtH97erzz9l4Qf8Enc LfQ66hyRykLgxgXg6yYIsvfPR8Zj8ltz+cJTHCEmcPKBDKEgYtTACbiH8TwV1Ju2kePSfLnrhke 2viisS8mpjzc/qGgQObvl8E/GFTs9Rn+B7+fyvC/VG61dh1TyJMbdnVpnpttknc4N2ev5nkgpin HBAA= X-Developer-Key: i=vishal.l.verma@intel.com; a=openpgp; fpr=F8682BE134C67A12332A2ED07AFA61BEA3B84DFF X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789003572194660413 X-GMAIL-MSGID: 1789003572194660413 Add a sysfs knob for dax devices to control the memmap_on_memory setting if the dax device were to be hotplugged as system memory. The default memmap_on_memory setting for dax devices originating via pmem or hmem is set to 'false' - i.e. no memmap_on_memory semantics, to preserve legacy behavior. For dax devices via CXL, the default is on. The sysfs control allows the administrator to override the above defaults if needed. Cc: David Hildenbrand Cc: Dan Williams Cc: Dave Jiang Cc: Dave Hansen Cc: Huang Ying Tested-by: Li Zhijian Reviewed-by: Jonathan Cameron Reviewed-by: David Hildenbrand Reviewed-by: Huang, Ying Signed-off-by: Vishal Verma Reviewed-by: Alison Schofield --- drivers/dax/bus.c | 43 +++++++++++++++++++++++++++++++++ Documentation/ABI/testing/sysfs-bus-dax | 17 +++++++++++++ 2 files changed, 60 insertions(+) diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c index 0fd948a4443e..27c86d0ca711 100644 --- a/drivers/dax/bus.c +++ b/drivers/dax/bus.c @@ -1349,6 +1349,48 @@ static ssize_t numa_node_show(struct device *dev, } static DEVICE_ATTR_RO(numa_node); +static ssize_t memmap_on_memory_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct dev_dax *dev_dax = to_dev_dax(dev); + + return sysfs_emit(buf, "%d\n", dev_dax->memmap_on_memory); +} + +static ssize_t memmap_on_memory_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct dev_dax *dev_dax = to_dev_dax(dev); + bool val; + int rc; + + rc = kstrtobool(buf, &val); + if (rc) + return rc; + + if (val == true && !mhp_supports_memmap_on_memory()) { + dev_dbg(dev, "memmap_on_memory is not available\n"); + return -EOPNOTSUPP; + } + + rc = down_write_killable(&dax_dev_rwsem); + if (rc) + return rc; + + if (dev_dax->memmap_on_memory != val && dev->driver && + to_dax_drv(dev->driver)->type == DAXDRV_KMEM_TYPE) { + up_write(&dax_dev_rwsem); + return -EBUSY; + } + + dev_dax->memmap_on_memory = val; + up_write(&dax_dev_rwsem); + + return len; +} +static DEVICE_ATTR_RW(memmap_on_memory); + static umode_t dev_dax_visible(struct kobject *kobj, struct attribute *a, int n) { struct device *dev = container_of(kobj, struct device, kobj); @@ -1375,6 +1417,7 @@ static struct attribute *dev_dax_attributes[] = { &dev_attr_align.attr, &dev_attr_resource.attr, &dev_attr_numa_node.attr, + &dev_attr_memmap_on_memory.attr, NULL, }; diff --git a/Documentation/ABI/testing/sysfs-bus-dax b/Documentation/ABI/testing/sysfs-bus-dax index 6359f7bc9bf4..b34266bfae49 100644 --- a/Documentation/ABI/testing/sysfs-bus-dax +++ b/Documentation/ABI/testing/sysfs-bus-dax @@ -134,3 +134,20 @@ KernelVersion: v5.1 Contact: nvdimm@lists.linux.dev Description: (RO) The id attribute indicates the region id of a dax region. + +What: /sys/bus/dax/devices/daxX.Y/memmap_on_memory +Date: January, 2024 +KernelVersion: v6.8 +Contact: nvdimm@lists.linux.dev +Description: + (RW) Control the memmap_on_memory setting if the dax device + were to be hotplugged as system memory. This determines whether + the 'altmap' for the hotplugged memory will be placed on the + device being hotplugged (memmap_on_memory=1) or if it will be + placed on regular memory (memmap_on_memory=0). This attribute + must be set before the device is handed over to the 'kmem' + driver (i.e. hotplugged into system-ram). Additionally, this + depends on CONFIG_MHP_MEMMAP_ON_MEMORY, and a globally enabled + memmap_on_memory parameter for memory_hotplug. This is + typically set on the kernel command line - + memory_hotplug.memmap_on_memory set to 'true' or 'force'."