From patchwork Fri Dec 15 05:25:25 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: 13493997 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 E51BDC4332F for ; Fri, 15 Dec 2023 05:25:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 43D908D0112; Fri, 15 Dec 2023 00:25:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3A1648D0103; Fri, 15 Dec 2023 00:25:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21BB38D0112; Fri, 15 Dec 2023 00:25:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 077E68D0103 for ; Fri, 15 Dec 2023 00:25:42 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id C7661C02A8 for ; Fri, 15 Dec 2023 05:25:41 +0000 (UTC) X-FDA: 81567915282.03.E92CCFA Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by imf04.hostedemail.com (Postfix) with ESMTP id 010D240013 for ; Fri, 15 Dec 2023 05:25:38 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=K0SkmrjF; spf=pass (imf04.hostedemail.com: domain of vishal.l.verma@intel.com designates 134.134.136.100 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=1702617939; 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=EwdyGspY/MIAegoUUqf3JS5+9mXPB7XCF5YLzbu5QBs=; b=pHn5HXN18854nXN9BhP33pXcf5AaP6YKSEaOPdcxBeJddrhwCRfde9L9+8Ra5DySHrnp0p u4ypin8oKrS/JD3Zvmtja4FhZEmEoAjm3B+f5j8sr6AUQJacBA+AFoJ9s+agflekjd9PyH WWp50KTCJKv7ufxVGHf0QNR2OBUrrIw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702617939; a=rsa-sha256; cv=none; b=avUAj4kwhR5IJjdNi0fPkRl5SCEnBx/HkGzRbPsz+Qz295HgBbSpMbXpniHuBTVjG0WJ7r nzgyZwqnqcmTuGsGZUB+rmcT2FeDuuNvW3lde+NSZ4YAzdpqukTKGWsQm7PrIW+3FJoVF7 Yx8dd6KjPWA50mMhQZ9D94VLOJ2E+us= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=K0SkmrjF; spf=pass (imf04.hostedemail.com: domain of vishal.l.verma@intel.com designates 134.134.136.100 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=1702617939; x=1734153939; h=from:subject:date:message-id:mime-version: content-transfer-encoding:to:cc; bh=gpIMG98kSfTR7IkA5YlRDrASpRxzVoLtmbllKBAG/Uo=; b=K0SkmrjF8VoX3QynUnYLsUed/EZK0JfWrDwpFfa56do6SkmNIv+8j0P6 9tiDkvuEcqwWQXg2T/5419oCoCx7wmRT5GpLtbkZ3/MmtTrC6cGFUf4mu XK8zK18jfIJ8E3s4obAocr2T5b3Nd7/k75xdPttX94jlTPHPnqnEiaeZt UBjlYdSpbJVE9tzHdi6J8pNIsrRhM/P2X8E8VKlXSKpbVueUahW2h6P4A VS67Qi4pYWuYpTv5LQ4GdAdX0Q5DN7gRLhJvNhv6v9RASXs3zo/RCUzcA 7sQSwCcY2E2QlpX541NsJ/OxwW2vZ3UENzgN76fTNYs4dztEIZTb7JyDs A==; X-IronPort-AV: E=McAfee;i="6600,9927,10924"; a="461695006" X-IronPort-AV: E=Sophos;i="6.04,277,1695711600"; d="scan'208";a="461695006" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2023 21:25:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10924"; a="808847923" X-IronPort-AV: E=Sophos;i="6.04,277,1695711600"; d="scan'208";a="808847923" Received: from mmtakalk-mobl.amr.corp.intel.com (HELO [192.168.1.200]) ([10.212.109.101]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2023 21:25:36 -0800 From: Vishal Verma Subject: [PATCH v6 0/4] Add DAX ABI for memmap_on_memory Date: Thu, 14 Dec 2023 22:25:25 -0700 Message-Id: <20231214-vv-dax_abi-v6-0-ad900d698438@intel.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAEXje2UC/3XMTWrDMBCG4asErasyM/qzs+o9SgmSLDWC1i52E AnBd+8k3ciGMqtv4HnvYklzSYs4Hu5iTrUsZRp52JeDiGc/fiZZBt6CgBQCGVmrHPz15EOR6Dx hH7UFZwWDnznlcn3G3j94n8tymebbs13x8f3LENg2U1GC1E6n0HWJAONbGS/p6zVO3+KRqfQ/J aZZ85FSdoBuT1VDETdUMfUx2xgxDKnPe6pbShuqmaIy6EyXIfa0p6alekMNU5VdALC9haBbuq7 rL8jHlC+QAQAA 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=4201; i=vishal.l.verma@intel.com; h=from:subject:message-id; bh=gpIMG98kSfTR7IkA5YlRDrASpRxzVoLtmbllKBAG/Uo=; b=owGbwMvMwCXGf25diOft7jLG02pJDKnVj72DBQy7+sMEDkbc+rzgzleWNY1mWxuk89a8jnoaV PSzoedXRykLgxgXg6yYIsvfPR8Zj8ltz+cJTHCEmcPKBDKEgYtTACZSwcXIcGXl8Xs8j+yjThxc Jbroe5bpd089t8czdrTOkznRxMi4Sonhv2sN97OFe/XlLrqbdk0091qxU+vMhicVbluO37/4K2u DKR8A X-Developer-Key: i=vishal.l.verma@intel.com; a=openpgp; fpr=F8682BE134C67A12332A2ED07AFA61BEA3B84DFF X-Rspamd-Queue-Id: 010D240013 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: x4xdjziyegh7djnd3rmnmmn75id5my4t X-HE-Tag: 1702617938-919701 X-HE-Meta: U2FsdGVkX190Woq0K0TaeAzZSjpRmFKN7gQtN24nByeKnEPc9Bc//eIYG36L09Rp7ikX6Iw1MLdGrSXlGvYvV6hibLmzQn1pnS11ZtEqj+vVylF0q3HoQJhW3nAv7nHL62FcUJlktZopdw8e4HvJIqrnqpP1MIsaObT5xm4JI1o9NUBpwd9hI1URkpUpwYdPaRH76I/64BGmKR7Fc4jtzDTFVySKEsSjPgHkebJFnHD6XM87/vZjJVnZLlAkGXMoowqQK/CZi30F9QSnZ2ZU2RfYM400oJ4OMU9iSzCgch8qIqWjQUX0ekMinHAyVM33LdEtEprfpOR7ldWeqy/RhWmsuBH/aJpPHpexwLJJqBkPAAXBTsTn81z5rBNBdt0TKHwOcbZGcRcVwxIKtHf64kRuQuKSyd9ZP7E8zspXDEWjRKT17exomahbhUl0W/6qAhEwuDtOSKWbkpfBAKfILMsGr+B4U9wHKfPwgpNmXXfjvvlPLC0G/yRbA2TPHJgVx8aCNlBEYotxSbASZvz1GkEoKNshXBjRIE46a5B1n5M9+OnDeAb21ojSkOiGkjLwTYPPDTYah655Btfzl1hp19EjJRJTQZSXkw+MOTsJRH7kmHH5EjWEz4ajsrirh09NaKce5KGYihkp4ze89PlEGqrW9+vNk8ISltULb+vpRc0Zjpg1J8glSa2au6vjeRANpJCiZio8Wqhu57Pkylg42qPzhIk1QJifCDF1QFw+sXWcNNupoi7QBZ4hD92wDbkfsCxGHFtUubUdV9MzM/e39mDlUBTNJymAHqi1b8jWK4tUFUthpUF5rxAfHCHwMO+uuSrz+qpEOjSgdzzT8EYANfm24h3OTY1PK7BKhQIW3oJZRQhiAiYjkq43wBpcMLFX3wTpy8d7oVMotX9WS+Y5WlwRpnUATt17eSgYuZYMOavtMIsXmVoP1/g5cYNN3A1SFeFjmNyUBFdSVJZMjZO x4qwVBVz /esGP3UXtsbFEP2gfEakQQVv+oCZYviNphvum/74mq+/cmw22EiD73R9CU0UHHNQ9f4/ON2iWo9L7HZfCDm//+8oNNwre5gpH55FsUrOJmJLTf29hsg2hPC1OkQjl1A5s9PbnJKXjK4G9UNx8oMUIVDewZTGFsmvkQdaNl6jQzDJnV//GnnSv2nxCFilHe3KZRoJaS9o38d6c+fUuxIsJU606sHAFg4tn8aCfPkghg44B5c7Gy7Gs0Ndt74Wyw34K+c+l5FXywu0S1wjaxNsY3Xhd2GkK8Bo7cMvApVZSBB7S3CfJlphYGdQhsAUJQ40msU7v5y2trhiY0OD4T1bbxs8F0SiUiaYTsvnS5wioITFgygJxZoKkXcWLKKrixiK0fOEf3s4bPaR0GWnFOqVcednKo49qvMC/8Yco7haDOWOqZDDH8uZc4CFoxAy21EpLp4lkM9zgEgM6llM/8QursuRIlC8ARHPfh7Es 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: 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 v6: - Use sysfs_emit() in memmap_on_memory_show() (Greg) - Change the ABI documentation date for memmap_on_memory to January 2024 as that's likely when the 6.8 merge window will fall (Greg) - Fix dev->driver check (Ying) - Link to v5: https://lore.kernel.org/r/20231214-vv-dax_abi-v5-0-3f7b006960b4@intel.com 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 | 179 +++++++++++++++++--------------- mm/memory_hotplug.c | 17 ++- Documentation/ABI/testing/sysfs-bus-dax | 153 +++++++++++++++++++++++++++ 4 files changed, 260 insertions(+), 95 deletions(-) --- base-commit: a6e0c2ca980d75d5ac6b2902c5c0028eaf094db3 change-id: 20231025-vv-dax_abi-17a219c46076 Best regards,