From 0c40b4e27a69b5bdd7aaacf106ba9d3877df8261 Mon Sep 17 00:00:00 2001 From: Jeff Moyer Date: Tue, 22 Jul 2025 08:35:14 -0400 Subject: [PATCH] ndctl: Fix reporting of region capabilities Resolves: RHEL-80436 Signed-off-by: Jeff Moyer --- ...-symbol-redefinitions-reported-by-GC.patch | 76 --------------- ...y-region-caps-for-any-of-BTT-PFN-DAX.patch | 94 +++++++++++++++++++ ndctl.spec | 10 +- 3 files changed, 102 insertions(+), 78 deletions(-) delete mode 100644 0001-ndctl-lib-fix-symbol-redefinitions-reported-by-GC.patch create mode 100644 def79df-ndctl-list-display-region-caps-for-any-of-BTT-PFN-DAX.patch diff --git a/0001-ndctl-lib-fix-symbol-redefinitions-reported-by-GC.patch b/0001-ndctl-lib-fix-symbol-redefinitions-reported-by-GC.patch deleted file mode 100644 index ccbc388..0000000 --- a/0001-ndctl-lib-fix-symbol-redefinitions-reported-by-GC.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 0b35822caa1b8468e1a0349ccf971b600be3c03e Mon Sep 17 00:00:00 2001 -From: Vishal Verma -Date: Thu, 30 Jan 2020 11:51:14 -0700 -Subject: [ndctl PATCH v3] ndctl/lib: fix symbol redefinitions reported by - GCC10 - -A toolchain update in Fedora 32 caused new compile errors due to -multiple definitions of dimm_ops structures. The declarations in -'private.h' for the various NFIT families are present so that libndctl -can find all the per-family dimm-ops. However they need to be declared -as extern because the actual definitions are in .c. -Additionally, 'param' instances in list.c and monitor.c need to be -marked as static. - -Cc: Dan Williams -Cc: Eric Sandeen -Suggested-by: Dan Williams -Reviewed-by: Dan Williams -Signed-off-by: Vishal Verma ---- - -v3: Remove unrelated changes to Makefile.am from this patch (Eric). - - ndctl/lib/private.h | 8 ++++---- - ndctl/list.c | 2 +- - ndctl/monitor.c | 2 +- - 3 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/ndctl/lib/private.h b/ndctl/lib/private.h -index e445301..16bf8f9 100644 ---- a/ndctl/lib/private.h -+++ b/ndctl/lib/private.h -@@ -343,10 +343,10 @@ struct ndctl_dimm_ops { - int (*xlat_firmware_status)(struct ndctl_cmd *); - }; - --struct ndctl_dimm_ops * const intel_dimm_ops; --struct ndctl_dimm_ops * const hpe1_dimm_ops; --struct ndctl_dimm_ops * const msft_dimm_ops; --struct ndctl_dimm_ops * const hyperv_dimm_ops; -+extern struct ndctl_dimm_ops * const intel_dimm_ops; -+extern struct ndctl_dimm_ops * const hpe1_dimm_ops; -+extern struct ndctl_dimm_ops * const msft_dimm_ops; -+extern struct ndctl_dimm_ops * const hyperv_dimm_ops; - - static inline struct ndctl_bus *cmd_to_bus(struct ndctl_cmd *cmd) - { -diff --git a/ndctl/list.c b/ndctl/list.c -index 125a9fe..12d78d8 100644 ---- a/ndctl/list.c -+++ b/ndctl/list.c -@@ -59,7 +59,7 @@ static unsigned long listopts_to_flags(void) - return flags; - } - --struct util_filter_params param; -+static struct util_filter_params param; - - static int did_fail; - -diff --git a/ndctl/monitor.c b/ndctl/monitor.c -index b8ee27f..1755b87 100644 ---- a/ndctl/monitor.c -+++ b/ndctl/monitor.c -@@ -45,7 +45,7 @@ struct monitor_dimm { - struct list_node list; - }; - --struct util_filter_params param; -+static struct util_filter_params param; - - static int did_fail; - --- -2.21.1 - diff --git a/def79df-ndctl-list-display-region-caps-for-any-of-BTT-PFN-DAX.patch b/def79df-ndctl-list-display-region-caps-for-any-of-BTT-PFN-DAX.patch new file mode 100644 index 0000000..3305adc --- /dev/null +++ b/def79df-ndctl-list-display-region-caps-for-any-of-BTT-PFN-DAX.patch @@ -0,0 +1,94 @@ +ndctl/list: display region caps for any of BTT, PFN, DAX + +JIRA: https://issues.redhat.com/browse/RHEL-80436 + +commit def79df43e763dd89973e0732dd49ee5f38416ac +Author: Donet Tom +Date: Thu Feb 20 00:20:29 2025 -0600 + + ndctl/list: display region caps for any of BTT, PFN, DAX + + If any one of BTT, PFN, or DAX is not present, but the other two + are, then the region capabilities are not displayed in the + ndctl list -R -C command. + + This is because util_region_capabilities_to_json() returns NULL + if any one of BTT, PFN, or DAX is not present. + + In this patch, we have changed the logic to display all the region + capabilities that are present. + + Test Results with CONFIG_BTT disabled + ===================================== + Without this patch + ------------------ + # ./ndctl list -R -C + [ + { + "dev":"region1", + "size":12884901888, + "align":16777216, + "available_size":11257511936, + "max_available_extent":9630121984, + "type":"pmem", + "iset_id":14748366918514061582, + "persistence_domain":"unknown" + }, + + With this patch + --------------- + # ./ndctl list -R -C + [ + { + "dev":"region1", + "size":12884901888, + "align":16777216, + "available_size":11257511936, + "max_available_extent":9630121984, + "type":"pmem", + "iset_id":14748366918514061582, + "capabilities":[ + { + "mode":"fsdax", + "alignments":[ + 65536, + 2097152, + 1073741824 + ] + }, + { + "mode":"devdax", + "alignments":[ + 65536, + 2097152, + 1073741824 + ] + } + ], + "persistence_domain":"unknown" + }, + + Fixes: 965fa02e372f ("util: Distribute 'filter' and 'json' helpers to per-tool objects") + Signed-off-by: Donet Tom + Reviewed-by: Li Zhijian + Tested-by: Li Zhijian + Reviewed-by: Jeff Moyer + Reviewed-by: Alison Schofield + Link: https://lore.kernel.org/r/20250220062029.9789-1-donettom@linux.vnet.ibm.com + Signed-off-by: Alison Schofield + +Signed-off-by: Jeff Moyer + +diff --git a/ndctl/json.c b/ndctl/json.c +index 23bad7f..7646882 100644 +--- a/ndctl/json.c ++++ b/ndctl/json.c +@@ -381,7 +381,7 @@ struct json_object *util_region_capabilities_to_json(struct ndctl_region *region + struct ndctl_pfn *pfn = ndctl_region_get_pfn_seed(region); + struct ndctl_dax *dax = ndctl_region_get_dax_seed(region); + +- if (!btt || !pfn || !dax) ++ if (!btt && !pfn && !dax) + return NULL; + + jcaps = json_object_new_array(); diff --git a/ndctl.spec b/ndctl.spec index 44612a8..43efb86 100644 --- a/ndctl.spec +++ b/ndctl.spec @@ -1,10 +1,11 @@ Name: ndctl Version: 80 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Manage "libnvdimm" subsystem devices (Non-volatile Memory) License: GPL-2.0-only and LGPL-2.1-only and CC0-1.0 and MIT Url: https://github.com/pmem/ndctl Source0: https://github.com/pmem/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +Patch0: def79df-ndctl-list-display-region-caps-for-any-of-BTT-PFN-DAX.patch Requires: ndctl-libs%{?_isa} = %{version}-%{release} Requires: daxctl-libs%{?_isa} = %{version}-%{release} @@ -126,7 +127,7 @@ libcxl is a library for enumerating and communicating with CXL devices. %prep -%setup -q ndctl-%{version} +%autosetup -p1 ndctl-%{version} %build %meson %{?asciidoctor} %{?libtracefs} -Dversion-tag=%{version} @@ -243,6 +244,11 @@ fi %changelog +* Tue Jul 22 2025 Jeff Moyer - 80-4 +- Fix listing of region capabilities (Jeff Moyer) +- Remove orphaned patch file (Jeff Moyer) +- Resolves: RHEL-80436 + * Tue Oct 29 2024 Troy Dawson - 80-3 - Bump release for October 2024 mass rebuild: Resolves: RHEL-64018