All of lore.kernel.org
 help / color / mirror / Atom feed
* [ndctl PATCH 0/9] updates for vmalloc-based nfit_test and device-dax
@ 2016-06-26 23:24 Dan Williams
  2016-06-26 23:24 ` [ndctl PATCH 1/9] ndctl: deprecate pcommit Dan Williams
                   ` (10 more replies)
  0 siblings, 11 replies; 14+ messages in thread
From: Dan Williams @ 2016-06-26 23:24 UTC (permalink / raw)
  To: linux-nvdimm

The kernel is moving from CMA to vmalloc() backed resources to expand
the range of kernels that the tests can be compiled against.  As a
result some of the huge page tests need to move from nfit_test to
memmap=ss!nn defined memory ranges.

The new device-dax test exposed some bugs and missing capabilities in
the 'create-namespace' and 'list' commands.

---

Dan Williams (9):
      ndctl: deprecate pcommit
      test, libndctl: invalidate dax info blocks before reuse
      ndctl, list: list device-dax instances beneath a namespace
      ndctl, list: allow limiting namespace listing
      ndctl: add libs dependency to spec file
      ndctl, create-namespace: fix blk-namepsaces vs device-dax
      ndctl, create-namespace: fix device-dax vs --map=
      test, libndctl: move pfn + dax configurations to a destructive test
      test, libndctl: kill some dead code


 Documentation/ndctl-list.txt      |    6 +++
 ndctl.spec.in                     |    2 +
 ndctl/Makefile.am                 |    3 -
 ndctl/builtin-bat.c               |    5 --
 ndctl/builtin-list.c              |    6 +++
 ndctl/builtin-xaction-namespace.c |   12 ++++-
 ndctl/util/json.c                 |   40 ++++++++++++++++++
 test.h                            |    1 
 test/Makefile.am                  |    8 +---
 test/dax-dev.c                    |   22 +++++++---
 test/dax.sh                       |    5 +-
 test/device-dax.c                 |   32 ++++++++++++++
 test/device-dax.sh                |   30 ++++++++++++++
 test/libndctl.c                   |   82 ++++++++++++++++---------------------
 test/mmap.sh                      |    7 +++
 test/pcommit.c                    |   76 ----------------------------------
 util/filter.c                     |   21 +++++++++
 util/filter.h                     |    2 +
 18 files changed, 211 insertions(+), 149 deletions(-)
 create mode 100644 test/device-dax.c
 create mode 100755 test/device-dax.sh
 delete mode 100644 test/pcommit.c
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [ndctl PATCH 1/9] ndctl: deprecate pcommit
  2016-06-26 23:24 [ndctl PATCH 0/9] updates for vmalloc-based nfit_test and device-dax Dan Williams
@ 2016-06-26 23:24 ` Dan Williams
  2016-06-26 23:24 ` [ndctl PATCH 2/9] test, libndctl: invalidate dax info blocks before reuse Dan Williams
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Dan Williams @ 2016-06-26 23:24 UTC (permalink / raw)
  To: linux-nvdimm

Now that the kernel no longer has pcommit support, remove the ndctl
test.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 ndctl/Makefile.am   |    3 +-
 ndctl/builtin-bat.c |    5 ---
 test.h              |    1 -
 test/Makefile.am    |    5 ---
 test/pcommit.c      |   76 ---------------------------------------------------
 5 files changed, 1 insertion(+), 89 deletions(-)
 delete mode 100644 test/pcommit.c

diff --git a/ndctl/Makefile.am b/ndctl/Makefile.am
index 56cd9292ef59..27e5182e28b5 100644
--- a/ndctl/Makefile.am
+++ b/ndctl/Makefile.am
@@ -52,8 +52,7 @@ endif
 
 if ENABLE_DESTRUCTIVE
 ndctl_SOURCES += ../test/blk_namespaces.c \
-		 ../test/pmem_namespaces.c \
-		 ../test/pcommit.c
+		 ../test/pmem_namespaces.c
 ndctl_SOURCES += builtin-bat.c
 endif
 
diff --git a/ndctl/builtin-bat.c b/ndctl/builtin-bat.c
index ca6fd121f3a7..a83eb0fec063 100644
--- a/ndctl/builtin-bat.c
+++ b/ndctl/builtin-bat.c
@@ -39,11 +39,6 @@ int cmd_bat(int argc, const char **argv)
 		return EXIT_FAILURE;
 	}
 
-	rc = test_pcommit(test);
-	fprintf(stderr, "test_pcommit: %s\n", rc ? "FAIL" : "PASS");
-	if (rc && rc != 77)
-		return rc;
-
 	rc = test_blk_namespaces(loglevel, test);
 	fprintf(stderr, "test_blk_namespaces: %s\n", rc ? "FAIL" : "PASS");
 	if (rc && rc != 77)
diff --git a/test.h b/test.h
index 61ca05f489fa..5425be1bc107 100644
--- a/test.h
+++ b/test.h
@@ -18,5 +18,4 @@ int test_dpa_alloc(int loglevel, struct ndctl_test *test);
 int test_libndctl(int loglevel, struct ndctl_test *test);
 int test_blk_namespaces(int loglevel, struct ndctl_test *test);
 int test_pmem_namespaces(int loglevel, struct ndctl_test *test);
-int test_pcommit(struct ndctl_test *test);
 #endif /* __TEST_H__ */
diff --git a/test/Makefile.am b/test/Makefile.am
index ad10caa439bf..ed9981583331 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -18,7 +18,6 @@ if ENABLE_DESTRUCTIVE
 TESTS +=\
 	blk-ns \
 	pmem-ns \
-	pcommit \
 	dax-dev \
 	dax.sh \
 	mmap.sh
@@ -26,7 +25,6 @@ TESTS +=\
 check_PROGRAMS +=\
 	blk-ns \
 	pmem-ns \
-	pcommit \
 	dax-dev \
 	dax-pmd \
 	mmap
@@ -39,9 +37,6 @@ LIBNDCTL_LIB =\
 libndctl_SOURCES = libndctl.c core.c
 libndctl_LDADD = $(LIBNDCTL_LIB) $(UUID_LIBS) $(KMOD_LIBS)
 
-pcommit_SOURCES = pcommit.c core.c
-pcommit_LDADD = $(LIBNDCTL_LIB) $(KMOD_LIBS)
-
 blk_ns_SOURCES = blk_namespaces.c core.c
 blk_ns_LDADD = $(LIBNDCTL_LIB) $(KMOD_LIBS)
 
diff --git a/test/pcommit.c b/test/pcommit.c
deleted file mode 100644
index ea5e82f3773d..000000000000
--- a/test/pcommit.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * test-pcommit: Make sure PCOMMIT is supported by the platform.
- *
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 2.1, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
- * more details.
- */
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <test.h>
-#include <stdlib.h>
-#include <linux/version.h>
-
-#define err(msg)\
-	fprintf(stderr, "%s:%d: %s (%s)\n", __func__, __LINE__, msg, strerror(errno))
-
-int test_pcommit(struct ndctl_test *test)
-{
-	const char *pcommit = "pcommit";
-	const char *flags = "flags";
-	const int buffer_size = 1024;
-
-	char buffer[buffer_size];
-	FILE *cpuinfo;
-	char *token;
-
-	if (!ndctl_test_attempt(test, KERNEL_VERSION(4, 0, 0)))
-		return 77;
-
-	cpuinfo = fopen("/proc/cpuinfo", "r");
-	if (!cpuinfo) {
-		err("open");
-		return -ENXIO;
-	}
-
-        while (fgets(buffer, buffer_size, cpuinfo)) {
-		token = strtok(buffer, " :");
-
-		if (token &&
-		    strncmp(token, flags, strlen(flags)) != 0)
-			continue;
-
-		while (token != NULL) {
-			token = strtok(NULL, " ");
-			if (token &&
-			    strncmp(token, pcommit, strlen(pcommit)) == 0) {
-				fclose(cpuinfo);
-				return 0;
-			}
-		}
-        }
-
-	fclose(cpuinfo);
-	ndctl_test_skip(test);
-	return 77;
-}
-
-int __attribute__((weak)) main(int argc, char *argv[])
-{
-	struct ndctl_test *test = ndctl_test_new(0);
-
-	if (!test) {
-		fprintf(stderr, "failed to initialize test\n");
-		return EXIT_FAILURE;
-	}
-
-	return test_pcommit(test);
-}

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [ndctl PATCH 2/9] test, libndctl: invalidate dax info blocks before reuse
  2016-06-26 23:24 [ndctl PATCH 0/9] updates for vmalloc-based nfit_test and device-dax Dan Williams
  2016-06-26 23:24 ` [ndctl PATCH 1/9] ndctl: deprecate pcommit Dan Williams
@ 2016-06-26 23:24 ` Dan Williams
  2016-06-26 23:24 ` [ndctl PATCH 3/9] ndctl, list: list device-dax instances beneath a namespace Dan Williams
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Dan Williams @ 2016-06-26 23:24 UTC (permalink / raw)
  To: linux-nvdimm

A recent kernel fix addressed cases where a live setting change
mismatches with the current contents of the info block.  Rather than
silently overwrite the new settings with the info block contents the
kernel now invalidates the info block if the uuid changes, but otherwise
warns if a setting is mismatched.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 test/libndctl.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/test/libndctl.c b/test/libndctl.c
index 147f69d0c27a..8346108aacec 100644
--- a/test/libndctl.c
+++ b/test/libndctl.c
@@ -787,6 +787,12 @@ static int check_dax_create(struct ndctl_region *region,
 	for (i = 0; i < ARRAY_SIZE(dax_s->locs); i++) {
 		fprintf(stderr, "%s: %ld\n", __func__, ARRAY_SIZE(dax_s->aligns));
 		for (j = 0; j < ARRAY_SIZE(dax_s->aligns); j++) {
+			/*
+			 * The kernel enforces invalidating the previous
+			 * info block when the current uuid is does not
+			 * validate with the contents of the info block.
+			 */
+			dax_s->uuid[0]++;
 			rc = __check_dax_create(region, ndns, namespace,
 					dax_s->locs[i], dax_s->aligns[j],
 					dax_s->uuid);
@@ -923,6 +929,12 @@ static int check_pfn_create(struct ndctl_region *region,
 
 	for (i = 0; i < ARRAY_SIZE(pfn_s->locs); i++) {
 		for (j = 0; j < ARRAY_SIZE(pfn_s->aligns); j++) {
+			/*
+			 * The kernel enforces invalidating the previous
+			 * info block when the current uuid is does not
+			 * validate with the contents of the info block.
+			 */
+			pfn_s->uuid[0]++;
 			rc = __check_pfn_create(region, ndns, namespace, buf,
 					pfn_s->locs[i], pfn_s->aligns[j],
 					pfn_s->uuid);

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [ndctl PATCH 3/9] ndctl, list: list device-dax instances beneath a namespace
  2016-06-26 23:24 [ndctl PATCH 0/9] updates for vmalloc-based nfit_test and device-dax Dan Williams
  2016-06-26 23:24 ` [ndctl PATCH 1/9] ndctl: deprecate pcommit Dan Williams
  2016-06-26 23:24 ` [ndctl PATCH 2/9] test, libndctl: invalidate dax info blocks before reuse Dan Williams
@ 2016-06-26 23:24 ` Dan Williams
  2016-06-26 23:24 ` [ndctl PATCH 4/9] ndctl, list: allow limiting namespace listing Dan Williams
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Dan Williams @ 2016-06-26 23:24 UTC (permalink / raw)
  To: linux-nvdimm

For example:

    {
      "dev":"namespace0.0",
      "mode":"dax",
      "size":8453619712,
      "uuid":"277919a1-ba36-4f41-89b5-c9eebb9b7e33",
      "daxdevs":[
        {
          "chardev":"dax0.0",
          "size":8589934592
        }
      ]
    }

Note that "daxdevs" is an array because there may be more than one
per-namespace in the future.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 ndctl/util/json.c |   40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/ndctl/util/json.c b/ndctl/util/json.c
index d144039bb559..dedfb45ed100 100644
--- a/ndctl/util/json.c
+++ b/ndctl/util/json.c
@@ -3,6 +3,7 @@
 #include <uuid/uuid.h>
 #include <json-c/json.h>
 #include <ndctl/libndctl.h>
+#include <daxctl/libdaxctl.h>
 #include <ccan/array_size/array_size.h>
 
 #ifdef HAVE_NDCTL_H
@@ -99,6 +100,39 @@ bool util_namespace_active(struct ndctl_namespace *ndns)
 	return false;
 }
 
+static json_object *util_daxctl_region_to_json(struct daxctl_region *region)
+{
+	struct json_object *jdaxdevs = json_object_new_array();
+	struct json_object *jobj;
+	struct daxctl_dev *dev;
+
+	if (!jdaxdevs)
+		return NULL;
+
+	daxctl_dev_foreach(region, dev) {
+		const char *devname = daxctl_dev_get_devname(dev);
+		struct json_object *jdev = json_object_new_object();
+
+		if (!devname || !jdev)
+			continue;
+		jobj = json_object_new_string(devname);
+		if (jobj)
+			json_object_object_add(jdev, "chardev", jobj);
+
+		jobj = json_object_new_int64(daxctl_dev_get_size(dev));
+		if (jobj)
+			json_object_object_add(jdev, "size", jobj);
+
+		json_object_array_add(jdaxdevs, jdev);
+	}
+
+	if (json_object_array_length(jdaxdevs) < 1) {
+		json_object_put(jdaxdevs);
+		return NULL;
+	}
+	return jdaxdevs;
+}
+
 struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns)
 {
 	struct json_object *jndns = json_object_new_object();
@@ -178,12 +212,18 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns)
 		json_object_object_add(jndns, "uuid", jobj);
 		bdev = ndctl_pfn_get_block_device(pfn);
 	} else if (dax) {
+		struct daxctl_region *dax_region;
+
 		ndctl_dax_get_uuid(dax, uuid);
 		uuid_unparse(uuid, buf);
 		jobj = json_object_new_string(buf);
 		if (!jobj)
 			goto err;
 		json_object_object_add(jndns, "uuid", jobj);
+		dax_region = ndctl_dax_get_daxctl_region(dax);
+		jobj = util_daxctl_region_to_json(dax_region);
+		if (jobj)
+			json_object_object_add(jndns, "daxdevs", jobj);
 	} else if (ndctl_namespace_get_type(ndns) != ND_DEVICE_NAMESPACE_IO) {
 		const char *name;
 

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [ndctl PATCH 4/9] ndctl, list: allow limiting namespace listing
  2016-06-26 23:24 [ndctl PATCH 0/9] updates for vmalloc-based nfit_test and device-dax Dan Williams
                   ` (2 preceding siblings ...)
  2016-06-26 23:24 ` [ndctl PATCH 3/9] ndctl, list: list device-dax instances beneath a namespace Dan Williams
@ 2016-06-26 23:24 ` Dan Williams
  2016-06-27 19:28   ` Vishal Verma
  2016-06-26 23:24 ` [ndctl PATCH 5/9] ndctl: add libs dependency to spec file Dan Williams
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 14+ messages in thread
From: Dan Williams @ 2016-06-26 23:24 UTC (permalink / raw)
  To: linux-nvdimm

In addition to filtering by bus, dimm, and/or region, introduce
-n/--namespace to limit the listing to the given namespace.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 Documentation/ndctl-list.txt |    6 ++++++
 ndctl/builtin-list.c         |    6 ++++++
 util/filter.c                |   21 +++++++++++++++++++++
 util/filter.h                |    2 ++
 4 files changed, 35 insertions(+)

diff --git a/Documentation/ndctl-list.txt b/Documentation/ndctl-list.txt
index 792eb8e9cadb..2e362e818bbc 100644
--- a/Documentation/ndctl-list.txt
+++ b/Documentation/ndctl-list.txt
@@ -68,6 +68,12 @@ include::xable-region-options.txt[]
 [verse]
 # ndctl list --dimm=nmem0 --namespaces
 
+-n::
+--namespace=::
+	An 'namespaceX.Y' device name, or namespace region plus id tuple
+	'X.Y'. Limit the namespace list to the single identified device
+	if present.
+
 -t::
 --type=::
 	Filter listing by region type ('pmem' or 'blk')
diff --git a/ndctl/builtin-list.c b/ndctl/builtin-list.c
index 5c5dc5a5db5b..f7447ea1310f 100644
--- a/ndctl/builtin-list.c
+++ b/ndctl/builtin-list.c
@@ -30,6 +30,7 @@ static struct {
 	const char *region;
 	const char *type;
 	const char *dimm;
+	const char *namespace;
 } param;
 
 static int did_fail;
@@ -55,6 +56,9 @@ static struct json_object *list_namespaces(struct ndctl_region *region,
 		if (!list.namespaces)
 			break;
 
+		if (!util_namespace_filter(ndns, param.namespace))
+			continue;
+
 		if (!list.idle && !util_namespace_active(ndns))
 			continue;
 
@@ -192,6 +196,8 @@ int cmd_list(int argc, const char **argv)
 				"filter by region"),
 		OPT_STRING('d', "dimm", &param.dimm, "dimm-id",
 				"filter by dimm"),
+		OPT_STRING('n', "namespace", &param.namespace, "namespace-id",
+				"filter by namespace"),
 		OPT_STRING('t', "type", &param.type, "region-type",
 				"filter by region-type"),
 		OPT_BOOLEAN('B', "buses", &list.buses, "include bus info"),
diff --git a/util/filter.c b/util/filter.c
index ea0f4dd2da13..97f0dec3569c 100644
--- a/util/filter.c
+++ b/util/filter.c
@@ -1,3 +1,4 @@
+#include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <limits.h>
@@ -55,6 +56,26 @@ struct ndctl_region *util_region_filter(struct ndctl_region *region,
 	return NULL;
 }
 
+struct ndctl_namespace *util_namespace_filter(struct ndctl_namespace *ndns,
+		const char *ident)
+{
+	struct ndctl_region *region = ndctl_namespace_get_region(ndns);
+	unsigned long region_id, ndns_id;
+
+	if (!ident || strcmp(ident, "all") == 0)
+		return ndns;
+
+	if (strcmp(ident, ndctl_namespace_get_devname(ndns)) == 0)
+		return ndns;
+
+	if (sscanf(ident, "%ld.%ld", &region_id, &ndns_id) == 2
+			&& ndctl_region_get_id(region) == region_id
+			&& ndctl_namespace_get_id(ndns) == ndns_id)
+		return ndns;
+
+	return NULL;
+}
+
 struct ndctl_dimm *util_dimm_filter(struct ndctl_dimm *dimm, const char *ident)
 {
 	char *end = NULL;
diff --git a/util/filter.h b/util/filter.h
index 17ce895425fb..52be4c32d5bf 100644
--- a/util/filter.h
+++ b/util/filter.h
@@ -3,6 +3,8 @@
 struct ndctl_bus *util_bus_filter(struct ndctl_bus *bus, const char *ident);
 struct ndctl_region *util_region_filter(struct ndctl_region *region,
 		const char *ident);
+struct ndctl_namespace *util_namespace_filter(struct ndctl_namespace *ndns,
+		const char *ident);
 struct ndctl_dimm *util_dimm_filter(struct ndctl_dimm *dimm, const char *ident);
 struct ndctl_bus *util_bus_filter_by_dimm(struct ndctl_bus *bus,
 		const char *ident);

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [ndctl PATCH 5/9] ndctl: add libs dependency to spec file
  2016-06-26 23:24 [ndctl PATCH 0/9] updates for vmalloc-based nfit_test and device-dax Dan Williams
                   ` (3 preceding siblings ...)
  2016-06-26 23:24 ` [ndctl PATCH 4/9] ndctl, list: allow limiting namespace listing Dan Williams
@ 2016-06-26 23:24 ` Dan Williams
  2016-06-26 23:24 ` [ndctl PATCH 6/9] ndctl, create-namespace: fix blk-namepsaces vs device-dax Dan Williams
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Dan Williams @ 2016-06-26 23:24 UTC (permalink / raw)
  To: linux-nvdimm

Otherwise ndctl may use an old version of ndctl-libs.  The expectation
is that installing an updated ndctl also includes all the capabilities
of an updated libndctl.

Reported-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 ndctl.spec.in |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/ndctl.spec.in b/ndctl.spec.in
index 0aaef03b2e5b..f152bbe44621 100644
--- a/ndctl.spec.in
+++ b/ndctl.spec.in
@@ -7,6 +7,8 @@ Group:		System Environment/Base
 Url:		https://github.com/pmem/ndctl
 Source0:	https://github.com/pmem/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
 
+Requires:	LNAME%{?_isa} = %{version}-%{release}
+Requires:	DAX_LNAME%{?_isa} = %{version}-%{release}
 BuildRequires:	autoconf
 BuildRequires:	asciidoc
 BuildRequires:	xmlto

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [ndctl PATCH 6/9] ndctl, create-namespace: fix blk-namepsaces vs device-dax
  2016-06-26 23:24 [ndctl PATCH 0/9] updates for vmalloc-based nfit_test and device-dax Dan Williams
                   ` (4 preceding siblings ...)
  2016-06-26 23:24 ` [ndctl PATCH 5/9] ndctl: add libs dependency to spec file Dan Williams
@ 2016-06-26 23:24 ` Dan Williams
  2016-06-26 23:25 ` [ndctl PATCH 7/9] ndctl, create-namespace: fix device-dax vs --map= Dan Williams
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Dan Williams @ 2016-06-26 23:24 UTC (permalink / raw)
  To: linux-nvdimm

Emit a usable error message when on attempts to place a blk-namespace
into device-dax mode.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 ndctl/builtin-xaction-namespace.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/ndctl/builtin-xaction-namespace.c b/ndctl/builtin-xaction-namespace.c
index 8ce7c3e55216..7bf3320473ff 100644
--- a/ndctl/builtin-xaction-namespace.c
+++ b/ndctl/builtin-xaction-namespace.c
@@ -403,9 +403,12 @@ static int validate_namespace_options(struct ndctl_region *region,
 
 		if (ndns && ndctl_namespace_get_type(ndns)
 				== ND_DEVICE_NAMESPACE_BLK
-				&& p->mode == NDCTL_NS_MODE_MEMORY) {
-			debug("%s: blk namespace do not support memory mode\n",
-					ndctl_namespace_get_devname(ndns));
+				&& (p->mode == NDCTL_NS_MODE_MEMORY
+					|| p->mode == NDCTL_NS_MODE_DAX)) {
+			debug("%s: blk namespace do not support %s mode\n",
+					ndctl_namespace_get_devname(ndns),
+					p->mode == NDCTL_NS_MODE_MEMORY
+					? "memory" : "dax");
 				return -EINVAL;
 		}
 	} else if (ndns)

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [ndctl PATCH 7/9] ndctl, create-namespace: fix device-dax vs --map=
  2016-06-26 23:24 [ndctl PATCH 0/9] updates for vmalloc-based nfit_test and device-dax Dan Williams
                   ` (5 preceding siblings ...)
  2016-06-26 23:24 ` [ndctl PATCH 6/9] ndctl, create-namespace: fix blk-namepsaces vs device-dax Dan Williams
@ 2016-06-26 23:25 ` Dan Williams
  2016-06-26 23:25 ` [ndctl PATCH 8/9] test, libndctl: move pfn + dax configurations to a destructive test Dan Williams
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Dan Williams @ 2016-06-26 23:25 UTC (permalink / raw)
  To: linux-nvdimm

Teach validate_namespace_options() about the valid device-dax scenario
of specifying a map location.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 ndctl/builtin-xaction-namespace.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ndctl/builtin-xaction-namespace.c b/ndctl/builtin-xaction-namespace.c
index 7bf3320473ff..24a8d08c58f2 100644
--- a/ndctl/builtin-xaction-namespace.c
+++ b/ndctl/builtin-xaction-namespace.c
@@ -442,7 +442,8 @@ static int validate_namespace_options(struct ndctl_region *region,
 		else
 			p->loc = NDCTL_PFN_LOC_PMEM;
 
-		if (ndns && p->mode != NDCTL_NS_MODE_MEMORY) {
+		if (ndns && p->mode != NDCTL_NS_MODE_MEMORY
+			&& p->mode != NDCTL_NS_MODE_DAX) {
 			debug("%s: --map= only valid for memory mode namespace\n",
 				ndctl_namespace_get_devname(ndns));
 			return -EINVAL;

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [ndctl PATCH 8/9] test, libndctl: move pfn + dax configurations to a destructive test
  2016-06-26 23:24 [ndctl PATCH 0/9] updates for vmalloc-based nfit_test and device-dax Dan Williams
                   ` (6 preceding siblings ...)
  2016-06-26 23:25 ` [ndctl PATCH 7/9] ndctl, create-namespace: fix device-dax vs --map= Dan Williams
@ 2016-06-26 23:25 ` Dan Williams
  2016-06-26 23:25 ` [ndctl PATCH 9/9] test, libndctl: kill some dead code Dan Williams
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Dan Williams @ 2016-06-26 23:25 UTC (permalink / raw)
  To: linux-nvdimm

The kernel is converting nfit_test resources to vmalloc() instead of
DMA_CMA.  DMA_CMA collides with other common options enabled in
distribution kernels which makes nfit_test unusable without intrusive
kernel configuration changes.  The vmalloc conversion precludes higher
than PAGE_SIZE alignment configurations for pfn + dax devices.  Instead,
move these tests to run against an memmap=ss!nn range.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 test/Makefile.am   |    3 ++
 test/dax-dev.c     |   22 +++++++++----
 test/dax.sh        |    5 ++-
 test/device-dax.c  |   32 ++++++++++++++++++
 test/device-dax.sh |   30 +++++++++++++++++
 test/libndctl.c    |   91 +++++++++++++++++++++-------------------------------
 test/mmap.sh       |    7 +++-
 7 files changed, 125 insertions(+), 65 deletions(-)
 create mode 100644 test/device-dax.c
 create mode 100755 test/device-dax.sh

diff --git a/test/Makefile.am b/test/Makefile.am
index ed9981583331..ab566148e1f4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -20,6 +20,7 @@ TESTS +=\
 	pmem-ns \
 	dax-dev \
 	dax.sh \
+	device-dax.sh \
 	mmap.sh
 
 check_PROGRAMS +=\
@@ -27,6 +28,7 @@ check_PROGRAMS +=\
 	pmem-ns \
 	dax-dev \
 	dax-pmd \
+	device-dax \
 	mmap
 endif
 
@@ -55,3 +57,4 @@ dax_dev_LDADD = $(LIBNDCTL_LIB)
 dax_pmd_SOURCES = dax-pmd.c
 mmap_SOURCES = mmap.c
 dax_errors_SOURCES = dax-errors.c
+device_dax_SOURCES = device-dax.c
diff --git a/test/dax-dev.c b/test/dax-dev.c
index 3209eb148ed9..519df324fdc8 100755
--- a/test/dax-dev.c
+++ b/test/dax-dev.c
@@ -32,6 +32,7 @@ static int emit_e820_device(int loglevel, struct ndctl_test *test)
 	const char *bdev;
 	struct ndctl_ctx *ctx;
 	struct ndctl_bus *bus;
+	struct ndctl_dax *dax;
 	struct ndctl_pfn *pfn;
 	struct ndctl_region *region;
 	struct ndctl_namespace *ndns;
@@ -62,11 +63,14 @@ static int emit_e820_device(int loglevel, struct ndctl_test *test)
 	if (mode >= 0 && mode != NDCTL_NS_MODE_MEMORY)
 		goto out;
 
+	/* if device-dax mode already established it might contain user data */
 	pfn = ndctl_namespace_get_pfn(ndns);
-	if (pfn)
-		bdev = ndctl_pfn_get_block_device(pfn);
-	else
-		bdev = ndctl_namespace_get_block_device(ndns);
+	dax = ndctl_namespace_get_dax(ndns);
+	if (dax || pfn)
+		goto out;
+
+	/* device is unconfigured, assume that was on purpose */
+	bdev = ndctl_namespace_get_block_device(ndns);
 	if (!bdev)
 		goto out;
 
@@ -75,18 +79,22 @@ static int emit_e820_device(int loglevel, struct ndctl_test *test)
 
 	/*
 	 * Note, if the bdev goes active after this check we'll still
-	 * clobber it in the following tests, see test/dax.sh.
+	 * clobber it in the following tests, see test/dax.sh and
+	 * test/device-dax.sh.
 	 */
 	fd = open(path, O_RDWR | O_EXCL);
 	if (fd < 0)
 		goto out;
 	err = 0;
-	fprintf(stdout, "%s\n", path);
 
  out:
-	if (err)
+	if (err) {
 		fprintf(stderr, "%s: failed to find usable victim device\n",
 				__func__);
+		ndctl_test_skip(test);
+		err = 77;
+	} else
+		fprintf(stdout, "%s\n", ndctl_namespace_get_devname(ndns));
 	ndctl_unref(ctx);
 	return err;
 }
diff --git a/test/dax.sh b/test/dax.sh
index 8db436a869b5..ae63f89b8e6b 100755
--- a/test/dax.sh
+++ b/test/dax.sh
@@ -21,8 +21,9 @@ set -e
 mkdir -p $MNT
 trap 'err $LINENO' ERR
 
-blockdev=$(basename $(./dax-dev))
-dev=$(basename $(readlink -f /sys/block/$(basename $blockdev)/device))
+dev=$(./dax-dev)
+json=$($NDCTL list -N -n $dev)
+eval $(echo $json | sed -e "$json2var")
 
 mkfs.ext4 /dev/$blockdev
 mount /dev/$blockdev $MNT -o dax
diff --git a/test/device-dax.c b/test/device-dax.c
new file mode 100644
index 000000000000..addf93f59252
--- /dev/null
+++ b/test/device-dax.c
@@ -0,0 +1,32 @@
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <linux/falloc.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+
+int main(int argc, char *argv[])
+{
+	char *buf;
+	int fd;
+
+	if (argc < 2) {
+		perror("argc invalid");
+		return -EINVAL;
+	}
+
+	fd = open(argv[1], O_RDWR);
+	if (fd < 0) {
+		perror("fd");
+		return 1;
+	}
+
+	buf = mmap(NULL, 2UL << 20, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+	*((int *) (buf + (1UL << 20))) = 0;
+
+	close(fd);
+	return 0;
+}
diff --git a/test/device-dax.sh b/test/device-dax.sh
new file mode 100755
index 000000000000..f24a350b2806
--- /dev/null
+++ b/test/device-dax.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+NDCTL="../ndctl/ndctl"
+json2var="s/[{}\",]//g; s/:/=/g; s/\]//g"
+
+err() {
+	rc=$?
+	echo "device-dax: failed at line $1"
+	exit $rc
+}
+
+set -e -x
+trap 'err $LINENO' ERR
+
+dev=$(./dax-dev)
+json=$($NDCTL list -N -n $dev)
+eval $(echo $json | sed -e "$json2var")
+
+# setup a device-dax configuration
+json=$($NDCTL create-namespace -v -m dax -M dev -f -e $dev)
+eval $(echo $json | sed -e "$json2var")
+[ $mode != "dax" ] && echo "fail: $LINENO" &&  exit 1
+
+./device-dax /dev/$chardev
+
+# revert namespace to raw mode
+json=$($NDCTL create-namespace -v -m raw -f -e $dev)
+eval $(echo $json | sed -e "$json2var")
+[ $mode != "memory" ] && echo "fail: $LINENO" &&  exit 1
+
+exit 0
diff --git a/test/libndctl.c b/test/libndctl.c
index 8346108aacec..947849d7176b 100644
--- a/test/libndctl.c
+++ b/test/libndctl.c
@@ -223,8 +223,6 @@ static struct pfn pfn_settings = {
 		   8, 9,  10, 11, 12, 13, 14, 15
 	},
 	.locs = { NDCTL_PFN_LOC_RAM, NDCTL_PFN_LOC_PMEM },
-	/* order matters, successful aligns at the end */
-	.aligns = { 1, SZ_1G, SZ_4K, SZ_2M, },
 };
 
 static struct dax dax_settings = {
@@ -233,8 +231,6 @@ static struct dax dax_settings = {
 		   8, 9,  10, 11, 12, 13, 14, 15
 	},
 	.locs = { NDCTL_PFN_LOC_RAM, NDCTL_PFN_LOC_PMEM },
-	/* order matters, successful aligns at the end */
-	.aligns = { 1, SZ_1G, SZ_4K, SZ_2M, },
 };
 
 struct namespace {
@@ -698,7 +694,7 @@ static int validate_dax(struct ndctl_dax *dax)
 
 static int __check_dax_create(struct ndctl_region *region,
 		struct ndctl_namespace *ndns, struct namespace *namespace,
-		enum ndctl_pfn_loc loc, unsigned long align, uuid_t uuid)
+		enum ndctl_pfn_loc loc, uuid_t uuid)
 {
 	struct ndctl_dax *dax_seed = ndctl_region_get_dax_seed(region);
 	enum ndctl_namespace_mode mode;
@@ -711,20 +707,18 @@ static int __check_dax_create(struct ndctl_region *region,
 		return -ENXIO;
 
 	devname = ndctl_dax_get_devname(dax);
-	fprintf(stderr, "%s: %s align: %ld\n", __func__, devname, align);
 	ndctl_dax_set_uuid(dax, uuid);
 	ndctl_dax_set_location(dax, loc);
-	ndctl_dax_set_align(dax, align);
+	/*
+	 * nfit_test uses vmalloc()'d resources so the only feasible
+	 * alignment is PAGE_SIZE
+	 */
+	ndctl_dax_set_align(dax, SZ_4K);
 	ndctl_dax_set_namespace(dax, ndns);
 	rc = ndctl_dax_enable(dax);
-	if (align == SZ_1G) {
-		if (rc == 0) {
-			fprintf(stderr, "%s: expected dax enable failure with align: %lx\n",
-					devname, align);
-			return -ENXIO;
-		}
-		ndctl_dax_delete(dax);
-		return 0;
+	if (rc) {
+		fprintf(stderr, "%s: failed to enable dax\n", devname);
+		return rc;
 	}
 
 	mode = ndctl_namespace_get_mode(ndns);
@@ -777,28 +771,22 @@ static int check_dax_create(struct ndctl_region *region,
 		struct ndctl_namespace *ndns, struct namespace *namespace)
 {
 	struct dax *dax_s = namespace->dax_settings;
-	unsigned int i, j;
 	void *buf = NULL;
+	unsigned int i;
 	int rc = 0;
 
 	if (!dax_s)
 		return 0;
 
 	for (i = 0; i < ARRAY_SIZE(dax_s->locs); i++) {
-		fprintf(stderr, "%s: %ld\n", __func__, ARRAY_SIZE(dax_s->aligns));
-		for (j = 0; j < ARRAY_SIZE(dax_s->aligns); j++) {
-			/*
-			 * The kernel enforces invalidating the previous
-			 * info block when the current uuid is does not
-			 * validate with the contents of the info block.
-			 */
-			dax_s->uuid[0]++;
-			rc = __check_dax_create(region, ndns, namespace,
-					dax_s->locs[i], dax_s->aligns[j],
-					dax_s->uuid);
-			if (rc)
-				break;
-		}
+		/*
+		 * The kernel enforces invalidating the previous info
+		 * block when the current uuid is does not validate with
+		 * the contents of the info block.
+		 */
+		dax_s->uuid[0]++;
+		rc = __check_dax_create(region, ndns, namespace,
+				dax_s->locs[i], dax_s->uuid);
 		if (rc)
 			break;
 	}
@@ -808,8 +796,7 @@ static int check_dax_create(struct ndctl_region *region,
 
 static int __check_pfn_create(struct ndctl_region *region,
 		struct ndctl_namespace *ndns, struct namespace *namespace,
-		void *buf, enum ndctl_pfn_loc loc, unsigned long align,
-		uuid_t uuid)
+		void *buf, enum ndctl_pfn_loc loc, uuid_t uuid)
 {
 	struct ndctl_pfn *pfn_seed = ndctl_region_get_pfn_seed(region);
 	enum ndctl_namespace_mode mode;
@@ -826,17 +813,16 @@ static int __check_pfn_create(struct ndctl_region *region,
 	devname = ndctl_pfn_get_devname(pfn);
 	ndctl_pfn_set_uuid(pfn, uuid);
 	ndctl_pfn_set_location(pfn, loc);
-	ndctl_pfn_set_align(pfn, align);
+	/*
+	 * nfit_test uses vmalloc()'d resources so the only feasible
+	 * alignment is PAGE_SIZE
+	 */
+	ndctl_pfn_set_align(pfn, SZ_4K);
 	ndctl_pfn_set_namespace(pfn, ndns);
 	rc = ndctl_pfn_enable(pfn);
-	if (align == SZ_1G) {
-		if (rc == 0) {
-			fprintf(stderr, "%s: expected pfn enable failure with align: %lx\n",
-					devname, align);
-			return -ENXIO;
-		}
-		ndctl_pfn_delete(pfn);
-		return 0;
+	if (rc) {
+		fprintf(stderr, "%s: failed to enable pfn\n", devname);
+		return rc;
 	}
 
 	mode = ndctl_namespace_get_mode(ndns);
@@ -917,8 +903,8 @@ static int check_pfn_create(struct ndctl_region *region,
 		struct ndctl_namespace *ndns, struct namespace *namespace)
 {
 	struct pfn *pfn_s = namespace->pfn_settings;
-	unsigned int i, j;
 	void *buf = NULL;
+	unsigned int i;
 	int rc = 0;
 
 	if (!pfn_s)
@@ -928,19 +914,14 @@ static int check_pfn_create(struct ndctl_region *region,
 		return -ENXIO;
 
 	for (i = 0; i < ARRAY_SIZE(pfn_s->locs); i++) {
-		for (j = 0; j < ARRAY_SIZE(pfn_s->aligns); j++) {
-			/*
-			 * The kernel enforces invalidating the previous
-			 * info block when the current uuid is does not
-			 * validate with the contents of the info block.
-			 */
-			pfn_s->uuid[0]++;
-			rc = __check_pfn_create(region, ndns, namespace, buf,
-					pfn_s->locs[i], pfn_s->aligns[j],
-					pfn_s->uuid);
-			if (rc)
-				break;
-		}
+		/*
+		 * The kernel enforces invalidating the previous info
+		 * block when the current uuid is does not validate with
+		 * the contents of the info block.
+		 */
+		pfn_s->uuid[0]++;
+		rc = __check_pfn_create(region, ndns, namespace, buf,
+				pfn_s->locs[i], pfn_s->uuid);
 		if (rc)
 			break;
 	}
diff --git a/test/mmap.sh b/test/mmap.sh
index e66fb1369434..fa2658a6c57c 100755
--- a/test/mmap.sh
+++ b/test/mmap.sh
@@ -3,6 +3,8 @@ MNT=test_mmap_mnt
 FILE=image
 DEV=""
 TEST=./mmap
+NDCTL="../ndctl/ndctl"
+json2var="s/[{}\",]//g; s/:/=/g"
 
 err() {
 	rc=1
@@ -46,7 +48,10 @@ set -e
 mkdir -p $MNT
 trap 'err $LINENO' ERR
 
-DEV=$(./dax-dev)
+dev=$(./dax-dev)
+json=$($NDCTL list -N -n $dev)
+eval $(echo $json | sed -e "$json2var")
+DEV="/dev/${blockdev}"
 
 mkfs.ext4 $DEV
 mount $DEV $MNT -o dax

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [ndctl PATCH 9/9] test, libndctl: kill some dead code
  2016-06-26 23:24 [ndctl PATCH 0/9] updates for vmalloc-based nfit_test and device-dax Dan Williams
                   ` (7 preceding siblings ...)
  2016-06-26 23:25 ` [ndctl PATCH 8/9] test, libndctl: move pfn + dax configurations to a destructive test Dan Williams
@ 2016-06-26 23:25 ` Dan Williams
  2016-06-27 11:37 ` [ndctl PATCH 0/9] updates for vmalloc-based nfit_test and device-dax Yigal Korman
  2016-06-27 23:04 ` Vishal Verma
  10 siblings, 0 replies; 14+ messages in thread
From: Dan Williams @ 2016-06-26 23:25 UTC (permalink / raw)
  To: linux-nvdimm

check_namespaces() used to do some i/o testing, but that's long since
been replaced.  Clean up some straggling statements.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 test/libndctl.c |    3 ---
 1 file changed, 3 deletions(-)

diff --git a/test/libndctl.c b/test/libndctl.c
index 947849d7176b..b03fc27a5f0b 100644
--- a/test/libndctl.c
+++ b/test/libndctl.c
@@ -1460,7 +1460,6 @@ static int check_namespaces(struct ndctl_region *region,
 	ndns_save = NULL;
 	for (i = 0; (namespace = namespaces[i]); i++) {
 		struct ndctl_namespace *ndns;
-		int fd = -1;
 		uuid_t uu;
 
 		snprintf(devname, sizeof(devname), "namespace%d.%d",
@@ -1651,8 +1650,6 @@ static int check_namespaces(struct ndctl_region *region,
 				break;
 			}
 		}
-		if (fd >= 0)
-			close(fd);
 		namespace->do_configure = 0;
 
 		__ndns_save = realloc(ndns_save,

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [ndctl PATCH 0/9] updates for vmalloc-based nfit_test and device-dax
  2016-06-26 23:24 [ndctl PATCH 0/9] updates for vmalloc-based nfit_test and device-dax Dan Williams
                   ` (8 preceding siblings ...)
  2016-06-26 23:25 ` [ndctl PATCH 9/9] test, libndctl: kill some dead code Dan Williams
@ 2016-06-27 11:37 ` Yigal Korman
  2016-06-27 23:04 ` Vishal Verma
  10 siblings, 0 replies; 14+ messages in thread
From: Yigal Korman @ 2016-06-27 11:37 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-nvdimm

On Mon, Jun 27, 2016 at 2:24 AM, Dan Williams <dan.j.williams@intel.com> wrote:
> The kernel is moving from CMA to vmalloc() backed resources to expand
> the range of kernels that the tests can be compiled against.  As a
> result some of the huge page tests need to move from nfit_test to
> memmap=ss!nn defined memory ranges.

Don't forget to update README.md, it describes how to use CMA for the testing...

>
> The new device-dax test exposed some bugs and missing capabilities in
> the 'create-namespace' and 'list' commands.
>
> ---
>
> Dan Williams (9):
>       ndctl: deprecate pcommit
>       test, libndctl: invalidate dax info blocks before reuse
>       ndctl, list: list device-dax instances beneath a namespace
>       ndctl, list: allow limiting namespace listing
>       ndctl: add libs dependency to spec file
>       ndctl, create-namespace: fix blk-namepsaces vs device-dax
>       ndctl, create-namespace: fix device-dax vs --map=
>       test, libndctl: move pfn + dax configurations to a destructive test
>       test, libndctl: kill some dead code
>
>
>  Documentation/ndctl-list.txt      |    6 +++
>  ndctl.spec.in                     |    2 +
>  ndctl/Makefile.am                 |    3 -
>  ndctl/builtin-bat.c               |    5 --
>  ndctl/builtin-list.c              |    6 +++
>  ndctl/builtin-xaction-namespace.c |   12 ++++-
>  ndctl/util/json.c                 |   40 ++++++++++++++++++
>  test.h                            |    1
>  test/Makefile.am                  |    8 +---
>  test/dax-dev.c                    |   22 +++++++---
>  test/dax.sh                       |    5 +-
>  test/device-dax.c                 |   32 ++++++++++++++
>  test/device-dax.sh                |   30 ++++++++++++++
>  test/libndctl.c                   |   82 ++++++++++++++++---------------------
>  test/mmap.sh                      |    7 +++
>  test/pcommit.c                    |   76 ----------------------------------
>  util/filter.c                     |   21 +++++++++
>  util/filter.h                     |    2 +
>  18 files changed, 211 insertions(+), 149 deletions(-)
>  create mode 100644 test/device-dax.c
>  create mode 100755 test/device-dax.sh
>  delete mode 100644 test/pcommit.c
> _______________________________________________
> Linux-nvdimm mailing list
> Linux-nvdimm@lists.01.org
> https://lists.01.org/mailman/listinfo/linux-nvdimm
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [ndctl PATCH 4/9] ndctl, list: allow limiting namespace listing
  2016-06-26 23:24 ` [ndctl PATCH 4/9] ndctl, list: allow limiting namespace listing Dan Williams
@ 2016-06-27 19:28   ` Vishal Verma
  2016-06-27 19:38     ` Dan Williams
  0 siblings, 1 reply; 14+ messages in thread
From: Vishal Verma @ 2016-06-27 19:28 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-nvdimm

On 06/26, Dan Williams wrote:
> In addition to filtering by bus, dimm, and/or region, introduce
> -n/--namespace to limit the listing to the given namespace.
> 
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  Documentation/ndctl-list.txt |    6 ++++++
>  ndctl/builtin-list.c         |    6 ++++++
>  util/filter.c                |   21 +++++++++++++++++++++
>  util/filter.h                |    2 ++
>  4 files changed, 35 insertions(+)
> 
This needs a bash completion update as follows (feel free to squash in
or keep separatley..):

>From b6d09ff03b7ed16efdc4169aec0442d5c32053bd Mon Sep 17 00:00:00 2001
From: Vishal Verma <vishal.l.verma@intel.com>
Date: Mon, 27 Jun 2016 13:22:58 -0600
Subject: [PATCH] ndctl: bash completion updates for the --namespace= filter

Add completion for the new --namespace= filter.
This will list idle namespaces for completion. It could possibly be made
smarter by checking if a '--idle' or '-i' has been specified on the
command line so far, but maybe that's a bit confusing for the user?

For now, enable the simpler path of listing everything for completion.

Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 contrib/ndctl | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/contrib/ndctl b/contrib/ndctl
index 5a7455f..b7a82fc 100755
--- a/contrib/ndctl
+++ b/contrib/ndctl
@@ -91,7 +91,7 @@ __ndctlcomp()
 
 	COMPREPLY=( $( compgen -W "$1" -- "$2" ) )
 	for cword in "${COMPREPLY[@]}"; do
-		if [[ "$cword" == @(--bus|--region|--type|--mode|--size|--dimm|--reconfig|--uuid|--name|--sector-size|--map) ]]; then
+		if [[ "$cword" == @(--bus|--region|--type|--mode|--size|--dimm|--reconfig|--uuid|--name|--sector-size|--map|--namespace) ]]; then
 			COMPREPLY[$i]="${cword}="
 		else
 			COMPREPLY[$i]="${cword} "
@@ -146,6 +146,9 @@ __ndctl_comp_options()
 		--dimm)
 			opts=$(__ndctl_get_dimms)
 			;;
+		--namespace)
+			opts=$(__ndctl_get_ns -i)
+			;;
 		--reconfig)
 			# It is ok to reconfig disabled namespaces
 			opts=$(__ndctl_get_ns -i)
-- 
2.5.5

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [ndctl PATCH 4/9] ndctl, list: allow limiting namespace listing
  2016-06-27 19:28   ` Vishal Verma
@ 2016-06-27 19:38     ` Dan Williams
  0 siblings, 0 replies; 14+ messages in thread
From: Dan Williams @ 2016-06-27 19:38 UTC (permalink / raw)
  To: Vishal Verma; +Cc: linux-nvdimm

On Mon, Jun 27, 2016 at 12:28 PM, Vishal Verma <vishal.l.verma@intel.com> wrote:
> On 06/26, Dan Williams wrote:
>> In addition to filtering by bus, dimm, and/or region, introduce
>> -n/--namespace to limit the listing to the given namespace.
>>
>> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
>> ---
>>  Documentation/ndctl-list.txt |    6 ++++++
>>  ndctl/builtin-list.c         |    6 ++++++
>>  util/filter.c                |   21 +++++++++++++++++++++
>>  util/filter.h                |    2 ++
>>  4 files changed, 35 insertions(+)
>>
> This needs a bash completion update as follows (feel free to squash in
> or keep separatley..):
>
> From b6d09ff03b7ed16efdc4169aec0442d5c32053bd Mon Sep 17 00:00:00 2001
> From: Vishal Verma <vishal.l.verma@intel.com>
> Date: Mon, 27 Jun 2016 13:22:58 -0600
> Subject: [PATCH] ndctl: bash completion updates for the --namespace= filter
>
> Add completion for the new --namespace= filter.
> This will list idle namespaces for completion. It could possibly be made
> smarter by checking if a '--idle' or '-i' has been specified on the
> command line so far, but maybe that's a bit confusing for the user?
>
> For now, enable the simpler path of listing everything for completion.
>
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>

Thanks! Applied as a standalone patch.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [ndctl PATCH 0/9] updates for vmalloc-based nfit_test and device-dax
  2016-06-26 23:24 [ndctl PATCH 0/9] updates for vmalloc-based nfit_test and device-dax Dan Williams
                   ` (9 preceding siblings ...)
  2016-06-27 11:37 ` [ndctl PATCH 0/9] updates for vmalloc-based nfit_test and device-dax Yigal Korman
@ 2016-06-27 23:04 ` Vishal Verma
  10 siblings, 0 replies; 14+ messages in thread
From: Vishal Verma @ 2016-06-27 23:04 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-nvdimm

On 06/26, Dan Williams wrote:
> The kernel is moving from CMA to vmalloc() backed resources to expand
> the range of kernels that the tests can be compiled against.  As a
> result some of the huge page tests need to move from nfit_test to
> memmap=ss!nn defined memory ranges.
> 
> The new device-dax test exposed some bugs and missing capabilities in
> the 'create-namespace' and 'list' commands.
> 
> ---
> 
> Dan Williams (9):
>       ndctl: deprecate pcommit
>       test, libndctl: invalidate dax info blocks before reuse
>       ndctl, list: list device-dax instances beneath a namespace
>       ndctl, list: allow limiting namespace listing
>       ndctl: add libs dependency to spec file
>       ndctl, create-namespace: fix blk-namepsaces vs device-dax
>       ndctl, create-namespace: fix device-dax vs --map=
>       test, libndctl: move pfn + dax configurations to a destructive test
>       test, libndctl: kill some dead code
> 
> 
>  Documentation/ndctl-list.txt      |    6 +++
>  ndctl.spec.in                     |    2 +
>  ndctl/Makefile.am                 |    3 -
>  ndctl/builtin-bat.c               |    5 --
>  ndctl/builtin-list.c              |    6 +++
>  ndctl/builtin-xaction-namespace.c |   12 ++++-
>  ndctl/util/json.c                 |   40 ++++++++++++++++++
>  test.h                            |    1 
>  test/Makefile.am                  |    8 +---
>  test/dax-dev.c                    |   22 +++++++---
>  test/dax.sh                       |    5 +-
>  test/device-dax.c                 |   32 ++++++++++++++
>  test/device-dax.sh                |   30 ++++++++++++++
>  test/libndctl.c                   |   82 ++++++++++++++++---------------------
>  test/mmap.sh                      |    7 +++
>  test/pcommit.c                    |   76 ----------------------------------
>  util/filter.c                     |   21 +++++++++
>  util/filter.h                     |    2 +
>  18 files changed, 211 insertions(+), 149 deletions(-)
>  create mode 100644 test/device-dax.c
>  create mode 100755 test/device-dax.sh
>  delete mode 100644 test/pcommit.c

Looks good!

Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

end of thread, other threads:[~2016-06-27 23:05 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-26 23:24 [ndctl PATCH 0/9] updates for vmalloc-based nfit_test and device-dax Dan Williams
2016-06-26 23:24 ` [ndctl PATCH 1/9] ndctl: deprecate pcommit Dan Williams
2016-06-26 23:24 ` [ndctl PATCH 2/9] test, libndctl: invalidate dax info blocks before reuse Dan Williams
2016-06-26 23:24 ` [ndctl PATCH 3/9] ndctl, list: list device-dax instances beneath a namespace Dan Williams
2016-06-26 23:24 ` [ndctl PATCH 4/9] ndctl, list: allow limiting namespace listing Dan Williams
2016-06-27 19:28   ` Vishal Verma
2016-06-27 19:38     ` Dan Williams
2016-06-26 23:24 ` [ndctl PATCH 5/9] ndctl: add libs dependency to spec file Dan Williams
2016-06-26 23:24 ` [ndctl PATCH 6/9] ndctl, create-namespace: fix blk-namepsaces vs device-dax Dan Williams
2016-06-26 23:25 ` [ndctl PATCH 7/9] ndctl, create-namespace: fix device-dax vs --map= Dan Williams
2016-06-26 23:25 ` [ndctl PATCH 8/9] test, libndctl: move pfn + dax configurations to a destructive test Dan Williams
2016-06-26 23:25 ` [ndctl PATCH 9/9] test, libndctl: kill some dead code Dan Williams
2016-06-27 11:37 ` [ndctl PATCH 0/9] updates for vmalloc-based nfit_test and device-dax Yigal Korman
2016-06-27 23:04 ` Vishal Verma

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.