Toshaan Bharvani
1 year ago
commit
7999de05e4
15 changed files with 1715 additions and 0 deletions
@ -0,0 +1,81 @@
@@ -0,0 +1,81 @@
|
||||
ndctl/namespace: Suppress -ENXIO when processing all namespaces. |
||||
|
||||
BZ: |
||||
Brew: |
||||
|
||||
commit 07011a334fd1e4b641cdbfaf5de7500f7bdc941d |
||||
Author: Michal Suchanek <msuchanek@suse.de> |
||||
Date: Wed Jan 6 14:17:41 2021 +0100 |
||||
|
||||
ndctl/namespace: Suppress -ENXIO when processing all namespaces. |
||||
|
||||
When processing all namespaces and no namespaces exist user gets the |
||||
default -ENXIO. Set default rc to 0 when processing all namespaces. |
||||
This avoids confusing error message printed in addition to the message |
||||
saying 0 namespaces were affected. |
||||
|
||||
Before: |
||||
|
||||
# ndctl check-namespace all |
||||
namespace0.0: namespace_check: namespace0.0: check aborted, namespace online |
||||
error checking namespaces: Device or resource busy |
||||
checked 0 namespaces |
||||
# ndctl disable-namespace all |
||||
disabled 1 namespace |
||||
# ndctl check-namespace all |
||||
namespace0.0: namespace_check: Unable to recover any BTT info blocks |
||||
error checking namespaces: No such device or address |
||||
checked 0 namespaces |
||||
# ndctl destroy-namespace all |
||||
destroyed 1 namespace |
||||
# ndctl check-namespace all |
||||
error checking namespaces: No such device or address |
||||
checked 0 namespaces |
||||
# ndctl destroy-namespace all |
||||
error destroying namespaces: No such device or address |
||||
destroyed 0 namespaces |
||||
|
||||
After: |
||||
|
||||
# ndctl check-namespace all |
||||
namespace0.0: namespace_check: namespace0.0: check aborted, namespace online |
||||
error checking namespaces: Device or resource busy |
||||
checked 0 namespaces |
||||
# ndctl disable-namespace namespace0.0 |
||||
disabled 1 namespace |
||||
# ndctl check-namespace all |
||||
namespace0.0: namespace_check: Unable to recover any BTT info blocks |
||||
error checking namespaces: No such device or address |
||||
checked 0 namespaces |
||||
# ndctl destroy-namespace all |
||||
destroyed 1 namespace |
||||
# ndctl check-namespace all |
||||
checked 0 namespaces |
||||
# ndctl destroy-namespace all |
||||
destroyed 0 namespaces |
||||
# ndctl destroy-namespace all |
||||
destroyed 0 namespaces |
||||
|
||||
Note: this does change the return value from -ENXIO to 0 in the cases |
||||
when no namespaces exist and processing all namespaces was requested. |
||||
|
||||
Link: https://patchwork.kernel.org/patch/11681431/ |
||||
Link: https://lore.kernel.org/r/32c8cd8d2716f5e52aebea4e4d303eeb4e0550f9.1609938610.git.msuchanek@suse.de |
||||
Reviewed-by: Santosh S <santosh@fossix.org> |
||||
Signed-off-by: Michal Suchanek <msuchanek@suse.de> |
||||
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> |
||||
|
||||
diff --git a/ndctl/namespace.c b/ndctl/namespace.c |
||||
index 5e65ed5..cd822b3 100644 |
||||
--- a/ndctl/namespace.c |
||||
+++ b/ndctl/namespace.c |
||||
@@ -2151,6 +2151,9 @@ static int do_xaction_namespace(const char *namespace, |
||||
if (!namespace && action != ACTION_CREATE) |
||||
return rc; |
||||
|
||||
+ if (namespace && (strcmp(namespace, "all") == 0)) |
||||
+ rc = 0; |
||||
+ |
||||
if (verbose) |
||||
ndctl_set_log_priority(ctx, LOG_DEBUG); |
||||
|
@ -0,0 +1,48 @@
@@ -0,0 +1,48 @@
|
||||
ndctl/scrub: Reread scrub-engine status at start |
||||
|
||||
BZ: |
||||
Brew: |
||||
|
||||
commit 4e646fa490ba4b782afa188dd8818b94c419924e |
||||
Author: Dan Williams <dan.j.williams@intel.com> |
||||
Date: Wed May 26 16:33:10 2021 -0700 |
||||
|
||||
ndctl/scrub: Reread scrub-engine status at start |
||||
|
||||
Given that the kernel has exponential backoff to cover the lack of |
||||
interrupts for scrub completion status there is a reasonable likelihood |
||||
that 'ndctl start-scrub' is issued while the hardware/platform scrub-state |
||||
is idle, but the kernel engine poll timer has not fired. |
||||
|
||||
Trigger at least one poll cycle for the kernel to re-read the scrub-state |
||||
before reporting that ARS is busy. |
||||
|
||||
Link: https://lore.kernel.org/r/162207199057.3715490.2469820075085914776.stgit@dwillia2-desk3.amr.corp.intel.com |
||||
Reported-by: Krzysztof Rusocki <krzysztof.rusocki@intel.com> |
||||
Signed-off-by: Dan Williams <dan.j.williams@intel.com> |
||||
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> |
||||
|
||||
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c |
||||
index e5641fe..536e142 100644 |
||||
--- a/ndctl/lib/libndctl.c |
||||
+++ b/ndctl/lib/libndctl.c |
||||
@@ -1354,8 +1354,18 @@ static int __ndctl_bus_get_scrub_state(struct ndctl_bus *bus, |
||||
NDCTL_EXPORT int ndctl_bus_start_scrub(struct ndctl_bus *bus) |
||||
{ |
||||
struct ndctl_ctx *ctx = ndctl_bus_get_ctx(bus); |
||||
+ int rc; |
||||
+ |
||||
+ rc = sysfs_write_attr(ctx, bus->scrub_path, "1\n"); |
||||
|
||||
- return sysfs_write_attr(ctx, bus->scrub_path, "1\n"); |
||||
+ /* |
||||
+ * Try at least 1 poll cycle before reporting busy in case this |
||||
+ * request hits the kernel's exponential backoff while the |
||||
+ * hardware/platform scrub state is idle. |
||||
+ */ |
||||
+ if (rc == -EBUSY && ndctl_bus_poll_scrub_completion(bus, 1, 1) == 0) |
||||
+ return sysfs_write_attr(ctx, bus->scrub_path, "1\n"); |
||||
+ return rc; |
||||
} |
||||
|
||||
NDCTL_EXPORT int ndctl_bus_get_scrub_state(struct ndctl_bus *bus) |
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
ndtest/ack-shutdown-count: Skip the test on ndtest |
||||
|
||||
BZ: |
||||
Brew: |
||||
|
||||
commit 6e85cac1958f920f231b94ff570ac0e434595b7d |
||||
Author: Shivaprasad G Bhat <sbhat@linux.ibm.com> |
||||
Date: Tue Jan 25 02:34:25 2022 +0530 |
||||
|
||||
ndtest/ack-shutdown-count: Skip the test on ndtest |
||||
|
||||
The PAPR has non-latched dirty shutdown implementation. |
||||
The test is enabling/disabling the LSS latch which is |
||||
irrelavent from PAPR pov. Skip the test. |
||||
|
||||
Link: https://lore.kernel.org/r/20220124210425.1493410-1-vaibhav@linux.ibm.com |
||||
Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com> |
||||
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> |
||||
|
||||
diff --git a/test/ack-shutdown-count-set.c b/test/ack-shutdown-count-set.c |
||||
index a9e95c6..f091a40 100644 |
||||
--- a/test/ack-shutdown-count-set.c |
||||
+++ b/test/ack-shutdown-count-set.c |
||||
@@ -117,6 +117,7 @@ static int test_ack_shutdown_count_set(int loglevel, struct ndctl_test *test, |
||||
|
||||
int main(int argc, char *argv[]) |
||||
{ |
||||
+ char *test_env = getenv("NDCTL_TEST_FAMILY"); |
||||
struct ndctl_test *test = ndctl_test_new(0); |
||||
struct ndctl_ctx *ctx; |
||||
int rc; |
||||
@@ -126,6 +127,9 @@ int main(int argc, char *argv[]) |
||||
return EXIT_FAILURE; |
||||
} |
||||
|
||||
+ if (test_env && strcmp(test_env, "PAPR") == 0) |
||||
+ return ndctl_test_result(test, 77); |
||||
+ |
||||
rc = ndctl_new(&ctx); |
||||
if (rc) |
||||
return ndctl_test_result(test, rc); |
@ -0,0 +1,84 @@
@@ -0,0 +1,84 @@
|
||||
namespace-action: Drop zero namespace checks. |
||||
|
||||
BZ: |
||||
Brew: |
||||
|
||||
commit 80e0d88c3098bd419e26146a8cb3b693fdd06417 |
||||
Author: Santosh Sivaraj <santosh@fossix.org> |
||||
Date: Wed Jan 6 14:17:42 2021 +0100 |
||||
|
||||
namespace-action: Drop zero namespace checks. |
||||
|
||||
With seed namespaces catched early on these checks for sizes in enable |
||||
and destroy namespace code path are not needed. |
||||
|
||||
Reverts commit b9cb03f6d5a8 ("ndctl/namespace: Fix enable-namespace |
||||
error for seed namespaces") |
||||
|
||||
Reverts commit e01045e58ad5 ("ndctl/namespace: Fix destroy-namespace |
||||
accounting relative to seed devices") |
||||
|
||||
Link: https://patchwork.kernel.org/patch/11739975/ |
||||
Link: https://lore.kernel.org/r/eb4bc7885708fa13e3d37286bc4a4219b1e4e5b6.1609938610.git.msuchanek@suse.de |
||||
Fixes: b9cb03f6d5a8 ("ndctl/namespace: Fix enable-namespace error for seed namespaces") |
||||
Fixes: e01045e58ad5 ("ndctl/namespace: Fix destroy-namespace accounting relative to seed devices") |
||||
Signed-off-by: Santosh Sivaraj <santosh@fossix.org> |
||||
[rebased on top of the previous patches] |
||||
Signed-off-by: Michal Suchanek <msuchanek@suse.de> |
||||
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> |
||||
|
||||
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c |
||||
index 536e142..87f60b9 100644 |
||||
--- a/ndctl/lib/libndctl.c |
||||
+++ b/ndctl/lib/libndctl.c |
||||
@@ -4531,16 +4531,11 @@ NDCTL_EXPORT int ndctl_namespace_enable(struct ndctl_namespace *ndns) |
||||
const char *devname = ndctl_namespace_get_devname(ndns); |
||||
struct ndctl_ctx *ctx = ndctl_namespace_get_ctx(ndns); |
||||
struct ndctl_region *region = ndns->region; |
||||
- unsigned long long size = ndctl_namespace_get_size(ndns); |
||||
int rc; |
||||
|
||||
if (ndctl_namespace_is_enabled(ndns)) |
||||
return 0; |
||||
|
||||
- /* Don't try to enable idle namespace (no capacity allocated) */ |
||||
- if (size == 0) |
||||
- return -ENXIO; |
||||
- |
||||
rc = ndctl_bind(ctx, ndns->module, devname); |
||||
|
||||
/* |
||||
diff --git a/ndctl/namespace.c b/ndctl/namespace.c |
||||
index cd822b3..c67c086 100644 |
||||
--- a/ndctl/namespace.c |
||||
+++ b/ndctl/namespace.c |
||||
@@ -1164,15 +1164,12 @@ static int namespace_destroy(struct ndctl_region *region, |
||||
struct ndctl_namespace *ndns) |
||||
{ |
||||
const char *devname = ndctl_namespace_get_devname(ndns); |
||||
- unsigned long long size; |
||||
int rc; |
||||
|
||||
rc = namespace_prep_reconfig(region, ndns); |
||||
if (rc < 0) |
||||
return rc; |
||||
|
||||
- size = ndctl_namespace_get_size(ndns); |
||||
- |
||||
/* Labeled namespace, destroy label / allocation */ |
||||
if (rc == 2) { |
||||
rc = ndctl_namespace_delete(ndns); |
||||
@@ -1180,13 +1177,6 @@ static int namespace_destroy(struct ndctl_region *region, |
||||
debug("%s: failed to reclaim\n", devname); |
||||
} |
||||
|
||||
- /* |
||||
- * Don't report a destroyed namespace when no capacity was |
||||
- * allocated. |
||||
- */ |
||||
- if (size == 0 && rc == 0) |
||||
- rc = 1; |
||||
- |
||||
return rc; |
||||
} |
||||
|
@ -0,0 +1,57 @@
@@ -0,0 +1,57 @@
|
||||
ndctl/namespace: Skip seed namespaces when processing all namespaces. |
||||
|
||||
BZ: |
||||
Brew: |
||||
|
||||
commit 9bd2994f91bb77604521cbe09a76a51d092c2cfd |
||||
Author: Michal Suchanek <msuchanek@suse.de> |
||||
Date: Wed Jan 6 14:17:40 2021 +0100 |
||||
|
||||
ndctl/namespace: Skip seed namespaces when processing all namespaces. |
||||
|
||||
The seed namespaces are exposed by the kernel but most operations are |
||||
not valid on seed namespaces. |
||||
|
||||
When processing all namespaces the user gets confusing errors from ndctl |
||||
trying to process seed namespaces. The kernel does not provide any way |
||||
to tell that a namspace is seed namespace but skipping namespaces with |
||||
zero size and UUID is a good heuristic. |
||||
|
||||
The user can still specify the namespace by name directly in case |
||||
processing it is desirable. |
||||
|
||||
Link: https://patchwork.kernel.org/patch/11473645/ |
||||
Link: https://lore.kernel.org/r/e55ae2c17b8b9c3288491efe6214338118e8c5ae.1609938610.git.msuchanek@suse.de |
||||
Fixes: #41 |
||||
Tested-by: Harish Sriram <harish@linux.ibm.com> |
||||
Reviewed-by: Santosh S <santosh@fossix.org> |
||||
Signed-off-by: Michal Suchanek <msuchanek@suse.de> |
||||
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> |
||||
|
||||
diff --git a/ndctl/namespace.c b/ndctl/namespace.c |
||||
index 1e8a2cd..5e65ed5 100644 |
||||
--- a/ndctl/namespace.c |
||||
+++ b/ndctl/namespace.c |
||||
@@ -2210,9 +2210,19 @@ static int do_xaction_namespace(const char *namespace, |
||||
ndctl_namespace_foreach_safe(region, ndns, _n) { |
||||
ndns_name = ndctl_namespace_get_devname(ndns); |
||||
|
||||
- if (strcmp(namespace, "all") != 0 |
||||
- && strcmp(namespace, ndns_name) != 0) |
||||
- continue; |
||||
+ if (strcmp(namespace, "all") == 0) { |
||||
+ static const uuid_t zero_uuid; |
||||
+ uuid_t uuid; |
||||
+ |
||||
+ ndctl_namespace_get_uuid(ndns, uuid); |
||||
+ if (!ndctl_namespace_get_size(ndns) && |
||||
+ !memcmp(uuid, zero_uuid, sizeof(uuid_t))) |
||||
+ continue; |
||||
+ } else { |
||||
+ if (strcmp(namespace, ndns_name) != 0) |
||||
+ continue; |
||||
+ } |
||||
+ |
||||
switch (action) { |
||||
case ACTION_DISABLE: |
||||
rc = ndctl_namespace_disable_safe(ndns); |
@ -0,0 +1,179 @@
@@ -0,0 +1,179 @@
|
||||
libndctl/papr: Add limited support for inject-smart |
||||
|
||||
BZ: |
||||
Brew: |
||||
|
||||
commit 9ef460eb7fd1b1f286955b18db8c18cd1a640e77 |
||||
Author: Vaibhav Jain <vaibhav@linux.ibm.com> |
||||
Date: Tue Jan 25 02:08:04 2022 +0530 |
||||
|
||||
libndctl/papr: Add limited support for inject-smart |
||||
|
||||
Implements support for ndctl inject-smart command by providing an |
||||
implementation of 'smart_inject*' dimm-ops callbacks. Presently only |
||||
support for injecting unsafe-shutdown and fatal-health states is |
||||
available. |
||||
|
||||
The patch also introduce various PAPR PDSM structures that are used to |
||||
communicate the inject-smart errors to the papr_scm kernel |
||||
module. This is done via SMART_INJECT PDSM which sends a payload of |
||||
type 'struct nd_papr_pdsm_smart_inject'. |
||||
|
||||
With the patch following output from ndctl inject-smart command is |
||||
expected for PAPR NVDIMMs: |
||||
|
||||
$ sudo ndctl inject-smart -fU nmem0 |
||||
[ |
||||
{ |
||||
"dev":"nmem0", |
||||
"flag_failed_flush":true, |
||||
"flag_smart_event":true, |
||||
"health":{ |
||||
"health_state":"fatal", |
||||
"shutdown_state":"dirty", |
||||
"shutdown_count":0 |
||||
} |
||||
} |
||||
] |
||||
|
||||
$ sudo ndctl inject-smart -N nmem0 |
||||
[ |
||||
{ |
||||
"dev":"nmem0", |
||||
"health":{ |
||||
"health_state":"ok", |
||||
"shutdown_state":"clean", |
||||
"shutdown_count":0 |
||||
} |
||||
} |
||||
] |
||||
|
||||
The patch depends on the kernel PAPR PDSM implementation for |
||||
PDSM_SMART_INJECT posted at [1]. |
||||
|
||||
[1] : https://lore.kernel.org/nvdimm/20220124202204.1488346-1-vaibhav@linux.ibm.com/ |
||||
|
||||
Link: https://lore.kernel.org/r/20220124203804.1490254-1-vaibhav@linux.ibm.com |
||||
Reviewed-by: Ira Weiny <ira.weiny@intel.com> |
||||
Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com> |
||||
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com> |
||||
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> |
||||
|
||||
diff --git a/ndctl/lib/papr.c b/ndctl/lib/papr.c |
||||
index 46cf9c1..7a1d559 100644 |
||||
--- a/ndctl/lib/papr.c |
||||
+++ b/ndctl/lib/papr.c |
||||
@@ -221,6 +221,41 @@ static unsigned int papr_smart_get_shutdown_state(struct ndctl_cmd *cmd) |
||||
return health.dimm_bad_shutdown; |
||||
} |
||||
|
||||
+static int papr_smart_inject_supported(struct ndctl_dimm *dimm) |
||||
+{ |
||||
+ if (!ndctl_dimm_is_cmd_supported(dimm, ND_CMD_CALL)) |
||||
+ return -EOPNOTSUPP; |
||||
+ |
||||
+ if (!test_dimm_dsm(dimm, PAPR_PDSM_SMART_INJECT)) |
||||
+ return -EIO; |
||||
+ |
||||
+ return ND_SMART_INJECT_HEALTH_STATE | ND_SMART_INJECT_UNCLEAN_SHUTDOWN; |
||||
+} |
||||
+ |
||||
+static int papr_smart_inject_valid(struct ndctl_cmd *cmd) |
||||
+{ |
||||
+ if (cmd->type != ND_CMD_CALL || |
||||
+ to_pdsm(cmd)->cmd_status != 0 || |
||||
+ to_pdsm_cmd(cmd) != PAPR_PDSM_SMART_INJECT) |
||||
+ return -EINVAL; |
||||
+ |
||||
+ return 0; |
||||
+} |
||||
+ |
||||
+static struct ndctl_cmd *papr_new_smart_inject(struct ndctl_dimm *dimm) |
||||
+{ |
||||
+ struct ndctl_cmd *cmd; |
||||
+ |
||||
+ cmd = allocate_cmd(dimm, PAPR_PDSM_SMART_INJECT, |
||||
+ sizeof(struct nd_papr_pdsm_smart_inject)); |
||||
+ if (!cmd) |
||||
+ return NULL; |
||||
+ /* Set the input payload size */ |
||||
+ to_ndcmd(cmd)->nd_size_in = ND_PDSM_HDR_SIZE + |
||||
+ sizeof(struct nd_papr_pdsm_smart_inject); |
||||
+ return cmd; |
||||
+} |
||||
+ |
||||
static unsigned int papr_smart_get_life_used(struct ndctl_cmd *cmd) |
||||
{ |
||||
struct nd_papr_pdsm_health health; |
||||
@@ -255,11 +290,37 @@ static unsigned int papr_smart_get_shutdown_count(struct ndctl_cmd *cmd) |
||||
|
||||
return (health.extension_flags & PDSM_DIMM_DSC_VALID) ? |
||||
(health.dimm_dsc) : 0; |
||||
+} |
||||
+ |
||||
+static int papr_cmd_smart_inject_fatal(struct ndctl_cmd *cmd, bool enable) |
||||
+{ |
||||
+ if (papr_smart_inject_valid(cmd) < 0) |
||||
+ return -EINVAL; |
||||
+ |
||||
+ to_payload(cmd)->inject.flags |= PDSM_SMART_INJECT_HEALTH_FATAL; |
||||
+ to_payload(cmd)->inject.fatal_enable = enable; |
||||
|
||||
+ return 0; |
||||
+} |
||||
+ |
||||
+static int papr_cmd_smart_inject_unsafe_shutdown(struct ndctl_cmd *cmd, |
||||
+ bool enable) |
||||
+{ |
||||
+ if (papr_smart_inject_valid(cmd) < 0) |
||||
+ return -EINVAL; |
||||
+ |
||||
+ to_payload(cmd)->inject.flags |= PDSM_SMART_INJECT_BAD_SHUTDOWN; |
||||
+ to_payload(cmd)->inject.unsafe_shutdown_enable = enable; |
||||
+ |
||||
+ return 0; |
||||
} |
||||
|
||||
struct ndctl_dimm_ops * const papr_dimm_ops = &(struct ndctl_dimm_ops) { |
||||
.cmd_is_supported = papr_cmd_is_supported, |
||||
+ .new_smart_inject = papr_new_smart_inject, |
||||
+ .smart_inject_supported = papr_smart_inject_supported, |
||||
+ .smart_inject_fatal = papr_cmd_smart_inject_fatal, |
||||
+ .smart_inject_unsafe_shutdown = papr_cmd_smart_inject_unsafe_shutdown, |
||||
.smart_get_flags = papr_smart_get_flags, |
||||
.get_firmware_status = papr_get_firmware_status, |
||||
.xlat_firmware_status = papr_xlat_firmware_status, |
||||
diff --git a/ndctl/lib/papr_pdsm.h b/ndctl/lib/papr_pdsm.h |
||||
index f45b1e4..20ac20f 100644 |
||||
--- a/ndctl/lib/papr_pdsm.h |
||||
+++ b/ndctl/lib/papr_pdsm.h |
||||
@@ -121,12 +121,29 @@ struct nd_papr_pdsm_health { |
||||
enum papr_pdsm { |
||||
PAPR_PDSM_MIN = 0x0, |
||||
PAPR_PDSM_HEALTH, |
||||
+ PAPR_PDSM_SMART_INJECT, |
||||
PAPR_PDSM_MAX, |
||||
}; |
||||
+/* Flags for injecting specific smart errors */ |
||||
+#define PDSM_SMART_INJECT_HEALTH_FATAL (1 << 0) |
||||
+#define PDSM_SMART_INJECT_BAD_SHUTDOWN (1 << 1) |
||||
+ |
||||
+struct nd_papr_pdsm_smart_inject { |
||||
+ union { |
||||
+ struct { |
||||
+ /* One or more of PDSM_SMART_INJECT_ */ |
||||
+ __u32 flags; |
||||
+ __u8 fatal_enable; |
||||
+ __u8 unsafe_shutdown_enable; |
||||
+ }; |
||||
+ __u8 buf[ND_PDSM_PAYLOAD_MAX_SIZE]; |
||||
+ }; |
||||
+}; |
||||
|
||||
/* Maximal union that can hold all possible payload types */ |
||||
union nd_pdsm_payload { |
||||
struct nd_papr_pdsm_health health; |
||||
+ struct nd_papr_pdsm_smart_inject inject; |
||||
__u8 buf[ND_PDSM_PAYLOAD_MAX_SIZE]; |
||||
} __attribute__((packed)); |
||||
|
@ -0,0 +1,133 @@
@@ -0,0 +1,133 @@
|
||||
libndctl/papr: Add support for reporting shutdown-count |
||||
|
||||
BZ: |
||||
Brew: |
||||
|
||||
commit aa990008f48f21121474a411d829f24e832c89a2 |
||||
Author: Vaibhav Jain <vaibhav@linux.ibm.com> |
||||
Date: Tue Jan 25 00:26:05 2022 +0530 |
||||
|
||||
libndctl/papr: Add support for reporting shutdown-count |
||||
|
||||
Add support for reporting dirty-shutdown-count (DSC) for PAPR based |
||||
NVDIMMs. The sysfs attribute exposing this value is located at |
||||
nmemX/papr/dirty_shutdown. |
||||
|
||||
This counter is also returned in payload for PAPR_PDSM_HEALTH as newly |
||||
introduced member 'dimm_dsc' in 'struct nd_papr_pdsm_health'. Presence |
||||
of 'DSC' is indicated by the PDSM_DIMM_DSC_VALID extension flag. |
||||
|
||||
The patch implements 'ndctl_dimm_ops.smart_get_shutdown_count' |
||||
callback in implemented as papr_smart_get_shutdown_count(). |
||||
|
||||
Kernel side changes to support reporting DSC have been merged to linux kernel |
||||
via patch proposed at [1]. With updated kernel 'ndctl list -DH' reports |
||||
following output on PPC64: |
||||
|
||||
$ sudo ndctl list -DH |
||||
[ |
||||
{ |
||||
"dev":"nmem0", |
||||
"health":{ |
||||
"health_state":"ok", |
||||
"life_used_percentage":50, |
||||
"shutdown_state":"clean", |
||||
"shutdown_count":10 |
||||
} |
||||
} |
||||
] |
||||
|
||||
[1] http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20210624080621.252038-1-vaibhav@linux.ibm.com |
||||
|
||||
Link: https://lore.kernel.org/r/20220124185605.1465681-1-vaibhav@linux.ibm.com |
||||
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com> |
||||
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> |
||||
|
||||
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c |
||||
index 47a234c..5979a92 100644 |
||||
--- a/ndctl/lib/libndctl.c |
||||
+++ b/ndctl/lib/libndctl.c |
||||
@@ -1819,8 +1819,12 @@ static int add_papr_dimm(struct ndctl_dimm *dimm, const char *dimm_base) |
||||
|
||||
/* Allocate monitor mode fd */ |
||||
dimm->health_eventfd = open(path, O_RDONLY|O_CLOEXEC); |
||||
- rc = 0; |
||||
+ /* Get the dirty shutdown counter value */ |
||||
+ sprintf(path, "%s/papr/dirty_shutdown", dimm_base); |
||||
+ if (sysfs_read_attr(ctx, path, buf) == 0) |
||||
+ dimm->dirty_shutdown = strtoll(buf, NULL, 0); |
||||
|
||||
+ rc = 0; |
||||
} else if (strcmp(buf, "nvdimm_test") == 0) { |
||||
/* probe via common populate_dimm_attributes() */ |
||||
rc = populate_dimm_attributes(dimm, dimm_base, "papr"); |
||||
diff --git a/ndctl/lib/papr.c b/ndctl/lib/papr.c |
||||
index 43b8412..46cf9c1 100644 |
||||
--- a/ndctl/lib/papr.c |
||||
+++ b/ndctl/lib/papr.c |
||||
@@ -165,6 +165,9 @@ static unsigned int papr_smart_get_flags(struct ndctl_cmd *cmd) |
||||
if (health.extension_flags & PDSM_DIMM_HEALTH_RUN_GAUGE_VALID) |
||||
flags |= ND_SMART_USED_VALID; |
||||
|
||||
+ if (health.extension_flags & PDSM_DIMM_DSC_VALID) |
||||
+ flags |= ND_SMART_SHUTDOWN_COUNT_VALID; |
||||
+ |
||||
return flags; |
||||
} |
||||
|
||||
@@ -236,6 +239,25 @@ static unsigned int papr_smart_get_life_used(struct ndctl_cmd *cmd) |
||||
(100 - health.dimm_fuel_gauge) : 0; |
||||
} |
||||
|
||||
+static unsigned int papr_smart_get_shutdown_count(struct ndctl_cmd *cmd) |
||||
+{ |
||||
+ |
||||
+ struct nd_papr_pdsm_health health; |
||||
+ |
||||
+ /* Ignore in case of error or invalid pdsm */ |
||||
+ if (!cmd_is_valid(cmd) || |
||||
+ to_pdsm(cmd)->cmd_status != 0 || |
||||
+ to_pdsm_cmd(cmd) != PAPR_PDSM_HEALTH) |
||||
+ return 0; |
||||
+ |
||||
+ /* get the payload from command */ |
||||
+ health = to_payload(cmd)->health; |
||||
+ |
||||
+ return (health.extension_flags & PDSM_DIMM_DSC_VALID) ? |
||||
+ (health.dimm_dsc) : 0; |
||||
+ |
||||
+} |
||||
+ |
||||
struct ndctl_dimm_ops * const papr_dimm_ops = &(struct ndctl_dimm_ops) { |
||||
.cmd_is_supported = papr_cmd_is_supported, |
||||
.smart_get_flags = papr_smart_get_flags, |
||||
@@ -245,4 +267,5 @@ struct ndctl_dimm_ops * const papr_dimm_ops = &(struct ndctl_dimm_ops) { |
||||
.smart_get_health = papr_smart_get_health, |
||||
.smart_get_shutdown_state = papr_smart_get_shutdown_state, |
||||
.smart_get_life_used = papr_smart_get_life_used, |
||||
+ .smart_get_shutdown_count = papr_smart_get_shutdown_count, |
||||
}; |
||||
diff --git a/ndctl/lib/papr_pdsm.h b/ndctl/lib/papr_pdsm.h |
||||
index 1bac8a7..f45b1e4 100644 |
||||
--- a/ndctl/lib/papr_pdsm.h |
||||
+++ b/ndctl/lib/papr_pdsm.h |
||||
@@ -75,6 +75,9 @@ |
||||
/* Indicate that the 'dimm_fuel_gauge' field is valid */ |
||||
#define PDSM_DIMM_HEALTH_RUN_GAUGE_VALID 1 |
||||
|
||||
+/* Indicate that the 'dimm_dsc' field is valid */ |
||||
+#define PDSM_DIMM_DSC_VALID 2 |
||||
+ |
||||
/* |
||||
* Struct exchanged between kernel & ndctl in for PAPR_PDSM_HEALTH |
||||
* Various flags indicate the health status of the dimm. |
||||
@@ -103,6 +106,9 @@ struct nd_papr_pdsm_health { |
||||
|
||||
/* Extension flag PDSM_DIMM_HEALTH_RUN_GAUGE_VALID */ |
||||
__u16 dimm_fuel_gauge; |
||||
+ |
||||
+ /* Extension flag PDSM_DIMM_DSC_VALID */ |
||||
+ __u64 dimm_dsc; |
||||
}; |
||||
__u8 buf[ND_PDSM_PAYLOAD_MAX_SIZE]; |
||||
}; |
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
ndctl/scrub: Stop translating return values |
||||
|
||||
BZ: |
||||
Brew: |
||||
|
||||
commit c52109355b715bbe21e284090435bee7563863cc |
||||
Author: Dan Williams <dan.j.williams@intel.com> |
||||
Date: Wed May 26 16:33:04 2021 -0700 |
||||
|
||||
ndctl/scrub: Stop translating return values |
||||
|
||||
In preparation for triggering a poll loop within ndctl_bus_start_scrub(), |
||||
stop translating return values into -EOPNOTSUPP. |
||||
|
||||
Link: https://lore.kernel.org/r/162207198482.3715490.5994844104395495686.stgit@dwillia2-desk3.amr.corp.intel.com |
||||
Signed-off-by: Dan Williams <dan.j.williams@intel.com> |
||||
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> |
||||
|
||||
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c |
||||
index aa36a3c..e5641fe 100644 |
||||
--- a/ndctl/lib/libndctl.c |
||||
+++ b/ndctl/lib/libndctl.c |
||||
@@ -1354,14 +1354,8 @@ static int __ndctl_bus_get_scrub_state(struct ndctl_bus *bus, |
||||
NDCTL_EXPORT int ndctl_bus_start_scrub(struct ndctl_bus *bus) |
||||
{ |
||||
struct ndctl_ctx *ctx = ndctl_bus_get_ctx(bus); |
||||
- int rc; |
||||
|
||||
- rc = sysfs_write_attr(ctx, bus->scrub_path, "1\n"); |
||||
- if (rc == -EBUSY) |
||||
- return rc; |
||||
- else if (rc < 0) |
||||
- return -EOPNOTSUPP; |
||||
- return 0; |
||||
+ return sysfs_write_attr(ctx, bus->scrub_path, "1\n"); |
||||
} |
||||
|
||||
NDCTL_EXPORT int ndctl_bus_get_scrub_state(struct ndctl_bus *bus) |
@ -0,0 +1,219 @@
@@ -0,0 +1,219 @@
|
||||
libndctl: Unify adding dimms for papr and nfit families |
||||
|
||||
BZ: |
||||
Brew: |
||||
|
||||
commit daef3a386a9c45105a2c045ddee46600e265939f |
||||
Author: Santosh Sivaraj <santosh@fossix.org> |
||||
Date: Thu May 13 11:42:15 2021 +0530 |
||||
|
||||
libndctl: Unify adding dimms for papr and nfit families |
||||
|
||||
In preparation for enabling tests on non-nfit devices, unify both, already very |
||||
similar, functions into one. This will help in adding all attributes needed for |
||||
the unit tests. Since the function doesn't fail if some of the dimm attributes |
||||
are missing, this will work fine on PAPR platforms though only part of the DIMM |
||||
attributes are provided (This doesn't mean that all of the DIMM attributes can |
||||
be missing). |
||||
|
||||
Link: https://lore.kernel.org/r/20210513061218.760322-1-santosh@fossix.org |
||||
Signed-off-by: Santosh Sivaraj <santosh@fossix.org> |
||||
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> |
||||
|
||||
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c |
||||
index 2f6d806..e45353f 100644 |
||||
--- a/ndctl/lib/libndctl.c |
||||
+++ b/ndctl/lib/libndctl.c |
||||
@@ -1646,41 +1646,9 @@ static int ndctl_bind(struct ndctl_ctx *ctx, struct kmod_module *module, |
||||
static int ndctl_unbind(struct ndctl_ctx *ctx, const char *devpath); |
||||
static struct kmod_module *to_module(struct ndctl_ctx *ctx, const char *alias); |
||||
|
||||
-static int add_papr_dimm(struct ndctl_dimm *dimm, const char *dimm_base) |
||||
-{ |
||||
- int rc = -ENODEV; |
||||
- char buf[SYSFS_ATTR_SIZE]; |
||||
- struct ndctl_ctx *ctx = dimm->bus->ctx; |
||||
- char *path = calloc(1, strlen(dimm_base) + 100); |
||||
- const char * const devname = ndctl_dimm_get_devname(dimm); |
||||
- |
||||
- dbg(ctx, "%s: Probing of_pmem dimm at %s\n", devname, dimm_base); |
||||
- |
||||
- if (!path) |
||||
- return -ENOMEM; |
||||
- |
||||
- /* construct path to the papr compatible dimm flags file */ |
||||
- sprintf(path, "%s/papr/flags", dimm_base); |
||||
- |
||||
- if (ndctl_bus_is_papr_scm(dimm->bus) && |
||||
- sysfs_read_attr(ctx, path, buf) == 0) { |
||||
- |
||||
- dbg(ctx, "%s: Adding papr-scm dimm flags:\"%s\"\n", devname, buf); |
||||
- dimm->cmd_family = NVDIMM_FAMILY_PAPR; |
||||
- |
||||
- /* Parse dimm flags */ |
||||
- parse_papr_flags(dimm, buf); |
||||
- |
||||
- /* Allocate monitor mode fd */ |
||||
- dimm->health_eventfd = open(path, O_RDONLY|O_CLOEXEC); |
||||
- rc = 0; |
||||
- } |
||||
- |
||||
- free(path); |
||||
- return rc; |
||||
-} |
||||
- |
||||
-static int add_nfit_dimm(struct ndctl_dimm *dimm, const char *dimm_base) |
||||
+static int populate_dimm_attributes(struct ndctl_dimm *dimm, |
||||
+ const char *dimm_base, |
||||
+ const char *bus_prefix) |
||||
{ |
||||
int i, rc = -1; |
||||
char buf[SYSFS_ATTR_SIZE]; |
||||
@@ -1694,7 +1662,7 @@ static int add_nfit_dimm(struct ndctl_dimm *dimm, const char *dimm_base) |
||||
* 'unique_id' may not be available on older kernels, so don't |
||||
* fail if the read fails. |
||||
*/ |
||||
- sprintf(path, "%s/nfit/id", dimm_base); |
||||
+ sprintf(path, "%s/%s/id", dimm_base, bus_prefix); |
||||
if (sysfs_read_attr(ctx, path, buf) == 0) { |
||||
unsigned int b[9]; |
||||
|
||||
@@ -1709,68 +1677,74 @@ static int add_nfit_dimm(struct ndctl_dimm *dimm, const char *dimm_base) |
||||
} |
||||
} |
||||
|
||||
- sprintf(path, "%s/nfit/handle", dimm_base); |
||||
+ sprintf(path, "%s/%s/handle", dimm_base, bus_prefix); |
||||
if (sysfs_read_attr(ctx, path, buf) < 0) |
||||
goto err_read; |
||||
dimm->handle = strtoul(buf, NULL, 0); |
||||
|
||||
- sprintf(path, "%s/nfit/phys_id", dimm_base); |
||||
+ sprintf(path, "%s/%s/phys_id", dimm_base, bus_prefix); |
||||
if (sysfs_read_attr(ctx, path, buf) < 0) |
||||
goto err_read; |
||||
dimm->phys_id = strtoul(buf, NULL, 0); |
||||
|
||||
- sprintf(path, "%s/nfit/serial", dimm_base); |
||||
+ sprintf(path, "%s/%s/serial", dimm_base, bus_prefix); |
||||
if (sysfs_read_attr(ctx, path, buf) == 0) |
||||
dimm->serial = strtoul(buf, NULL, 0); |
||||
|
||||
- sprintf(path, "%s/nfit/vendor", dimm_base); |
||||
+ sprintf(path, "%s/%s/vendor", dimm_base, bus_prefix); |
||||
if (sysfs_read_attr(ctx, path, buf) == 0) |
||||
dimm->vendor_id = strtoul(buf, NULL, 0); |
||||
|
||||
- sprintf(path, "%s/nfit/device", dimm_base); |
||||
+ sprintf(path, "%s/%s/device", dimm_base, bus_prefix); |
||||
if (sysfs_read_attr(ctx, path, buf) == 0) |
||||
dimm->device_id = strtoul(buf, NULL, 0); |
||||
|
||||
- sprintf(path, "%s/nfit/rev_id", dimm_base); |
||||
+ sprintf(path, "%s/%s/rev_id", dimm_base, bus_prefix); |
||||
if (sysfs_read_attr(ctx, path, buf) == 0) |
||||
dimm->revision_id = strtoul(buf, NULL, 0); |
||||
|
||||
- sprintf(path, "%s/nfit/dirty_shutdown", dimm_base); |
||||
+ sprintf(path, "%s/%s/dirty_shutdown", dimm_base, bus_prefix); |
||||
if (sysfs_read_attr(ctx, path, buf) == 0) |
||||
dimm->dirty_shutdown = strtoll(buf, NULL, 0); |
||||
|
||||
- sprintf(path, "%s/nfit/subsystem_vendor", dimm_base); |
||||
+ sprintf(path, "%s/%s/subsystem_vendor", dimm_base, bus_prefix); |
||||
if (sysfs_read_attr(ctx, path, buf) == 0) |
||||
dimm->subsystem_vendor_id = strtoul(buf, NULL, 0); |
||||
|
||||
- sprintf(path, "%s/nfit/subsystem_device", dimm_base); |
||||
+ sprintf(path, "%s/%s/subsystem_device", dimm_base, bus_prefix); |
||||
if (sysfs_read_attr(ctx, path, buf) == 0) |
||||
dimm->subsystem_device_id = strtoul(buf, NULL, 0); |
||||
|
||||
- sprintf(path, "%s/nfit/subsystem_rev_id", dimm_base); |
||||
+ sprintf(path, "%s/%s/subsystem_rev_id", dimm_base, bus_prefix); |
||||
if (sysfs_read_attr(ctx, path, buf) == 0) |
||||
dimm->subsystem_revision_id = strtoul(buf, NULL, 0); |
||||
|
||||
- sprintf(path, "%s/nfit/family", dimm_base); |
||||
+ sprintf(path, "%s/%s/family", dimm_base, bus_prefix); |
||||
if (sysfs_read_attr(ctx, path, buf) == 0) |
||||
dimm->cmd_family = strtoul(buf, NULL, 0); |
||||
|
||||
- sprintf(path, "%s/nfit/dsm_mask", dimm_base); |
||||
+ sprintf(path, "%s/%s/dsm_mask", dimm_base, bus_prefix); |
||||
if (sysfs_read_attr(ctx, path, buf) == 0) |
||||
dimm->nfit_dsm_mask = strtoul(buf, NULL, 0); |
||||
|
||||
- sprintf(path, "%s/nfit/format", dimm_base); |
||||
+ sprintf(path, "%s/%s/format", dimm_base, bus_prefix); |
||||
if (sysfs_read_attr(ctx, path, buf) == 0) |
||||
dimm->format[0] = strtoul(buf, NULL, 0); |
||||
for (i = 1; i < dimm->formats; i++) { |
||||
- sprintf(path, "%s/nfit/format%d", dimm_base, i); |
||||
+ sprintf(path, "%s/%s/format%d", dimm_base, bus_prefix, i); |
||||
if (sysfs_read_attr(ctx, path, buf) == 0) |
||||
dimm->format[i] = strtoul(buf, NULL, 0); |
||||
} |
||||
|
||||
- sprintf(path, "%s/nfit/flags", dimm_base); |
||||
- if (sysfs_read_attr(ctx, path, buf) == 0) |
||||
- parse_nfit_mem_flags(dimm, buf); |
||||
+ sprintf(path, "%s/%s/flags", dimm_base, bus_prefix); |
||||
+ if (sysfs_read_attr(ctx, path, buf) == 0) { |
||||
+ if (ndctl_bus_has_nfit(dimm->bus)) |
||||
+ parse_nfit_mem_flags(dimm, buf); |
||||
+ else if (ndctl_bus_is_papr_scm(dimm->bus)) { |
||||
+ dimm->cmd_family = NVDIMM_FAMILY_PAPR; |
||||
+ parse_papr_flags(dimm, buf); |
||||
+ } |
||||
+ } |
||||
|
||||
dimm->health_eventfd = open(path, O_RDONLY|O_CLOEXEC); |
||||
rc = 0; |
||||
@@ -1792,7 +1766,8 @@ static void *add_dimm(void *parent, int id, const char *dimm_base) |
||||
if (!path) |
||||
return NULL; |
||||
|
||||
- sprintf(path, "%s/nfit/formats", dimm_base); |
||||
+ sprintf(path, "%s/%s/formats", dimm_base, |
||||
+ ndctl_bus_has_nfit(bus) ? "nfit" : "papr"); |
||||
if (sysfs_read_attr(ctx, path, buf) < 0) |
||||
formats = 1; |
||||
else |
||||
@@ -1866,13 +1841,12 @@ static void *add_dimm(void *parent, int id, const char *dimm_base) |
||||
else |
||||
dimm->fwa_result = fwa_result_to_result(buf); |
||||
|
||||
+ dimm->formats = formats; |
||||
/* Check if the given dimm supports nfit */ |
||||
if (ndctl_bus_has_nfit(bus)) { |
||||
- dimm->formats = formats; |
||||
- rc = add_nfit_dimm(dimm, dimm_base); |
||||
- } else if (ndctl_bus_has_of_node(bus)) { |
||||
- rc = add_papr_dimm(dimm, dimm_base); |
||||
- } |
||||
+ rc = populate_dimm_attributes(dimm, dimm_base, "nfit"); |
||||
+ } else if (ndctl_bus_has_of_node(bus)) |
||||
+ rc = populate_dimm_attributes(dimm, dimm_base, "papr"); |
||||
|
||||
if (rc == -ENODEV) { |
||||
/* Unprobed dimm with no family */ |
||||
@@ -2531,13 +2505,12 @@ static void *add_region(void *parent, int id, const char *region_base) |
||||
goto err_read; |
||||
region->num_mappings = strtoul(buf, NULL, 0); |
||||
|
||||
- sprintf(path, "%s/nfit/range_index", region_base); |
||||
- if (ndctl_bus_has_nfit(bus)) { |
||||
- if (sysfs_read_attr(ctx, path, buf) < 0) |
||||
- goto err_read; |
||||
- region->range_index = strtoul(buf, NULL, 0); |
||||
- } else |
||||
+ sprintf(path, "%s/%s/range_index", region_base, |
||||
+ ndctl_bus_has_nfit(bus) ? "nfit": "papr"); |
||||
+ if (sysfs_read_attr(ctx, path, buf) < 0) |
||||
region->range_index = -1; |
||||
+ else |
||||
+ region->range_index = strtoul(buf, NULL, 0); |
||||
|
||||
sprintf(path, "%s/read_only", region_base); |
||||
if (sysfs_read_attr(ctx, path, buf) < 0) |
@ -0,0 +1,120 @@
@@ -0,0 +1,120 @@
|
||||
libndctl/papr: Fix probe for papr-scm compatible nvdimms |
||||
|
||||
BZ: |
||||
Brew: |
||||
|
||||
commit e086106b4d81a2079141c848db7695451c04e877 |
||||
Author: Vaibhav Jain <vaibhav@linux.ibm.com> |
||||
Date: Mon May 17 21:18:24 2021 +0530 |
||||
|
||||
libndctl/papr: Fix probe for papr-scm compatible nvdimms |
||||
|
||||
With recent changes introduced for unification of PAPR and NFIT |
||||
families the probe for papr-scm nvdimms is broken since they don't |
||||
expose 'handle' or 'phys_id' sysfs attributes. These attributes are |
||||
only exposed by NFIT and 'nvdimm_test' nvdimms. Since 'unable to read' |
||||
these sysfs attributes is a non-recoverable error hence this prevents |
||||
probing of 'PAPR-SCM' nvdimms and ndctl reports following error: |
||||
|
||||
$ sudo NDCTL_LOG=debug ndctl list -DH |
||||
libndctl: ndctl_new: ctx 0x10015342c70 created |
||||
libndctl: add_dimm: nmem1: probe failed: Operation not permitted |
||||
libndctl: __sysfs_device_parse: nmem1: add_dev() failed |
||||
libndctl: add_dimm: nmem0: probe failed: Operation not permitted |
||||
libndctl: __sysfs_device_parse: nmem0: add_dev() failed |
||||
|
||||
Fixing this bug is complicated by the fact these attributes are needed |
||||
for by the 'nvdimm_test' nvdimms which also uses the |
||||
NVDIMM_FAMILY_PAPR. Adding a two way comparison for these two |
||||
attributes in populate_dimm_attributes() to distinguish between |
||||
'nvdimm_test' and papr-scm nvdimms will be clunky and make future |
||||
updates to populate_dimm_attributes() error prone. |
||||
|
||||
So, this patch proposes to fix the issue by re-introducing |
||||
add_papr_dimm() to probe both papr-scm and 'nvdimm_test' nvdimms. The |
||||
'compatible' sysfs attribute associated with the PAPR device is used |
||||
to distinguish between the two nvdimm types and in case an |
||||
'nvdimm_test' device is detected then forward its probe to |
||||
populate_dimm_attributes(). |
||||
|
||||
families") |
||||
|
||||
Link: https://lore.kernel.org/r/20210517154824.142237-1-vaibhav@linux.ibm.com |
||||
Fixes: daef3a386a9c("libndctl: Unify adding dimms for papr and nfit |
||||
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com> |
||||
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> |
||||
|
||||
diff -up ndctl-71.1/ndctl/lib/libndctl.c.orig ndctl-71.1/ndctl/lib/libndctl.c |
||||
--- ndctl-71.1/ndctl/lib/libndctl.c.orig 2022-06-06 17:16:20.703762581 -0400 |
||||
+++ ndctl-71.1/ndctl/lib/libndctl.c 2022-06-06 17:17:34.932019990 -0400 |
||||
@@ -1757,6 +1757,58 @@ static int populate_dimm_attributes(stru |
||||
return rc; |
||||
} |
||||
|
||||
+static int add_papr_dimm(struct ndctl_dimm *dimm, const char *dimm_base) |
||||
+{ |
||||
+ int rc = -ENODEV; |
||||
+ char buf[SYSFS_ATTR_SIZE]; |
||||
+ struct ndctl_ctx *ctx = dimm->bus->ctx; |
||||
+ char *path = calloc(1, strlen(dimm_base) + 100); |
||||
+ const char * const devname = ndctl_dimm_get_devname(dimm); |
||||
+ |
||||
+ dbg(ctx, "%s: Probing of_pmem dimm at %s\n", devname, dimm_base); |
||||
+ |
||||
+ if (!path) |
||||
+ return -ENOMEM; |
||||
+ |
||||
+ /* Check the compatibility of the probed nvdimm */ |
||||
+ sprintf(path, "%s/../of_node/compatible", dimm_base); |
||||
+ if (sysfs_read_attr(ctx, path, buf) < 0) { |
||||
+ dbg(ctx, "%s: Unable to read compatible field\n", devname); |
||||
+ rc = -ENODEV; |
||||
+ goto out; |
||||
+ } |
||||
+ |
||||
+ dbg(ctx, "%s:Compatible of_pmem = '%s'\n", devname, buf); |
||||
+ |
||||
+ /* Probe for papr-scm memory */ |
||||
+ if (strcmp(buf, "ibm,pmemory") == 0) { |
||||
+ /* Read the dimm flags file */ |
||||
+ sprintf(path, "%s/papr/flags", dimm_base); |
||||
+ if (sysfs_read_attr(ctx, path, buf) < 0) { |
||||
+ rc = -errno; |
||||
+ err(ctx, "%s: Unable to read dimm-flags\n", devname); |
||||
+ goto out; |
||||
+ } |
||||
+ |
||||
+ dbg(ctx, "%s: Adding papr-scm dimm flags:\"%s\"\n", devname, buf); |
||||
+ dimm->cmd_family = NVDIMM_FAMILY_PAPR; |
||||
+ |
||||
+ /* Parse dimm flags */ |
||||
+ parse_papr_flags(dimm, buf); |
||||
+ |
||||
+ /* Allocate monitor mode fd */ |
||||
+ dimm->health_eventfd = open(path, O_RDONLY|O_CLOEXEC); |
||||
+ rc = 0; |
||||
+ |
||||
+ } else if (strcmp(buf, "nvdimm_test") == 0) { |
||||
+ /* probe via common populate_dimm_attributes() */ |
||||
+ rc = populate_dimm_attributes(dimm, dimm_base, "papr"); |
||||
+ } |
||||
+out: |
||||
+ free(path); |
||||
+ return rc; |
||||
+} |
||||
+ |
||||
static void *add_dimm(void *parent, int id, const char *dimm_base) |
||||
{ |
||||
int formats, i, rc = -ENODEV; |
||||
@@ -1848,8 +1900,9 @@ static void *add_dimm(void *parent, int |
||||
/* Check if the given dimm supports nfit */ |
||||
if (ndctl_bus_has_nfit(bus)) { |
||||
rc = populate_dimm_attributes(dimm, dimm_base, "nfit"); |
||||
- } else if (ndctl_bus_has_of_node(bus)) |
||||
- rc = populate_dimm_attributes(dimm, dimm_base, "papr"); |
||||
+ } else if (ndctl_bus_has_of_node(bus)) { |
||||
+ rc = add_papr_dimm(dimm, dimm_base); |
||||
+ } |
||||
|
||||
if (rc == -ENODEV) { |
||||
/* Unprobed dimm with no family */ |
@ -0,0 +1,158 @@
@@ -0,0 +1,158 @@
|
||||
libndctl, intel: Indicate supported smart-inject types |
||||
|
||||
BZ: |
||||
Brew: |
||||
|
||||
commit edcd9b7e10b3b33a9660e412a2db1beab30936d3 |
||||
Author: Vaibhav Jain <vaibhav@linux.ibm.com> |
||||
Date: Tue Jan 25 02:07:35 2022 +0530 |
||||
|
||||
libndctl, intel: Indicate supported smart-inject types |
||||
|
||||
Presently the inject-smart code assumes support for injecting all |
||||
smart-errors namely media-temperature, controller-temperature, |
||||
spares-remaining, fatal-health and unsafe-shutdown. This assumption |
||||
may break in case of other non-Intel NVDIMM types namely PAPR NVDIMMs |
||||
which presently only have support for injecting unsafe-shutdown and |
||||
fatal health events. |
||||
|
||||
Trying to inject-smart errors on PAPR NVDIMMs causes problems as |
||||
smart_inject() prematurely exits when trying to inject |
||||
media-temperature smart-error errors out. |
||||
|
||||
To fix this issue the patch proposes extending the definition of |
||||
dimm_op 'smart_inject_supported' to return bitmap of flags indicating |
||||
the type of smart-error injections supported by an NVDIMM. These types |
||||
are indicated by the newly introduced defines ND_SMART_INJECT_* . A |
||||
dimm-ops provide can return an bitmap composed of these flags back |
||||
from its implementation of 'smart_inject_supported' to indicate to |
||||
dimm_inject_smart() which type of smart-error injection it |
||||
supports. In case of an error the dimm-op is still expected to return |
||||
a negative error code back to the caller. |
||||
|
||||
The patch updates intel_dimm_smart_inject_supported() to return a |
||||
bitmap composed of all ND_SMART_INJECT_* flags to indicate support for |
||||
all smart-error types. |
||||
|
||||
Finally the patch also updates smart_inject() to test for specific |
||||
ND_START_INJECT_* flags before sending a smart-inject command via |
||||
dimm-provider. |
||||
|
||||
Link: https://lore.kernel.org/r/20220124203735.1490186-1-vaibhav@linux.ibm.com |
||||
Reviewed-by: Ira Weiny <ira.weiny@intel.com> |
||||
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com> |
||||
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> |
||||
|
||||
diff --git a/ndctl/inject-smart.c b/ndctl/inject-smart.c |
||||
index 2b9d7e8..bd8c01e 100644 |
||||
--- a/ndctl/inject-smart.c |
||||
+++ b/ndctl/inject-smart.c |
||||
@@ -395,18 +395,26 @@ out: |
||||
} \ |
||||
} |
||||
|
||||
-static int smart_inject(struct ndctl_dimm *dimm) |
||||
+static int smart_inject(struct ndctl_dimm *dimm, unsigned int inject_types) |
||||
{ |
||||
const char *name = ndctl_dimm_get_devname(dimm); |
||||
struct ndctl_cmd *si_cmd = NULL; |
||||
int rc = -EOPNOTSUPP; |
||||
|
||||
- send_inject_val(media_temperature) |
||||
- send_inject_val(ctrl_temperature) |
||||
- send_inject_val(spares) |
||||
- send_inject_bool(fatal) |
||||
- send_inject_bool(unsafe_shutdown) |
||||
+ if (inject_types & ND_SMART_INJECT_MEDIA_TEMPERATURE) |
||||
+ send_inject_val(media_temperature); |
||||
|
||||
+ if (inject_types & ND_SMART_INJECT_CTRL_TEMPERATURE) |
||||
+ send_inject_val(ctrl_temperature); |
||||
+ |
||||
+ if (inject_types & ND_SMART_INJECT_SPARES_REMAINING) |
||||
+ send_inject_val(spares); |
||||
+ |
||||
+ if (inject_types & ND_SMART_INJECT_HEALTH_STATE) |
||||
+ send_inject_bool(fatal); |
||||
+ |
||||
+ if (inject_types & ND_SMART_INJECT_UNCLEAN_SHUTDOWN) |
||||
+ send_inject_bool(unsafe_shutdown); |
||||
out: |
||||
ndctl_cmd_unref(si_cmd); |
||||
return rc; |
||||
@@ -417,6 +425,7 @@ static int dimm_inject_smart(struct ndctl_dimm *dimm) |
||||
struct json_object *jhealth; |
||||
struct json_object *jdimms; |
||||
struct json_object *jdimm; |
||||
+ unsigned int supported_types; |
||||
int rc; |
||||
|
||||
rc = ndctl_dimm_smart_inject_supported(dimm); |
||||
@@ -433,6 +442,14 @@ static int dimm_inject_smart(struct ndctl_dimm *dimm) |
||||
error("%s: smart injection not supported by either platform firmware or the kernel.", |
||||
ndctl_dimm_get_devname(dimm)); |
||||
return rc; |
||||
+ default: |
||||
+ if (rc < 0) { |
||||
+ error("%s: Unknown error %d while checking for smart injection support", |
||||
+ ndctl_dimm_get_devname(dimm), rc); |
||||
+ return rc; |
||||
+ } |
||||
+ supported_types = rc; |
||||
+ break; |
||||
} |
||||
|
||||
if (sctx.op_mask & (1 << OP_SET)) { |
||||
@@ -441,7 +458,7 @@ static int dimm_inject_smart(struct ndctl_dimm *dimm) |
||||
goto out; |
||||
} |
||||
if (sctx.op_mask & (1 << OP_INJECT)) { |
||||
- rc = smart_inject(dimm); |
||||
+ rc = smart_inject(dimm, supported_types); |
||||
if (rc) |
||||
goto out; |
||||
} |
||||
diff --git a/ndctl/lib/intel.c b/ndctl/lib/intel.c |
||||
index a3df26e..1314854 100644 |
||||
--- a/ndctl/lib/intel.c |
||||
+++ b/ndctl/lib/intel.c |
||||
@@ -455,7 +455,12 @@ static int intel_dimm_smart_inject_supported(struct ndctl_dimm *dimm) |
||||
return -EIO; |
||||
} |
||||
|
||||
- return 0; |
||||
+ /* Indicate all smart injection types are supported */ |
||||
+ return ND_SMART_INJECT_SPARES_REMAINING | |
||||
+ ND_SMART_INJECT_MEDIA_TEMPERATURE | |
||||
+ ND_SMART_INJECT_CTRL_TEMPERATURE | |
||||
+ ND_SMART_INJECT_HEALTH_STATE | |
||||
+ ND_SMART_INJECT_UNCLEAN_SHUTDOWN; |
||||
} |
||||
|
||||
static const char *intel_cmd_desc(int fn) |
||||
diff --git a/ndctl/libndctl.h b/ndctl/libndctl.h |
||||
index b59026c..4d5cdbf 100644 |
||||
--- a/ndctl/libndctl.h |
||||
+++ b/ndctl/libndctl.h |
||||
@@ -69,6 +69,13 @@ extern "C" { |
||||
#define ND_EVENT_HEALTH_STATE (1 << 3) |
||||
#define ND_EVENT_UNCLEAN_SHUTDOWN (1 << 4) |
||||
|
||||
+/* Flags indicating support for various smart injection types */ |
||||
+#define ND_SMART_INJECT_SPARES_REMAINING (1 << 0) |
||||
+#define ND_SMART_INJECT_MEDIA_TEMPERATURE (1 << 1) |
||||
+#define ND_SMART_INJECT_CTRL_TEMPERATURE (1 << 2) |
||||
+#define ND_SMART_INJECT_HEALTH_STATE (1 << 3) |
||||
+#define ND_SMART_INJECT_UNCLEAN_SHUTDOWN (1 << 4) |
||||
+ |
||||
size_t ndctl_min_namespace_size(void); |
||||
size_t ndctl_sizeof_namespace_index(void); |
||||
size_t ndctl_sizeof_namespace_label(void); |
||||
@@ -311,6 +318,7 @@ int ndctl_cmd_smart_inject_spares(struct ndctl_cmd *cmd, bool enable, |
||||
unsigned int spares); |
||||
int ndctl_cmd_smart_inject_fatal(struct ndctl_cmd *cmd, bool enable); |
||||
int ndctl_cmd_smart_inject_unsafe_shutdown(struct ndctl_cmd *cmd, bool enable); |
||||
+/* Returns a bitmap of ND_SMART_INJECT_* supported */ |
||||
int ndctl_dimm_smart_inject_supported(struct ndctl_dimm *dimm); |
||||
|
||||
struct ndctl_cmd *ndctl_dimm_cmd_new_vendor_specific(struct ndctl_dimm *dimm, |
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
papr: Add support to parse save_fail flag for dimm |
||||
|
||||
BZ: |
||||
Brew: |
||||
|
||||
commit f081f302505209430df46908775a3cffb875a5c7 |
||||
Author: Santosh Sivaraj <santosh@fossix.org> |
||||
Date: Thu May 13 11:42:17 2021 +0530 |
||||
|
||||
papr: Add support to parse save_fail flag for dimm |
||||
|
||||
This will help in getting the dimm fail tests to run on papr family too. |
||||
Also add nvdimm_test compatibility string for recognizing the test module. |
||||
|
||||
Link: https://lore.kernel.org/r/20210513061218.760322-3-santosh@fossix.org |
||||
Signed-off-by: Santosh Sivaraj <santosh@fossix.org> |
||||
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> |
||||
|
||||
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c |
||||
index e45353f..a8b99ea 100644 |
||||
--- a/ndctl/lib/libndctl.c |
||||
+++ b/ndctl/lib/libndctl.c |
||||
@@ -805,6 +805,8 @@ static void parse_papr_flags(struct ndctl_dimm *dimm, char *flags) |
||||
dimm->flags.f_restore = 1; |
||||
else if (strcmp(start, "smart_notify") == 0) |
||||
dimm->flags.f_smart = 1; |
||||
+ else if (strcmp(start, "save_fail") == 0) |
||||
+ dimm->flags.f_save = 1; |
||||
start = end + 1; |
||||
} |
||||
if (end != start) |
||||
@@ -1035,7 +1037,8 @@ NDCTL_EXPORT int ndctl_bus_is_papr_scm(struct ndctl_bus *bus) |
||||
if (sysfs_read_attr(bus->ctx, bus->bus_buf, buf) < 0) |
||||
return 0; |
||||
|
||||
- return (strcmp(buf, "ibm,pmemory") == 0); |
||||
+ return (strcmp(buf, "ibm,pmemory") == 0 || |
||||
+ strcmp(buf, "nvdimm_test") == 0); |
||||
} |
||||
|
||||
/** |
@ -0,0 +1,50 @@
@@ -0,0 +1,50 @@
|
||||
zero_info_block: skip seed devices |
||||
|
||||
BZ: |
||||
Brew: |
||||
|
||||
commit fb13dfb8d84c4f0a749665c8f07179450b199f3e |
||||
Author: Jeff Moyer <jmoyer@redhat.com> |
||||
Date: Tue Feb 9 16:51:53 2021 -0500 |
||||
|
||||
zero_info_block: skip seed devices |
||||
|
||||
Currently, ndctl destroy-namespace -f all will output errors of the |
||||
form: |
||||
|
||||
Error: destroy namespace: namespace0.0 failed to enable for zeroing, continuing |
||||
|
||||
for any zero-sized namespace. That particular namespace looks like this: |
||||
|
||||
{ |
||||
"dev":"namespace0.0", |
||||
"mode":"raw", |
||||
"size":0, |
||||
"uuid":"00000000-0000-0000-0000-000000000000", |
||||
"sector_size":512, |
||||
"state":"disabled" |
||||
} |
||||
|
||||
This patch skips over namespaces with size=0 when zeroing out info |
||||
blocks. |
||||
|
||||
Fixes: 46654c2d60b70 ("ndctl/namespace: Always zero info-blocks") |
||||
Reported-by: Zhang Yi <yizhan@redhat.com> |
||||
Signed-off-by: Jeff Moyer <jmoyer@redhat.com> |
||||
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> |
||||
Link: https://lore.kernel.org/r/x49r1lohpty.fsf@segfault.boston.devel.redhat.com |
||||
|
||||
diff --git a/ndctl/namespace.c b/ndctl/namespace.c |
||||
index 1feb74d..1e8a2cd 100644 |
||||
--- a/ndctl/namespace.c |
||||
+++ b/ndctl/namespace.c |
||||
@@ -1052,6 +1052,9 @@ static int zero_info_block(struct ndctl_namespace *ndns) |
||||
void *buf = NULL, *read_buf = NULL; |
||||
char path[50]; |
||||
|
||||
+ if (ndctl_namespace_get_size(ndns) == 0) |
||||
+ return 1; |
||||
+ |
||||
ndctl_namespace_set_raw_mode(ndns, 1); |
||||
rc = ndctl_namespace_enable(ndns); |
||||
if (rc < 0) { |
@ -0,0 +1,124 @@
@@ -0,0 +1,124 @@
|
||||
Use page size as alignment value |
||||
|
||||
BZ: |
||||
Brew: |
||||
|
||||
commit fe831b526b88f6ca7a27fdb149b8a7d2ecddbc55 |
||||
Author: Santosh Sivaraj <santosh@fossix.org> |
||||
Date: Thu May 13 11:42:18 2021 +0530 |
||||
|
||||
Use page size as alignment value |
||||
|
||||
The alignment sizes passed to ndctl in the tests are all hardcoded to 4k, |
||||
the default page size on x86. Change those to the default page size on that |
||||
architecture (sysconf/getconf). No functional changes otherwise. |
||||
|
||||
Link: https://lore.kernel.org/r/20210513061218.760322-4-santosh@fossix.org |
||||
Signed-off-by: Santosh Sivaraj <santosh@fossix.org> |
||||
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> |
||||
|
||||
diff -up ndctl-71.1/test/dpa-alloc.c.orig ndctl-71.1/test/dpa-alloc.c |
||||
--- ndctl-71.1/test/dpa-alloc.c.orig 2020-12-22 16:44:57.000000000 -0500 |
||||
+++ ndctl-71.1/test/dpa-alloc.c 2022-06-06 17:13:12.045108349 -0400 |
||||
@@ -38,12 +38,13 @@ static int do_test(struct ndctl_ctx *ctx |
||||
struct ndctl_region *region, *blk_region = NULL; |
||||
struct ndctl_namespace *ndns; |
||||
struct ndctl_dimm *dimm; |
||||
- unsigned long size; |
||||
+ unsigned long size, page_size; |
||||
struct ndctl_bus *bus; |
||||
char uuid_str[40]; |
||||
int round; |
||||
int rc; |
||||
|
||||
+ page_size = sysconf(_SC_PAGESIZE); |
||||
/* disable nfit_test.1, not used in this test */ |
||||
bus = ndctl_bus_get_by_provider(ctx, NFIT_PROVIDER1); |
||||
if (!bus) |
||||
@@ -124,11 +125,11 @@ static int do_test(struct ndctl_ctx *ctx |
||||
return rc; |
||||
} |
||||
ndctl_namespace_disable_invalidate(ndns); |
||||
- rc = ndctl_namespace_set_size(ndns, SZ_4K); |
||||
+ rc = ndctl_namespace_set_size(ndns, page_size); |
||||
if (rc) { |
||||
- fprintf(stderr, "failed to init %s to size: %d\n", |
||||
+ fprintf(stderr, "failed to init %s to size: %lu\n", |
||||
ndctl_namespace_get_devname(ndns), |
||||
- SZ_4K); |
||||
+ page_size); |
||||
return rc; |
||||
} |
||||
namespaces[i].ndns = ndns; |
||||
@@ -150,7 +151,7 @@ static int do_test(struct ndctl_ctx *ctx |
||||
ndns = namespaces[i % ARRAY_SIZE(namespaces)].ndns; |
||||
if (i % ARRAY_SIZE(namespaces) == 0) |
||||
round++; |
||||
- size = SZ_4K * round; |
||||
+ size = page_size * round; |
||||
rc = ndctl_namespace_set_size(ndns, size); |
||||
if (rc) { |
||||
fprintf(stderr, "%s: set_size: %lx failed: %d\n", |
||||
@@ -166,7 +167,7 @@ static int do_test(struct ndctl_ctx *ctx |
||||
i--; |
||||
round++; |
||||
ndns = namespaces[i % ARRAY_SIZE(namespaces)].ndns; |
||||
- size = SZ_4K * round; |
||||
+ size = page_size * round; |
||||
rc = ndctl_namespace_set_size(ndns, size); |
||||
if (rc) { |
||||
fprintf(stderr, "%s failed to update while labels full\n", |
||||
@@ -175,7 +176,7 @@ static int do_test(struct ndctl_ctx *ctx |
||||
} |
||||
|
||||
round--; |
||||
- size = SZ_4K * round; |
||||
+ size = page_size * round; |
||||
rc = ndctl_namespace_set_size(ndns, size); |
||||
if (rc) { |
||||
fprintf(stderr, "%s failed to reduce size while labels full\n", |
||||
diff -up ndctl-71.1/test/multi-dax.sh.orig ndctl-71.1/test/multi-dax.sh |
||||
--- ndctl-71.1/test/multi-dax.sh.orig 2020-12-22 16:44:57.000000000 -0500 |
||||
+++ ndctl-71.1/test/multi-dax.sh 2022-06-06 17:13:12.046108353 -0400 |
||||
@@ -12,6 +12,8 @@ check_min_kver "4.13" || do_skip "may la |
||||
|
||||
trap 'err $LINENO' ERR |
||||
|
||||
+ALIGN_SIZE=`getconf PAGESIZE` |
||||
+ |
||||
# setup (reset nfit_test dimms) |
||||
modprobe nfit_test |
||||
$NDCTL disable-region -b $NFIT_TEST_BUS0 all |
||||
@@ -22,9 +24,9 @@ rc=1 |
||||
query=". | sort_by(.available_size) | reverse | .[0].dev" |
||||
region=$($NDCTL list -b $NFIT_TEST_BUS0 -t pmem -Ri | jq -r "$query") |
||||
|
||||
-json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a 4096 -s 16M) |
||||
+json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a $ALIGN_SIZE -s 16M) |
||||
chardev1=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev") |
||||
-json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a 4096 -s 16M) |
||||
+json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a $ALIGN_SIZE -s 16M) |
||||
chardev2=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev") |
||||
|
||||
_cleanup |
||||
diff -up ndctl-71.1/test/sector-mode.sh.orig ndctl-71.1/test/sector-mode.sh |
||||
--- ndctl-71.1/test/sector-mode.sh.orig 2020-12-22 16:44:57.000000000 -0500 |
||||
+++ ndctl-71.1/test/sector-mode.sh 2022-06-06 17:13:12.046108353 -0400 |
||||
@@ -9,6 +9,8 @@ rc=77 |
||||
set -e |
||||
trap 'err $LINENO' ERR |
||||
|
||||
+ALIGN_SIZE=`getconf PAGESIZE` |
||||
+ |
||||
# setup (reset nfit_test dimms) |
||||
modprobe nfit_test |
||||
$NDCTL disable-region -b $NFIT_TEST_BUS0 all |
||||
@@ -25,7 +27,7 @@ NAMESPACE=$($NDCTL list -b $NFIT_TEST_BU |
||||
REGION=$($NDCTL list -R --namespace=$NAMESPACE | jq -r "(.[]) | .dev") |
||||
echo 0 > /sys/bus/nd/devices/$REGION/read_only |
||||
$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m sector -f -l 4K |
||||
-$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m dax -f -a 4K |
||||
+$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m dax -f -a $ALIGN_SIZE |
||||
$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m sector -f -l 4K |
||||
|
||||
_cleanup |
@ -0,0 +1,342 @@
@@ -0,0 +1,342 @@
|
||||
Name: ndctl |
||||
Version: 71.1 |
||||
Release: 7%{?dist} |
||||
Summary: Manage "libnvdimm" subsystem devices (Non-volatile Memory) |
||||
License: GPLv2 |
||||
Url: https://github.com/pmem/ndctl |
||||
Source0: https://github.com/pmem/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz |
||||
|
||||
Patch0: fb13dfb-zero_info_block-skip-seed-devices.patch |
||||
Patch1: daef3a3-libndctl-Unify-adding-dimms-for-papr-and-nfit-families.patch |
||||
Patch2: f081f30-papr-Add-support-to-parse-save_fail-flag-for-dimm.patch |
||||
Patch3: fe831b5-Use-page-size-as-alignment-value.patch |
||||
Patch4: e086106-libndctl-papr-Fix-probe-for-papr-scm-compatible-nvdimms.patch |
||||
Patch5: c521093-ndctl-scrub-Stop-translating-return-values.patch |
||||
Patch6: 4e646fa-ndctl-scrub-Reread-scrub-engine-status-at-start.patch |
||||
Patch7: 9bd2994-ndctl-namespace-Skip-seed-namespaces-when-processing-all-namespaces.patch |
||||
Patch8: 07011a3-ndctl-namespace-Suppress-ENXIO-when-processing-all-namespaces.patch |
||||
Patch9: 80e0d88-namespace-action-Drop-zero-namespace-checks.patch |
||||
Patch10: aa99000-libndctl-papr-Add-support-for-reporting-shutdown-count.patch |
||||
Patch11: edcd9b7-libndctl-intel-Indicate-supported-smart-inject-types.patch |
||||
Patch12: 9ef460e-libndctl-papr-Add-limited-support-for-inject-smart.patch |
||||
Patch13: 6e85cac-ndtest-ack-shutdown-count-Skip-the-test-on-ndtest.patch |
||||
|
||||
|
||||
Requires: ndctl-libs%{?_isa} = %{version}-%{release} |
||||
Requires: daxctl-libs%{?_isa} = %{version}-%{release} |
||||
BuildRequires: make |
||||
BuildRequires: autoconf |
||||
%if 0%{?rhel} < 9 |
||||
BuildRequires: asciidoc |
||||
%define asciidoc --disable-asciidoctor |
||||
%else |
||||
BuildRequires: rubygem-asciidoctor |
||||
%endif |
||||
BuildRequires: xmlto |
||||
BuildRequires: automake |
||||
BuildRequires: libtool |
||||
BuildRequires: pkgconfig |
||||
BuildRequires: pkgconfig(libkmod) |
||||
BuildRequires: pkgconfig(libudev) |
||||
BuildRequires: pkgconfig(uuid) |
||||
BuildRequires: pkgconfig(json-c) |
||||
BuildRequires: pkgconfig(bash-completion) |
||||
BuildRequires: pkgconfig(systemd) |
||||
BuildRequires: keyutils-libs-devel |
||||
|
||||
%description |
||||
Utility library for managing the "libnvdimm" subsystem. The "libnvdimm" |
||||
subsystem defines a kernel device model and control message interface for |
||||
platform NVDIMM resources like those defined by the ACPI 6+ NFIT (NVDIMM |
||||
Firmware Interface Table). |
||||
|
||||
|
||||
%package -n ndctl-devel |
||||
Summary: Development files for libndctl |
||||
License: LGPLv2 |
||||
Requires: ndctl-libs%{?_isa} = %{version}-%{release} |
||||
|
||||
%description -n ndctl-devel |
||||
The %{name}-devel package contains libraries and header files for |
||||
developing applications that use %{name}. |
||||
|
||||
%package -n daxctl |
||||
Summary: Manage Device-DAX instances |
||||
License: GPLv2 |
||||
Requires: daxctl-libs%{?_isa} = %{version}-%{release} |
||||
|
||||
%description -n daxctl |
||||
The daxctl utility provides enumeration and provisioning commands for |
||||
the Linux kernel Device-DAX facility. This facility enables DAX mappings |
||||
of performance / feature differentiated memory without need of a |
||||
filesystem. |
||||
|
||||
%package -n daxctl-devel |
||||
Summary: Development files for libdaxctl |
||||
License: LGPLv2 |
||||
Requires: daxctl-libs%{?_isa} = %{version}-%{release} |
||||
|
||||
%description -n daxctl-devel |
||||
The %{name}-devel package contains libraries and header files for |
||||
developing applications that use %{name}, a library for enumerating |
||||
"Device DAX" devices. Device DAX is a facility for establishing DAX |
||||
mappings of performance / feature-differentiated memory. |
||||
|
||||
|
||||
%package -n ndctl-libs |
||||
Summary: Management library for "libnvdimm" subsystem devices (Non-volatile Memory) |
||||
License: LGPLv2 |
||||
Requires: daxctl-libs%{?_isa} = %{version}-%{release} |
||||
|
||||
|
||||
%description -n ndctl-libs |
||||
Libraries for %{name}. |
||||
|
||||
%package -n daxctl-libs |
||||
Summary: Management library for "Device DAX" devices |
||||
License: LGPLv2 |
||||
|
||||
%description -n daxctl-libs |
||||
Device DAX is a facility for establishing DAX mappings of performance / |
||||
feature-differentiated memory. daxctl-libs provides an enumeration / |
||||
control API for these devices. |
||||
|
||||
|
||||
%prep |
||||
%autosetup -p1 ndctl-%{version} |
||||
|
||||
%build |
||||
echo %{version} > version |
||||
./autogen.sh |
||||
%configure --disable-static --disable-silent-rules %{?asciidoc} |
||||
make %{?_smp_mflags} |
||||
|
||||
%install |
||||
%make_install |
||||
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' |
||||
|
||||
%check |
||||
make check |
||||
|
||||
%ldconfig_scriptlets -n ndctl-libs |
||||
|
||||
%ldconfig_scriptlets -n daxctl-libs |
||||
|
||||
%define bashcompdir %(pkg-config --variable=completionsdir bash-completion) |
||||
|
||||
%files |
||||
%license LICENSES/preferred/GPL-2.0 LICENSES/other/MIT LICENSES/other/CC0-1.0 |
||||
%{_bindir}/ndctl |
||||
%{_mandir}/man1/ndctl* |
||||
%{bashcompdir}/ |
||||
%{_unitdir}/ndctl-monitor.service |
||||
%{_sysconfdir}/ndctl/keys/keys.readme |
||||
%{_sysconfdir}/modprobe.d/nvdimm-security.conf |
||||
|
||||
%config(noreplace) %{_sysconfdir}/ndctl/monitor.conf |
||||
|
||||
%files -n daxctl |
||||
%license LICENSES/preferred/GPL-2.0 LICENSES/other/MIT LICENSES/other/CC0-1.0 |
||||
%{_bindir}/daxctl |
||||
%{_mandir}/man1/daxctl* |
||||
%{_datadir}/daxctl/daxctl.conf |
||||
|
||||
%files -n ndctl-libs |
||||
%doc README.md |
||||
%license LICENSES/preferred/LGPL-2.1 LICENSES/other/MIT LICENSES/other/CC0-1.0 |
||||
%{_libdir}/libndctl.so.* |
||||
|
||||
%files -n daxctl-libs |
||||
%doc README.md |
||||
%license LICENSES/preferred/LGPL-2.1 LICENSES/other/MIT LICENSES/other/CC0-1.0 |
||||
%{_libdir}/libdaxctl.so.* |
||||
|
||||
%files -n ndctl-devel |
||||
%license LICENSES/preferred/LGPL-2.1 |
||||
%{_includedir}/ndctl/ |
||||
%{_libdir}/libndctl.so |
||||
%{_libdir}/pkgconfig/libndctl.pc |
||||
|
||||
%files -n daxctl-devel |
||||
%license LICENSES/preferred/LGPL-2.1 |
||||
%{_includedir}/daxctl/ |
||||
%{_libdir}/libdaxctl.so |
||||
%{_libdir}/pkgconfig/libdaxctl.pc |
||||
|
||||
|
||||
%changelog |
||||
* Tue Jun 14 2022 Bryan Gurney <bgurney@redhat.com> - 71.1-7 |
||||
- Pull in fixes from upstream v72 and v73 (Jeff Moyer) |
||||
- Fix enable-namespace all reporting errors incorrectly |
||||
- Add support for inject-smart on papr scm |
||||
- Related: rhbz#2040075 |
||||
- Related: rhbz#1873851 |
||||
- Related: rhbz#1880578 |
||||
- Related: rhbz#1922538 |
||||
- Related: rhbz#2087707 |
||||
|
||||
* Wed Dec 1 2021 Bryan Gurney <bgurney@redhat.com> - 71.1-6 |
||||
- Add gating test |
||||
- Related: rhbz#2028152 |
||||
|
||||
* Mon Nov 29 2021 Bryan Gurney <bgurney@redhat.com> - 71.1-5 |
||||
- Rebuild with latest json-c version |
||||
- Related: rhbz#2023317 |
||||
|
||||
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 71.1-4 |
||||
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags |
||||
Related: rhbz#1991688 |
||||
|
||||
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 71.1-3 |
||||
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 |
||||
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 71.1-2 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild |
||||
|
||||
* Tue Dec 22 2020 Vishal Verma <vishal.l.verma@intel.com> - 71.1-1 |
||||
- release v71.1 |
||||
|
||||
* Sat Dec 19 2020 Vishal Verma <vishal.l.verma@intel.com> - 71-1 |
||||
- release v71 |
||||
|
||||
* Sat Oct 10 2020 Vishal Verma <vishal.l.verma@intel.com> - 70.1-1 |
||||
- release v70.1 |
||||
|
||||
* Tue Oct 06 2020 Vishal Verma <vishal@stellar.sh> - 70-1 |
||||
- release v70 |
||||
|
||||
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 69-2 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild |
||||
|
||||
* Thu Jul 23 2020 Vishal Verma <vishal.l.verma@intel.com> - 69-1 |
||||
- release v69 |
||||
|
||||
* Tue Apr 21 2020 Björn Esser <besser82@fedoraproject.org> - 68-2 |
||||
- Rebuild (json-c) |
||||
|
||||
* Tue Mar 24 2020 Vishal Verma <vishal@stellar.sh> - 68-1 |
||||
- release v68 |
||||
|
||||
* Fri Jan 31 2020 Vishal Verma <vishal.l.verma@intel.com> - 67-3 |
||||
- Add fix for GCC10 builds |
||||
|
||||
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 67-2 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild |
||||
|
||||
* Mon Oct 28 2019 Vishal Verma <vishal.l.verma@intel.com> - 67-1 |
||||
- release v67 |
||||
|
||||
* Wed Aug 07 2019 Vishal Verma <vishal.l.verma@intel.com> - 66-1 |
||||
- release v66 |
||||
|
||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 65-2 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild |
||||
|
||||
* Sat May 11 2019 Vishal Verma <vishal.l.verma@intel.com> - 65-1 |
||||
- release v65 |
||||
|
||||
* Wed Feb 06 2019 Vishal Verma <vishal.l.verma@intel.com> - 64.1-1 |
||||
- release v64.1 |
||||
|
||||
* Mon Feb 04 2019 Vishal Verma <vishal.l.verma@intel.com> - 64-1 |
||||
- release v64 |
||||
|
||||
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 63-2 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild |
||||
|
||||
* Fri Oct 05 2018 Vishal Verma <vishal.l.verma@intel.com> - 63-1 |
||||
- release v63 |
||||
- remove ndctl-udev and related files |
||||
|
||||
* Tue Aug 14 2018 Vishal Verma <vishal@stellar.sh> - 62-1 |
||||
- release v62 |
||||
- Add files for udev and ndctl-monitor |
||||
|
||||
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 61.2-2 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild |
||||
|
||||
* Wed Jul 11 2018 Vishal Verma <vishal.l.verma@intel.com> - 61.2-1 |
||||
- release v61.2 |
||||
|
||||
* Tue Jun 26 2018 Vishal Verma <vishal@stellar.sh> - 61.1-1 |
||||
- release v61.1 |
||||
|
||||
* Tue Jun 26 2018 Vishal Verma <vishal@stellar.sh> - 61-1 |
||||
- new version |
||||
|
||||
* Thu May 17 2018 Dan Williams <dan.j.williams@intel.com> - 60.3-1 |
||||
- release v60.3 |
||||
|
||||
* Mon Apr 23 2018 Dan Williams <dan.j.williams@intel.com> - 60.1-1 |
||||
- release v60.1 |
||||
|
||||
* Thu Apr 19 2018 Dan Williams <dan.j.williams@intel.com> - 60-1 |
||||
- release v60 |
||||
|
||||
* Tue Mar 27 2018 Dan Williams <dan.j.williams@intel.com> - 59.3-1 |
||||
- release v59.3 |
||||
|
||||
* Tue Mar 06 2018 Björn Esser <besser82@fedoraproject.org> - 59.2-2 |
||||
- Rebuilt for libjson-c.so.4 (json-c v0.13.1) |
||||
|
||||
* Fri Feb 09 2018 Dan Williams <dan.j.williams@intel.com> - 59.2-1 |
||||
- release v59.2 |
||||
|
||||
* Fri Feb 09 2018 Dan Williams <dan.j.williams@intel.com> - 59.1-1 |
||||
- release v59.1 |
||||
|
||||
* Fri Feb 09 2018 Dan Williams <dan.j.williams@intel.com> - 59-1 |
||||
- release v59 |
||||
|
||||
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 58.4-3 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild |
||||
|
||||
* Sun Dec 10 2017 Björn Esser <besser82@fedoraproject.org> - 58.4-2 |
||||
- Rebuilt for libjson-c.so.3 |
||||
|
||||
* Thu Nov 16 2017 Dan Williams <dan.j.williams@intel.com> - 58.4-1 |
||||
- release v58.4 |
||||
|
||||
* Thu Sep 21 2017 Dan Williams <dan.j.williams@intel.com> - 58.2-1 |
||||
- release v58.2 |
||||
|
||||
* Fri Sep 08 2017 Dan Williams <dan.j.williams@intel.com> - 58.1-2 |
||||
- gate libpmem dependency on x86_64 |
||||
|
||||
* Fri Sep 08 2017 Dan Williams <dan.j.williams@intel.com> - 58.1-1 |
||||
- add libpmem dependency |
||||
- release v58.1 |
||||
|
||||
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 57.1-3 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild |
||||
|
||||
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 57.1-2 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild |
||||
|
||||
* Fri Jun 30 2017 Dan Williams <dan.j.williams@intel.com> - 57.1-1 |
||||
- Release v57.1 |
||||
|
||||
* Sat May 27 2017 Dan Williams <dan.j.williams@intel.com> - 57-1 |
||||
- Release v57 |
||||
|
||||
* Fri Feb 10 2017 Dan Williams <dan.j.williams@intel.com> - 56-1 |
||||
- Release v56 |
||||
|
||||
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 55-2 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild |
||||
|
||||
* Fri Oct 21 2016 Dan Williams <dan.j.williams@intel.com> - 55-1 |
||||
- release v55 |
||||
|
||||
* Fri Aug 05 2016 Dan Williams <dan.j.williams@intel.com> - 54-1 |
||||
- add explicit lib version dependencies |
||||
|
||||
* Sat May 28 2016 Dan Williams <dan.j.williams@intel.com> - 53.1-1 |
||||
- Fix up tag format vs source url confusion |
||||
|
||||
* Fri May 27 2016 Dan Williams <dan.j.williams@intel.com> - 53-1 |
||||
- add daxctl-libs + daxctl-devel packages |
||||
- add bash completion |
||||
|
||||
* Mon Apr 04 2016 Dan Williams <dan.j.williams@intel.com> - 52-1 |
||||
- Initial rpm submission to Fedora |
Loading…
Reference in new issue