dax/hmem, cxl: Coordinate Soft Reserved handling with CXL
From: | Smita Koralahalli <Smita.KoralahalliChannabasappa-AT-amd.com> | |
To: | <linux-cxl-AT-vger.kernel.org>, <linux-kernel-AT-vger.kernel.org>, <nvdimm-AT-lists.linux.dev>, <linux-fsdevel-AT-vger.kernel.org>, <linux-pm-AT-vger.kernel.org> | |
Subject: | [PATCH v2 0/5] dax/hmem, cxl: Coordinate Soft Reserved handling with CXL | |
Date: | Tue, 30 Sep 2025 04:28:09 +0000 | |
Message-ID: | <20250930042814.213912-1-Smita.KoralahalliChannabasappa@amd.com> | |
Cc: | Davidlohr Bueso <dave-AT-stgolabs.net>, Jonathan Cameron <jonathan.cameron-AT-huawei.com>, Dave Jiang <dave.jiang-AT-intel.com>, "Alison Schofield" <alison.schofield-AT-intel.com>, Vishal Verma <vishal.l.verma-AT-intel.com>, Ira Weiny <ira.weiny-AT-intel.com>, Dan Williams <dan.j.williams-AT-intel.com>, Matthew Wilcox <willy-AT-infradead.org>, Jan Kara <jack-AT-suse.cz>, "Rafael J . Wysocki" <rafael-AT-kernel.org>, Len Brown <len.brown-AT-intel.com>, Pavel Machek <pavel-AT-kernel.org>, Li Ming <ming.li-AT-zohomail.com>, Jeff Johnson <jeff.johnson-AT-oss.qualcomm.com>, "Ying Huang" <huang.ying.caritas-AT-gmail.com>, Yao Xingtao <yaoxt.fnst-AT-fujitsu.com>, Peter Zijlstra <peterz-AT-infradead.org>, Greg KH <gregkh-AT-linuxfoundation.org>, Nathan Fontenot <nathan.fontenot-AT-amd.com>, Smita Koralahalli <Smita.KoralahalliChannabasappa-AT-amd.com>, Terry Bowman <terry.bowman-AT-amd.com>, Robert Richter <rrichter-AT-amd.com>, Benjamin Cheatham <benjamin.cheatham-AT-amd.com>, Zhijian Li <lizhijian-AT-fujitsu.com>, "Borislav Petkov" <bp-AT-alien8.de>, Ard Biesheuvel <ardb-AT-kernel.org> | |
Archive-link: | Article |
This series aims to address long-standing conflicts between dax_hmem and CXL when handling Soft Reserved memory ranges. Reworked from Dan's patch: https://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl.g... Previous work: https://lore.kernel.org/all/20250715180407.47426-1-Smita.... Link to v1: https://lore.kernel.org/all/20250822034202.26896-1-Smita.... To note: I have dropped 6/6th patch from v1 based on discussion with Zhijian. This patch series doesn't cover the case of DEV_DAX_HMEM=y and CXL=m, which results in DEV_DAX_CXL being disabled. In that configuration, ownership of the soft-reserved ranges is handled by HMEM instead of being managed by CXL. /proc/iomem for this case looks like below: 850000000-284fffffff : CXL Window 0 850000000-284fffffff : region3 850000000-284fffffff : Soft Reserved 850000000-284fffffff : dax0.0 850000000-284fffffff : System RAM (kmem) 2850000000-484fffffff : CXL Window 1 2850000000-484fffffff : region4 2850000000-484fffffff : Soft Reserved 2850000000-484fffffff : dax1.0 2850000000-484fffffff : System RAM (kmem) 4850000000-684fffffff : CXL Window 2 4850000000-684fffffff : region5 4850000000-684fffffff : Soft Reserved 4850000000-684fffffff : dax2.0 4850000000-684fffffff : System RAM (kmem) Link to the patch and discussions on this: https://lore.kernel.org/all/20250822034202.26896-7-Smita.... I would appreciate input on how best to handle this scenario efficiently. Applies to mainline master. v2 updates: - Removed conditional check on CONFIG_EFI_SOFT_RESERVE as dax_hmem depends on CONFIG_EFI_SOFT_RESERVE. (Zhijian) - Added TODO note. (Zhijian) - Included region_intersects_soft_reserve() inside CONFIG_EFI_SOFT_RESERVE conditional check. (Zhijian) - insert_resource_late() -> insert_resource_expand_to_fit() and __insert_resource_expand_to_fit() replacement. (Boris) - Fixed Co-developed and Signed-off by. (Dan) - Combined 2/6 and 3/6 into a single patch. (Zhijian). - Skip local variable in remove_soft_reserved. (Jonathan) - Drop kfree with __free(). (Jonathan) - return 0 -> return dev_add_action_or_reset(host...) (Jonathan) - Dropped 6/6. - Reviewed-by tags (Dave, Jonathan) Dan Williams (4): dax/hmem, e820, resource: Defer Soft Reserved registration until hmem is ready dax/hmem: Request cxl_acpi and cxl_pci before walking Soft Reserved ranges dax/hmem: Use DEV_DAX_CXL instead of CXL_REGION for deferral dax/hmem: Defer Soft Reserved overlap handling until CXL region assembly completes Smita Koralahalli (1): dax/hmem: Reintroduce Soft Reserved ranges back into the iomem tree arch/x86/kernel/e820.c | 2 +- drivers/cxl/acpi.c | 2 +- drivers/dax/Kconfig | 2 + drivers/dax/hmem/device.c | 4 +- drivers/dax/hmem/hmem.c | 128 ++++++++++++++++++++++++++++++++++---- include/linux/ioport.h | 13 +++- kernel/resource.c | 92 +++++++++++++++++++++++---- 7 files changed, 213 insertions(+), 30 deletions(-) -- 2.17.1