Skip to contentSkip to conversation

test: Don't skip tests if nfit modules are missing

PATCH Santosh Sivaraj 1 participant 1 message May 1, 2021 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 70 lines · Santosh Sivaraj

"Verma, Vishal L" <[email protected]> writes:

Hi Vishal,

Quoted 19 lines · Santosh Sivaraj
Quoted 5 lines

For NFIT to be available ACPI is a must, so don't fail when nfit modules are missing on a platform that doesn't support ACPI.

---

Quoted 12 lines
 test.h                        |  2 +-
 test/ack-shutdown-count-set.c |  2 +-
 test/blk_namespaces.c         |  2 +-
 test/core.c                   | 30 ++++++++++++++++++++++++++++--
 test/dpa-alloc.c              |  2 +-
 test/dsm-fail.c               |  2 +-
 test/libndctl.c               |  2 +-
 test/multi-pmem.c             |  2 +-
 test/parent-uuid.c            |  2 +-
 test/pmem_namespaces.c        |  2 +-
 10 files changed, 37 insertions(+), 11 deletions(-)
Quoted 6 lines

I haven't looked deeper, but this seems to fail the blk-ns test with:

ACPI.NFIT unavailable falling back to nfit_test test/init: ndctl_test_init: Cannot determine NVDIMM family __ndctl_test_skip: explicit skip test_blk_namespaces:235 nfit_test unavailable skipping tests

The first message will be emitted even without the changes if the bus is not found. The second error will be emitted when /sys/bus/acpi is not found. We fail for all other buses by default as before. PAPR tests are enabled only when NVDIMM_TEST_FAMILY is set to "PAPR".

All tests pass in my setup with the recent upstream kernel, except for the the below warning from drivers/acpi/nfit/core.c:

[ 2426.727584] ------------[ cut here ]------------
[ 2426.728405] WARNING: CPU: 2 PID: 47504 at tools/testing/nvdimm/../../../drivers/acpi/nfit/core.c:3879 nfit_exit+0x]
[ 2426.730264] Modules linked in: dax_pmem(O) nd_pmem(O) nfit(O-) kmem dax_pmem_compat(O) nd_blk(O) dax_pmem_core(O) ]
[ 2426.733209] CPU: 2 PID: 47504 Comm: modprobe Tainted: G        W  O      5.12.0+ #3
[ 2426.734472] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.o4
[ 2426.736305] RIP: 0010:nfit_exit+0x2c/0x703 [nfit]
[ 2426.737099] Code: fd ff ff 48 c7 c7 00 f0 39 c0 e8 52 a1 38 da 48 8b 3d 6b 46 00 00 e8 e6 88 ee d9 48 8b 05 5f 3c 0
[ 2426.740046] RSP: 0018:ffffa8e800b77ed8 EFLAGS: 00010287
[ 2426.740990] RAX: ffff95b7e51935b0 RBX: 0000000000000800 RCX: ffffffff9b4a36a8
[ 2426.742236] RDX: 0000000000000000 RSI: 0000000000000083 RDI: ffff95b7c03e1554
[ 2426.743404] RBP: ffffffffc039f740 R08: 0000000000000400 R09: ffff95b7c03e0e50
[ 2426.744617] R10: ffff95b7fbd296f0 R11: 0000000000895440 R12: ffffa8e800b77f58
[ 2426.745792] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[ 2426.746946] FS:  00007f48297e3740(0000) GS:ffff95b7fbd00000(0000) knlGS:0000000000000000
[ 2426.748250] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 2426.749198] CR2: 000056072aadc9f8 CR3: 0000000118b08000 CR4: 00000000000006e0
[ 2426.750349] Call Trace:
[ 2426.750754]  __do_sys_delete_module+0x19d/0x240
[ 2426.751472]  ? task_work_run+0x5c/0x90
[ 2426.751964]  ? exit_to_user_mode_prepare+0x2a/0x130
[ 2426.752637]  do_syscall_64+0x40/0x80
[ 2426.753121]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 2426.753810] RIP: 0033:0x7f482991361b
[ 2426.754274] Code: 73 01 c3 48 8b 0d 5d 18 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 8
[ 2426.756668] RSP: 002b:00007ffd46c89b98 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
[ 2426.757676] RAX: ffffffffffffffda RBX: 000056072aad8f90 RCX: 00007f482991361b
[ 2426.758618] RDX: 0000000000000000 RSI: 0000000000000800 RDI: 000056072aad8ff8
[ 2426.759563] RBP: 000056072aad8f90 R08: 0000000000000000 R09: 0000000000000000
[ 2426.760513] R10: 00007f4829987ac0 R11: 0000000000000206 R12: 000056072aad8ff8
[ 2426.761463] R13: 0000000000000000 R14: 000056072aadb4e8 R15: 00007ffd46c89d18
[ 2426.762405] ---[ end trace 14a8748cda8b4777 ]---
Quoted 2 lines

This was not seen with the 5.11 kernel.

Reverting cf16b05c607b ("ACPICA: ACPI 6.4: NFIT: add Location Cookie field") doesn't produce the warning.

Thanks,
Santosh

Quoted 196 lines
Quoted 196 lines
Quoted 196 lines
test.h +0 -0
index cba8d41..7de13fe 100644
@@ -20,7 +20,7 @@ void builtin_xaction_namespace_reset(void);

 struct kmod_ctx;
 struct kmod_module;

test.h +1 -1
-int nfit_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,
+int ndctl_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,

  struct ndctl_ctx *nd_ctx, int log_level, struct ndctl_test *test);

test/ack-shutdown-count-set.c +0 -0
index fb1d82b..c561ff3 100644
@@ -99,7 +99,7 @@ static int test_ack_shutdown_count_set(int loglevel, struct ndctl_test *test,
  	int result = EXIT_FAILURE, err;

  ndctl_set_log_priority(ctx, loglevel);

test/ack-shutdown-count-set.c +1 -1
-	err = nfit_test_init(&kmod_ctx, &mod, NULL, loglevel, test);
+	err = ndctl_test_init(&kmod_ctx, &mod, NULL, loglevel, test);

  if (err < 0) {
  result = 77;
  ndctl_test_skip(test);

test/blk_namespaces.c +0 -0
index d7f00cb..f076e85 100644
@@ -228,7 +228,7 @@ int test_blk_namespaces(int log_level, struct ndctl_test *test,

  if (!bus) {
  fprintf(stderr, "ACPI.NFIT unavailable falling back to nfit_test\n");

test/blk_namespaces.c +1 -1
-		rc = nfit_test_init(&kmod_ctx, &mod, NULL, log_level, test);
+		rc = ndctl_test_init(&kmod_ctx, &mod, NULL, log_level, test);

  ndctl_invalidate(ctx);
  bus = ndctl_bus_get_by_provider(ctx, "nfit_test.0"); if (rc < 0 || !bus) {

test/core.c +1 -0
index cc7d8d9..44cb277 100644
@@ -11,6 +11,7 @@
  #include <util/log.h>
  #include <util/sysfs.h>
  #include <ndctl/libndctl.h>
+#include <ndctl/ndctl.h>
  #include <ccan/array_size/array_size.h>

 #define KVER_STRLEN 20

test/core.c +0 -0
@@ -106,11 +107,11 @@ int ndctl_test_get_skipped(struct ndctl_test *test)
  	return test->skip;
  }

test/core.c +1 -1
-int nfit_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,
+int ndctl_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,

  struct ndctl_ctx *nd_ctx, int log_level, struct ndctl_test *test)
 {

test/core.c +1 -1
-	int rc;
+	int rc, family = -1;

  unsigned int i;
  const char *name;
  struct ndctl_bus *bus;

test/core.c +1 -0
@@ -127,10 +128,30 @@ int nfit_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,
  		"nd_e820",
  		"nd_pmem",
  	};
+	char *test_env;

  log_init(&log_ctx, "test/init", "NDCTL_TEST"); log_ctx.log_priority = log_level;

test/core.c +19 -0
+	/*
+	 * The following two checks determine the platform family. For
+	 * Intel/platforms which support ACPI, check sysfs; for other platforms
+	 * determine from the environment variable NVDIMM_TEST_FAMILY
+	 */
+	if (access("/sys/bus/acpi", F_OK) == 0) {
+		if (errno == ENOENT)
+			family = NVDIMM_FAMILY_INTEL;
+	}
+
+	test_env = getenv("NDCTL_TEST_FAMILY");
+	if (test_env && strcmp(test_env, "PAPR") == 0)
+		family = NVDIMM_FAMILY_PAPR;
+
+	if (family == -1) {
+		log_err(&log_ctx, "Cannot determine NVDIMM family\n");
+		return -ENOTSUP;
+	}
+

  *ctx = kmod_new(NULL, NULL);
  if (!*ctx)
  return -ENXIO;

test/core.c +0 -0
@@ -185,6 +206,11 @@ retry:

  path = kmod_module_get_path(*mod); if (!path) {

test/core.c +5 -0
+			if (family != NVDIMM_FAMILY_INTEL &&
+			    (strcmp(name, "nfit") == 0 ||
+			     strcmp(name, "nd_e820") == 0))
+				continue;
+

  log_err(&log_ctx, "%s.ko: failed to get path\n", name); break;
  }

test/dpa-alloc.c +0 -0
index e922009..0b3bb7a 100644
@@ -289,7 +289,7 @@ int test_dpa_alloc(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx)
  		return 77;

  ndctl_set_log_priority(ctx, loglevel);

test/dpa-alloc.c +1 -1
-	err = nfit_test_init(&kmod_ctx, &mod, NULL, loglevel, test);
+	err = ndctl_test_init(&kmod_ctx, &mod, NULL, loglevel, test);

  if (err < 0) {
  ndctl_test_skip(test);
  fprintf(stderr, "nfit_test unavailable skipping tests\n");

test/dsm-fail.c +0 -0
index 9dfd8b0..0a6383d 100644
@@ -346,7 +346,7 @@ int test_dsm_fail(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx)
  	int result = EXIT_FAILURE, err;

  ndctl_set_log_priority(ctx, loglevel);

test/dsm-fail.c +1 -1
-	err = nfit_test_init(&kmod_ctx, &mod, NULL, loglevel, test);
+	err = ndctl_test_init(&kmod_ctx, &mod, NULL, loglevel, test);

  if (err < 0) {
  result = 77;
  ndctl_test_skip(test);

test/libndctl.c +0 -0
index 24d72b3..0e88fce 100644
@@ -2692,7 +2692,7 @@ int test_libndctl(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx)
  	daxctl_set_log_priority(daxctl_ctx, loglevel);
  	ndctl_set_private_data(ctx, test);

test/libndctl.c +1 -1
-	err = nfit_test_init(&kmod_ctx, &mod, ctx, loglevel, test);
+	err = ndctl_test_init(&kmod_ctx, &mod, ctx, loglevel, test);

  if (err < 0) {
  ndctl_test_skip(test);
  fprintf(stderr, "nfit_test unavailable skipping tests\n");

test/multi-pmem.c +0 -0
index 3d10952..3ea08cc 100644
@@ -249,7 +249,7 @@ int test_multi_pmem(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx

  ndctl_set_log_priority(ctx, loglevel);

test/multi-pmem.c +1 -1
-	err = nfit_test_init(&kmod_ctx, &mod, NULL, loglevel, test);
+	err = ndctl_test_init(&kmod_ctx, &mod, NULL, loglevel, test);

  if (err < 0) {
  result = 77;
  ndctl_test_skip(test);

test/parent-uuid.c +0 -0
index 6424e9f..bded33a 100644
@@ -218,7 +218,7 @@ int test_parent_uuid(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ct
  		return 77;

  ndctl_set_log_priority(ctx, loglevel);

test/parent-uuid.c +1 -1
-	err = nfit_test_init(&kmod_ctx, &mod, NULL, loglevel, test);
+	err = ndctl_test_init(&kmod_ctx, &mod, NULL, loglevel, test);

  if (err < 0) {
  ndctl_test_skip(test);
  fprintf(stderr, "nfit_test unavailable skipping tests\n");

test/pmem_namespaces.c +0 -0
index f0f2edd..a4db1ae 100644
@@ -191,7 +191,7 @@ int test_pmem_namespaces(int log_level, struct ndctl_test *test,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

  if (!bus) {
  fprintf(stderr, "ACPI.NFIT unavailable falling back to nfit_test\n");

test/pmem_namespaces.c +1 -1
-		rc = nfit_test_init(&kmod_ctx, &mod, NULL, log_level, test);
+		rc = ndctl_test_init(&kmod_ctx, &mod, NULL, log_level, test);

  ndctl_invalidate(ctx);
  bus = ndctl_bus_get_by_provider(ctx, "nfit_test.0"); if (rc < 0 || !bus) {

_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]