From patchwork Thu Dec 14 07:37:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 13492507 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 BCA4CC4167B for ; Thu, 14 Dec 2023 07:38:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0BBA88D009E; Thu, 14 Dec 2023 02:38:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 06CD28D009C; Thu, 14 Dec 2023 02:38:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E767D8D009E; Thu, 14 Dec 2023 02:38:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D86118D009C for ; Thu, 14 Dec 2023 02:38:17 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id AE8FB1C0BCE for ; Thu, 14 Dec 2023 07:38:17 +0000 (UTC) X-FDA: 81564620634.09.C33CCE3 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by imf22.hostedemail.com (Postfix) with ESMTP id 8F824C000F for ; Thu, 14 Dec 2023 07:38:14 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=jefJyEhD; spf=pass (imf22.hostedemail.com: domain of vishal.l.verma@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=vishal.l.verma@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702539495; 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-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=RapcWMSdsmVU6OYEOUDVQJrUgfKDp4rM6xHZ+r+kbOE=; b=TMPEHCP46dfj4H/oIvngIcz9c4j4zuEHsxABYTi53NrsQ084ju2nMWyV+5+QA71Rj3bHH+ wqKXoPlKHraeqGOKMAV50XegxHpyCBnAdi7is0tODTgH7qOzqwaB9oEyR8VlGKmk2HhLom yI8IbOzn6OfhFPqc5g5LwNKzGqE27Rc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702539495; a=rsa-sha256; cv=none; b=xQagDMGyHxEAO8eMAR8b85cHM50ktBkBA0AlzNcuZRDH679p/SzBcm32htHIYMGrXgigXm GI8VlGcrs7QkQJIHARQwgSIeYqI3F05aaoV3a33cLWqi+YNRMNr1oQ94ZcF0YJU0L4nqna Aotul7iFxAnZjVyJ9XELMkEHx7DHMHM= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=jefJyEhD; spf=pass (imf22.hostedemail.com: domain of vishal.l.verma@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=vishal.l.verma@intel.com; dmarc=pass (policy=none) header.from=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702539494; x=1734075494; h=from:subject:date:message-id:mime-version: content-transfer-encoding:to:cc; bh=h6iwtR+Emw2EX9lZjGEXRQCb3JKoPyQmhXB1JkGLNZE=; b=jefJyEhDXLew142qTA1ybv6C/BwyORjEKLcbkASz+fMz507dGn/t4qqO JoxakOr9O4ZzsB6BQ9prb3Qslmo3lg3vMggpjXkNBLOtsXO5WpY2yU4P9 Fm/lh1BGjqoQA2JVVhiOgeJK8DpqzsGmGEATQaED+govy2j9hPhR+OYKM Nkf/9ivVrasndilcgBhauRLuV7Xw2RoigUIuooA1R9B2jnMPGah6TBzgs kdKPKJ5oiduEwFdkOmh6CYMulOd30vlhkZAqCbL/RzJWAlvIXjEP5S5Zx 4GcnK7ZfkhUptdjr3ecjWGZo8CpOKRbt0trv6fMNXY8vUrgu3A2SN7QzY w==; X-IronPort-AV: E=McAfee;i="6600,9927,10923"; a="481275507" X-IronPort-AV: E=Sophos;i="6.04,274,1695711600"; d="scan'208";a="481275507" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2023 23:38:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10923"; a="723972055" X-IronPort-AV: E=Sophos;i="6.04,274,1695711600"; d="scan'208";a="723972055" Received: from llblake-mobl1.amr.corp.intel.com (HELO [192.168.1.200]) ([10.213.191.124]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2023 23:38:10 -0800 From: Vishal Verma Subject: [PATCH v5 0/4] Add DAX ABI for memmap_on_memory Date: Thu, 14 Dec 2023 00:37:53 -0700 Message-Id: <20231214-vv-dax_abi-v5-0-3f7b006960b4@intel.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIANGwemUC/3XM0QqCMBTG8VeJXbfYOZtTu+o9ImLOsxyUhsowx Hdv2o0Kca6+A7//yDpqPXXsfBhZS8F3vqnjSI4HZitTP4j7Mm6GAiUITHgIvDTD3RSeQ2oQcqu 0SDWL4N2S88MSu97irnzXN+1naQeYv78MCr3OBOCCq1RRkWWEAuzF1z09T7Z5sTkT8D/FSJ2Kh 1LqUmR7KlcUYENlpMY6bS0UJeVuT9Wa4oaqSEEmkCaZEzbHNZ2m6QsSnChrVQEAAA== 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 , linux-mm@kvack.org, Joao Martins , Michal Hocko , Li Zhijian , Jonathan Cameron X-Mailer: b4 0.13-dev-433a8 X-Developer-Signature: v=1; a=openpgp-sha256; l=3873; i=vishal.l.verma@intel.com; h=from:subject:message-id; bh=h6iwtR+Emw2EX9lZjGEXRQCb3JKoPyQmhXB1JkGLNZE=; b=owGbwMvMwCXGf25diOft7jLG02pJDKlVG+499hN/bHjHzIXZ4f2aqSon9dUneh0P2eQcxcVfK /DPnkeoo5SFQYyLQVZMkeXvno+Mx+S25/MEJjjCzGFlAhnCwMUpABPJtWL4n2F/7nClCXdxvPpS YYsUNav9Z7eYdszbHpJ1n++8vc6BPQz/fWdYypxe3vOiMflFb6D3rHenfu58/z3m1ls3/dQ1b1e o8gAA X-Developer-Key: i=vishal.l.verma@intel.com; a=openpgp; fpr=F8682BE134C67A12332A2ED07AFA61BEA3B84DFF X-Rspamd-Queue-Id: 8F824C000F X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: i4suw3tj5qwbtbq6p4xxbrwy74o8nwc1 X-HE-Tag: 1702539494-139094 X-HE-Meta: U2FsdGVkX1+JB66z6pWSzEtbUI58ZPikS1COqrORUiIAfTsL+txCZAo/AR3pPp2HjNmVjrf8y4Tdvq+oTZd2VDQrsTvON+FIHLXugCikvjEpnM+DOZqhbuvlsUMBZlqB7UEJgQr9dL+7nTAg6K2XyRtPCUgbv1RnXIysaBqt7l1vkRlhAPg+HDj6BCBE7Yw57Z/Nlen45ENiWqFVgwi1V07EHe4obwHG2aFRaPBXN/GemrtLh4Goz3ru+9KHhMSi9hVB2VP8kzziMmqCXTQ2JQ2XIyI0SKWHIK7oy3XlJHDacGora/GyyBA+EmjIfaYpmI1hZzthDYty6TnzwSQD7tos8TP0qEor8q/SQdcVSSRPG0d3E2MsubBPlJLeXrp7FQQjS+2jrYtX7tCVOouPazuPh0FlQHCibHNnEU9R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.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: The DAX drivers were missing sysfs ABI documentation entirely. Add this missing documentation for the sysfs ABI for DAX regions and Dax devices in patch 1. Switch to guard(device) semantics for Scope Based Resource Management for device_{lock,unlock} flows in drivers/dax/bus.c in patch 2. Export mhp_supports_memmap_on_memory() in patch 3. Add a new ABI for toggling memmap_on_memory semantics in patch 4. The missing ABI was spotted in [1], this series is a split of the new ABI additions behind the initial documentation creation. [1]: https://lore.kernel.org/linux-cxl/651f27b728fef_ae7e7294b3@dwillia2-xfh.jf.intel.com.notmuch/ --- This series depends on [2] which adds the definition for guard(device). [2]: https://lore.kernel.org/r/170250854466.1522182.17555361077409628655.stgit@dwillia2-xfh.jf.intel.com --- Other Logistics - Andrew, would you prefer patch 3 to go through mm? Or through the dax tree with an mm ack? The remaining patches are all contained to dax, but do depend on the memmap_on_memory set that is currently in mm-stable. --- Changes in v5: - Export and check mhp_supports_memmap_on_memory() in the DAX sysfs ABI (David) - Obtain dax_drv under the device lock (Ying) - Check dax_drv for NULL before dereferencing it (Ying) - Clean up some repetition in sysfs-bus-dax documentation entries (Jonathan) - A few additional cleanups enabled by guard(device) (Jonathan) - Drop the DEFINE_GUARD() part of patch 2, add dependency on Dan's patch above so it can be backported / applied separately (Jonathan, Dan) - Link to v4: https://lore.kernel.org/r/20231212-vv-dax_abi-v4-0-1351758f0c92@intel.com Changes in v4: - Hold the device lock when checking if the dax_dev is bound to kmem (Ying, Dan) - Remove dax region checks (and locks) as they were unnecessary. - Introduce guard(device) for device lock/unlock (Dan) - Convert the rest of drivers/dax/bus.c to guard(device) - Link to v3: https://lore.kernel.org/r/20231211-vv-dax_abi-v3-0-acf6cc1bde9f@intel.com Changes in v3: - Fix typo in ABI docs (Zhijian Li) - Add kernel config and module parameter dependencies to the ABI docs entry (David Hildenbrand) - Ensure kmem isn't active when setting the sysfs attribute (Ying Huang) - Simplify returning from memmap_on_memory_store() - Link to v2: https://lore.kernel.org/r/20231206-vv-dax_abi-v2-0-f4f4f2336d08@intel.com Changes in v2: - Fix CC lists, patch 1/2 didn't get sent correctly in v1 - Link to v1: https://lore.kernel.org/r/20231206-vv-dax_abi-v1-0-474eb88e201c@intel.com Cc: Cc: Cc: Cc: David Hildenbrand Cc: Dave Hansen Cc: Huang Ying Cc: Greg Kroah-Hartman Cc: To: Dan Williams To: Vishal Verma To: Dave Jiang To: Andrew Morton To: Oscar Salvador --- Vishal Verma (4): Documentatiion/ABI: Add ABI documentation for sys-bus-dax dax/bus: Use guard(device) in sysfs attribute helpers mm/memory_hotplug: export mhp_supports_memmap_on_memory() dax: add a sysfs knob to control memmap_on_memory behavior include/linux/memory_hotplug.h | 6 ++ drivers/dax/bus.c | 181 +++++++++++++++++--------------- mm/memory_hotplug.c | 17 ++- Documentation/ABI/testing/sysfs-bus-dax | 153 +++++++++++++++++++++++++++ 4 files changed, 262 insertions(+), 95 deletions(-) --- base-commit: a6e0c2ca980d75d5ac6b2902c5c0028eaf094db3 change-id: 20231025-vv-dax_abi-17a219c46076 Best regards,