nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] test:ndtest: Fix various test cases on ndtest
@ 2021-07-27  8:11 Shivaprasad G Bhat
  2021-07-27  8:11 ` [PATCH 1/3] test/inject-smart: Enable inject-smart tests " Shivaprasad G Bhat
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Shivaprasad G Bhat @ 2021-07-27  8:11 UTC (permalink / raw)
  To: nvdimm
  Cc: aneesh.kumar, sbhat, vaibhav, santosh, dan.j.williams, ira.weiny,
	vishal.l.verma

papr_scm[1] and ndtest[2] now support PDSMs for injecting smart errors
that can exercise various libndctl code paths. The following patch
series updates libndctl to support injecting these inject-smart events
to an nvdimm. Since the support for inject-smart is presently limited
to injecting fatal-health and dirty-shutdown the patch-series tweaks
the ndctl tests to only exercise certain applicable tests for PAPR
nvdimms.

The patches to be applied on the series[3] which added the necessary
smart error injection support. 

The make check results look like this below.

PASS: libndctl
PASS: dsm-fail
FAIL: dpa-alloc
FAIL: parent-uuid
PASS: multi-pmem
PASS: create.sh
FAIL: clear.sh
FAIL: pmem-errors.sh
FAIL: daxdev-errors.sh
PASS: multi-dax.sh
PASS: btt-check.sh
FAIL: label-compat.sh
PASS: blk-exhaust.sh
PASS: sector-mode.sh
FAIL: inject-error.sh
SKIP: btt-errors.sh
SKIP: hugetlb
PASS: btt-pad-compat.sh
SKIP: firmware-update.sh
SKIP: ack-shutdown-count-set
PASS: rescan-partitions.sh
PASS: inject-smart.sh
PASS: monitor.sh
PASS: max_available_extent_ns.sh
FAIL: pfn-meta-errors.sh
PASS: track-uuid.sh
============================================================================
Testsuite summary for ndctl 71.35.gf8b89d5
============================================================================
# TOTAL: 26
# PASS:  14
# SKIP:  4
# XFAIL: 0
# FAIL:  8
# XPASS: 0
# ERROR: 0
============================================================================

[1] : https://patchwork.kernel.org/project/linux-nvdimm/patch/20210712084819.1150350-1-vaibhav@linux.ibm.com/
[2] : https://www.mail-archive.com/nvdimm@lists.linux.dev/msg00590.html
[3] : https://www.mail-archive.com/nvdimm@lists.linux.dev/msg00426.html

---

Shivaprasad G Bhat (3):
      test/inject-smart: Enable inject-smart tests on ndtest
      ndtest/ack-shutdown-count: Skip the test on ndtest
      test/monitor.sh: Partially skip monitor test on ndtest


 test/ack-shutdown-count-set.c |  4 +++
 test/inject-smart.sh          | 12 ++++++---
 test/libndctl.c               | 46 +++++++++++++++++++++++++++++++++++
 test/list-smart-dimm.c        | 36 ++++++++++++++++++++++++++-
 test/monitor.sh               | 11 ++++++++-
 5 files changed, 103 insertions(+), 6 deletions(-)

--
Signature


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] test/inject-smart: Enable inject-smart tests on ndtest
  2021-07-27  8:11 [PATCH 0/3] test:ndtest: Fix various test cases on ndtest Shivaprasad G Bhat
@ 2021-07-27  8:11 ` Shivaprasad G Bhat
  2021-07-27  8:12 ` [PATCH 2/3] ndtest/ack-shutdown-count: Skip the test " Shivaprasad G Bhat
  2021-07-27  8:12 ` [PATCH 3/3] test/monitor.sh: Partially skip monitor " Shivaprasad G Bhat
  2 siblings, 0 replies; 4+ messages in thread
From: Shivaprasad G Bhat @ 2021-07-27  8:11 UTC (permalink / raw)
  To: nvdimm
  Cc: aneesh.kumar, sbhat, vaibhav, santosh, dan.j.williams, ira.weiny,
	vishal.l.verma

The ndtest driver does not have the payloads defined for various
smart fields like the media|ctrl temperature, threshold parameters
for the current PAPR PDSM.

So, the patch makes the below changes to have a valid inject-smart
test run on the ndtest driver.
test/libndctl.c - add separate checks to verify only relavent fields
on ndtest.
test/inject-smart.sh - Test only the shutdown_state and dimm_health
as only those are supported on ndtest. Skip rest of the tests. Reorder
the code for cleanliness
list-list-smart-dimms.c - Separate out filter_dimm implementation for
papr family with the relavent check.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
---
 test/inject-smart.sh   |   12 ++++++++----
 test/libndctl.c        |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 test/list-smart-dimm.c |   36 +++++++++++++++++++++++++++++++++++-
 3 files changed, 89 insertions(+), 5 deletions(-)

diff --git a/test/inject-smart.sh b/test/inject-smart.sh
index 4ca83b8b..909c5b17 100755
--- a/test/inject-smart.sh
+++ b/test/inject-smart.sh
@@ -152,14 +152,18 @@ do_tests()
 	$NDCTL inject-smart -b $bus --uninject-all $dimm
 
 	# start tests
-	for field in "${fields_val[@]}"; do
-		test_field $field $inj_val
-	done
-
 	for field in "${fields_bool[@]}"; do
 		test_field $field
 	done
 
+	if [ $NDCTL_TEST_FAMILY == "PAPR" ]; then
+		return
+	fi
+
+	for field in "${fields_val[@]}"; do
+		test_field $field $inj_val
+	done
+
 	for field in "${fields_thresh[@]}"; do
 		test_field $field $inj_val "thresh"
 	done
diff --git a/test/libndctl.c b/test/libndctl.c
index d9b50f41..ed7f9cc1 100644
--- a/test/libndctl.c
+++ b/test/libndctl.c
@@ -2211,6 +2211,46 @@ struct smart {
 		     life_used, shutdown_state, shutdown_count, vendor_size;
 };
 
+static int check_smart_ndtest(struct ndctl_bus *bus, struct ndctl_dimm *dimm,
+			struct check_cmd *check)
+{
+	static const struct smart smart_data = {
+		.flags = ND_SMART_HEALTH_VALID | ND_SMART_SHUTDOWN_VALID
+			| ND_SMART_SHUTDOWN_COUNT_VALID | ND_SMART_USED_VALID,
+		.health = ND_SMART_NON_CRITICAL_HEALTH,
+		.life_used = 5,
+		.shutdown_state = 0,
+		.shutdown_count = 42,
+		.vendor_size = 0,
+	};
+	struct ndctl_cmd *cmd = ndctl_dimm_cmd_new_smart(dimm);
+	int rc;
+
+	if (!cmd) {
+		fprintf(stderr, "%s: dimm: %#x failed to create cmd\n",
+				__func__, ndctl_dimm_get_handle(dimm));
+		return -ENXIO;
+	}
+
+	rc = ndctl_cmd_submit(cmd);
+	if (rc < 0) {
+		fprintf(stderr, "%s: dimm: %#x failed to submit cmd: %d\n",
+			__func__, ndctl_dimm_get_handle(dimm), rc);
+		ndctl_cmd_unref(cmd);
+		return rc;
+	}
+
+	__check_smart(dimm, cmd, flags, -1);
+	__check_smart(dimm, cmd, health, -1);
+	__check_smart(dimm, cmd, life_used, -1);
+	__check_smart(dimm, cmd, shutdown_state, -1);
+	__check_smart(dimm, cmd, shutdown_count, -1);
+	__check_smart(dimm, cmd, vendor_size, -1);
+
+	check->cmd = cmd;
+	return 0;
+}
+
 static int check_smart(struct ndctl_bus *bus, struct ndctl_dimm *dimm,
 		struct check_cmd *check)
 {
@@ -2434,6 +2474,12 @@ static int check_commands(struct ndctl_bus *bus, struct ndctl_dimm *dimm,
 	};
 
 	unsigned int i, rc = 0;
+	char *test_env = getenv("NDCTL_TEST_FAMILY");
+
+	if (test_env && strcmp(test_env, "PAPR") == 0) {
+		dimm_commands &= ~(1 << ND_CMD_SMART_THRESHOLD);
+		__check_dimm_cmds[ND_CMD_SMART].check_fn = &check_smart_ndtest;
+	}
 
 	/*
 	 * The kernel did not start emulating v1.2 namespace spec smart data
diff --git a/test/list-smart-dimm.c b/test/list-smart-dimm.c
index 00c24e11..98a1f03b 100644
--- a/test/list-smart-dimm.c
+++ b/test/list-smart-dimm.c
@@ -26,6 +26,32 @@ static bool filter_region(struct ndctl_region *region,
 	return true;
 }
 
+static void filter_ndtest_dimm(struct ndctl_dimm *dimm,
+			       struct util_filter_ctx *ctx)
+{
+	struct list_filter_arg *lfa = ctx->list;
+	struct json_object *jdimm;
+
+	if (!ndctl_dimm_is_cmd_supported(dimm, ND_CMD_SMART))
+		return;
+
+	if (!lfa->jdimms) {
+		lfa->jdimms = json_object_new_array();
+		if (!lfa->jdimms) {
+			fail("\n");
+			return;
+		}
+	}
+
+	jdimm = util_dimm_to_json(dimm, lfa->flags);
+	if (!jdimm) {
+		fail("\n");
+		return;
+	}
+
+	json_object_array_add(lfa->jdimms, jdimm);
+}
+
 static void filter_dimm(struct ndctl_dimm *dimm, struct util_filter_ctx *ctx)
 {
 	struct list_filter_arg *lfa = ctx->list;
@@ -89,6 +115,11 @@ int main(int argc, const char *argv[])
 	};
 	struct util_filter_ctx fctx = { 0 };
 	struct list_filter_arg lfa = { 0 };
+	char *test_env = getenv("NDCTL_TEST_FAMILY");
+	int family = NVDIMM_FAMILY_INTEL;
+
+	if (test_env && strcmp(test_env, "PAPR") == 0)
+		family = NVDIMM_FAMILY_PAPR;
 
 	rc = ndctl_new(&ctx);
 	if (rc < 0)
@@ -100,7 +131,10 @@ int main(int argc, const char *argv[])
 		usage_with_options(u, options);
 
 	fctx.filter_bus = filter_bus;
-	fctx.filter_dimm = filter_dimm;
+	if (family == NVDIMM_FAMILY_PAPR)
+		fctx.filter_dimm = filter_ndtest_dimm;
+	else
+		fctx.filter_dimm = filter_dimm;
 	fctx.filter_region = filter_region;
 	fctx.filter_namespace = NULL;
 	fctx.list = &lfa;



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/3] ndtest/ack-shutdown-count: Skip the test on ndtest
  2021-07-27  8:11 [PATCH 0/3] test:ndtest: Fix various test cases on ndtest Shivaprasad G Bhat
  2021-07-27  8:11 ` [PATCH 1/3] test/inject-smart: Enable inject-smart tests " Shivaprasad G Bhat
@ 2021-07-27  8:12 ` Shivaprasad G Bhat
  2021-07-27  8:12 ` [PATCH 3/3] test/monitor.sh: Partially skip monitor " Shivaprasad G Bhat
  2 siblings, 0 replies; 4+ messages in thread
From: Shivaprasad G Bhat @ 2021-07-27  8:12 UTC (permalink / raw)
  To: nvdimm
  Cc: aneesh.kumar, sbhat, vaibhav, santosh, dan.j.williams, ira.weiny,
	vishal.l.verma

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.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
---
 test/ack-shutdown-count-set.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/test/ack-shutdown-count-set.c b/test/ack-shutdown-count-set.c
index c561ff34..17c40e88 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);



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] test/monitor.sh: Partially skip monitor test on ndtest
  2021-07-27  8:11 [PATCH 0/3] test:ndtest: Fix various test cases on ndtest Shivaprasad G Bhat
  2021-07-27  8:11 ` [PATCH 1/3] test/inject-smart: Enable inject-smart tests " Shivaprasad G Bhat
  2021-07-27  8:12 ` [PATCH 2/3] ndtest/ack-shutdown-count: Skip the test " Shivaprasad G Bhat
@ 2021-07-27  8:12 ` Shivaprasad G Bhat
  2 siblings, 0 replies; 4+ messages in thread
From: Shivaprasad G Bhat @ 2021-07-27  8:12 UTC (permalink / raw)
  To: nvdimm
  Cc: aneesh.kumar, sbhat, vaibhav, santosh, dan.j.williams, ira.weiny,
	vishal.l.verma

The ndtest/papr pdsm has the unclean shutdown inject support.
Rest of the tests in monitor.sh are injecting temperature,
spares with thresholds and monitoring on them. These test cases
are irrelavent on ndtest, skip them.

Reorders the code to call the dimm events test first for
cleanliness.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
---
 test/monitor.sh |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/test/monitor.sh b/test/monitor.sh
index 28c55415..b78ed093 100755
--- a/test/monitor.sh
+++ b/test/monitor.sh
@@ -143,6 +143,10 @@ test_filter_dimmevent()
 	check_result "$monitor_dimms"
 	stop_monitor
 
+	if [ $NDCTL_TEST_FAMILY == "PAPR" ]; then
+		return
+	fi
+
 	inject_value=$($NDCTL list -H -d $monitor_dimms | jq -r .[]."health"."spares_threshold")
 	inject_value=$((inject_value - 1))
 	start_monitor "-d $monitor_dimms -D dimm-spares-remaining"
@@ -160,12 +164,17 @@ test_filter_dimmevent()
 
 do_tests()
 {
+	test_filter_dimmevent
+
+	if [ $NDCTL_TEST_FAMILY == "PAPR" ]; then
+		return
+	fi
+
 	test_filter_dimm
 	test_filter_bus
 	test_filter_region
 	test_filter_namespace
 	test_conf_file
-	test_filter_dimmevent
 }
 
 modprobe nfit_test



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-27  8:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-27  8:11 [PATCH 0/3] test:ndtest: Fix various test cases on ndtest Shivaprasad G Bhat
2021-07-27  8:11 ` [PATCH 1/3] test/inject-smart: Enable inject-smart tests " Shivaprasad G Bhat
2021-07-27  8:12 ` [PATCH 2/3] ndtest/ack-shutdown-count: Skip the test " Shivaprasad G Bhat
2021-07-27  8:12 ` [PATCH 3/3] test/monitor.sh: Partially skip monitor " Shivaprasad G Bhat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).