Skip to contentSkip to conversation

ndctl: complete removal of daxctl io

PATCH In review Ross Zwisler 2 participants 6 messages Mar 22, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ndctl: complete removal of daxctl io

commit 0a8dd795b4cf ("ndctl: removing daxctl io")

didn't fully remove all daxctl io, leaving behind a few of the lines which were added by the original commit:

commit 67b54c1c76e5 ("ndctl: daxctl: Adding io option for daxctl")

Cc Dave Jiang <[email protected]>
Fixes commit 0a8dd795b4cf ("ndctl: removing daxctl io")
---
 daxctl/Makefile.am | 1 -
 daxctl/daxctl.c    | 6 ------
 ndctl.spec.in      | 7 -------
 3 files changed, 14 deletions(-)
daxctl/Makefile.am +0 -1
index e256afd..fe467d0 100644
@@ -9,7 +9,6 @@ daxctl_SOURCES =\
 
 daxctl_LDADD =\
 	lib/libdaxctl.la \
-	../ndctl/lib/libndctl.la \
 	../libutil.a \
 	$(UUID_LIBS) \
 	$(JSON_LIBS)
daxctl/daxctl.c +0 -6
index cedc847..91a4600 100644
@@ -67,17 +67,11 @@ static int cmd_help(int argc, const char **argv, void *ctx)
 }
 
 int cmd_list(int argc, const char **argv, void *ctx);
-#ifdef ENABLE_DAXIO
-int cmd_io(int argc, const char **argv, void *ctx);
-#endif
 
 static struct cmd_struct commands[] = {
 	{ "version", cmd_version },
 	{ "list", cmd_list },
 	{ "help", cmd_help },
-#ifdef ENABLE_DAXIO
-	{ "io", cmd_io },
-#endif
 };
 
 int main(int argc, const char **argv)
ndctl.spec.in +0 -7
index 3a5edc3..e2c879c 100644
@@ -20,9 +20,6 @@ BuildRequires:	pkgconfig(libudev)
 BuildRequires:	pkgconfig(uuid)
 BuildRequires:	pkgconfig(json-c)
 BuildRequires:	pkgconfig(bash-completion)
-%ifarch x86_64
-BuildRequires:	pkgconfig(libpmem)
-%endif
 
 %description
 Utility library for managing the "libnvdimm" subsystem.  The "libnvdimm"
@@ -93,11 +90,7 @@ control API for these devices.
 %build
 echo %{version} > version
 ./autogen.sh
-%ifarch x86_64
-%configure --disable-static --disable-silent-rules --with-libpmem
-%else
 %configure --disable-static --disable-silent-rules
-%endif
 make %{?_smp_mflags}
 
 %install
Signature · 6 lines
2.14.3

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
#1 lore raw

PATCH 2/2 ndctl: fail NUMA filtering when unavailable

Instead of just failing to find namespaces when trying to filter by NUMA node when CONFIG_NUMA wasn't enabled in the kernel, instead fail loudly as numactl does:

  # numactl --cpunodebind=0 ls
  numactl: This system does not support NUMA policy

---

This enabling requires numactl to create a pkg-config file, which it currently does not. This support is added by the following patch which I just sent out:

https://patchwork.kernel.org/patch/10302135/

---
 Makefile.am.in    |  3 ++-
 autogen.sh        |  3 ++-
 configure.ac      | 12 ++++++++++++
 ndctl.spec.in     |  3 ++-
 ndctl/Makefile.am |  3 ++-
 util/filter.c     | 11 +++++++++++
 6 files changed, 31 insertions(+), 4 deletions(-)
Makefile.am.in +2 -1
index 6c5229d..b927e17 100644
@@ -15,7 +15,8 @@ AM_CPPFLAGS = \
 	$(KMOD_CFLAGS) \
 	$(UDEV_CFLAGS) \
 	$(UUID_CFLAGS) \
-	$(JSON_CFLAGS)
+	$(JSON_CFLAGS) \
+	$(NUMA_CFLAGS)
 
 AM_CFLAGS = ${my_CFLAGS} \
 	-fvisibility=hidden \
autogen.sh +2 -1
index a23cf53..46515b2 100755
@@ -17,7 +17,8 @@ libdir() {
 
 args="--prefix=/usr \
 --sysconfdir=/etc \
---libdir=$(libdir /usr/lib)"
+--libdir=$(libdir /usr/lib) \
+--with-numa"
 
 echo
 echo "----------------------------------------------------------------"
configure.ac +12 -0
index 3eaac32..af21cb6 100644
@@ -94,6 +94,18 @@ PKG_CHECK_MODULES([UDEV], [libudev])
 PKG_CHECK_MODULES([UUID], [uuid])
 PKG_CHECK_MODULES([JSON], [json-c])
 
+AC_ARG_WITH([numa],
+	AS_HELP_STRING([--with-numa],
+		       [Install with NUMA support. @<:@default=no@:>@]),
+	[],
+	[with_numa=no])
+
+if test "x$with_numa" = "xyes"; then
+	PKG_CHECK_MODULES([NUMA], [numa])
+	AC_DEFINE([WITH_NUMA], [1], [with NUMA support])
+fi
+AM_CONDITIONAL([WITH_NUMA], [test "x$with_numa" = "xyes"])
+
 AC_ARG_WITH([bash-completion-dir],
 	AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
 		[Install the bash auto-completion script in this directory. @<:@default=yes@:>@]),
ndctl.spec.in +2 -1
index e2c879c..3fcb4d8 100644
@@ -20,6 +20,7 @@ BuildRequires:	pkgconfig(libudev)
 BuildRequires:	pkgconfig(uuid)
 BuildRequires:	pkgconfig(json-c)
 BuildRequires:	pkgconfig(bash-completion)
+BuildRequires:	pkgconfig(numa)
 
 %description
 Utility library for managing the "libnvdimm" subsystem.  The "libnvdimm"
@@ -90,7 +91,7 @@ control API for these devices.
 %build
 echo %{version} > version
 ./autogen.sh
-%configure --disable-static --disable-silent-rules
+%configure --disable-static --disable-silent-rules --with-numa
 make %{?_smp_mflags}
 
 %install
ndctl/Makefile.am +2 -1
index 213cabd..6b891f8 100644
@@ -29,7 +29,8 @@ ndctl_LDADD =\
 	../libutil.a \
 	$(UUID_LIBS) \
 	$(KMOD_LIBS) \
-	$(JSON_LIBS)
+	$(JSON_LIBS) \
+	$(NUMA_LIBS)
 
 if ENABLE_TEST
 ndctl_SOURCES += ../test/libndctl.c \
util/filter.c +11 -0
index 291d7ed..512f927 100644
@@ -10,6 +10,7 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
  */
+#include <numa.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -328,6 +329,16 @@ int util_filter_walk(struct ndctl_ctx *ctx, struct util_filter_ctx *fctx,
 	}
 
 	if (param->numa_node && strcmp(param->numa_node, "all") != 0) {
+#ifdef WITH_NUMA
+		if (numa_available() < 0) {
+			error("This system does not support NUMA");
+#else
+		{
+			error("ndctl was not configured with NUMA support");
+#endif
+			return -EINVAL;
+		}
+
 		numa_node = strtol(param->numa_node, &end, 0);
 		if (end == param->numa_node || end[0]) {
 			error("invalid numa_node: '%s'\n", param->numa_node);
Signature · 6 lines
2.14.3

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
#2 lore raw

Re: [ndctl PATCH 2/2] ndctl: fail NUMA filtering when unavailable

Quoted 7 lines · Ross Zwisler

Instead of just failing to find namespaces when trying to filter by NUMA node when CONFIG_NUMA wasn't enabled in the kernel, instead fail loudly as numactl does:

  # numactl --cpunodebind=0 ls
  numactl: This system does not support NUMA policy
Quoted 8 lines

---

This enabling requires numactl to create a pkg-config file, which it currently does not. This support is added by the following patch which I just sent out:

https://patchwork.kernel.org/patch/10302135/

Hmm, it's going to be a while for that to be picked up and filter out into all the distributions so we can either wait for the next numactl release to become commonly available, or rework this ndctl change to be independent of pkgconfig dependency.

The other concern is that this affects the numa-node filtering, but it doesn't effect the numa-node json field reported by 'ndctl list'. I think it would be confusing to see numa-nodes in the listing, but filtering fails just because of the way ndctl was configured at build time.

[..]

Quoted 16 lines
util/filter.c +1 -0
index 291d7ed..512f927 100644
@@ -10,6 +10,7 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
  */
+#include <numa.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -328,6 +329,16 @@ int util_filter_walk(struct ndctl_ctx *ctx, struct util_filter_ctx *fctx,
        }
 
        if (param->numa_node && strcmp(param->numa_node, "all") != 0) {

util/filter.c int util_filter_walk(struct ndctl_ctx *ctx, struct util_filter_ctx *fctx, · line 341

Quoted 10 lines
util/filter.c +10 -0
+#ifdef WITH_NUMA
+               if (numa_available() < 0) {
+                       error("This system does not support NUMA");
+#else
+               {
+                       error("ndctl was not configured with NUMA support");
+#endif
+                       return -EINVAL;
+               }
+

Please push this #ifdef'ery into a header file.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

#3 lore raw

Re: [ndctl PATCH 2/2] ndctl: fail NUMA filtering when unavailable

Quoted 16 lines · Dan Williams
Quoted 14 lines · Ross Zwisler

Instead of just failing to find namespaces when trying to filter by NUMA node when CONFIG_NUMA wasn't enabled in the kernel, instead fail loudly as numactl does:

  # numactl --cpunodebind=0 ls
  numactl: This system does not support NUMA policy

---

This enabling requires numactl to create a pkg-config file, which it currently does not. This support is added by the following patch which I just sent out:

Quoted 6 lines
Quoted 1 line

https://patchwork.kernel.org/patch/10302135/

Hmm, it's going to be a while for that to be picked up and filter out into all the distributions so we can either wait for the next numactl release to become commonly available, or rework this ndctl change to be independent of pkgconfig dependency.

Sure - I'm not yet sure how to do that. :) Any tips on how to check for library dependencies without pgk-config support?
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

#4 lore raw

Re: [ndctl PATCH 2/2] ndctl: fail NUMA filtering when unavailable

Quoted 19 lines · Ross Zwisler
Quoted 18 lines · Dan Williams
Quoted 15 lines · Ross Zwisler

Instead of just failing to find namespaces when trying to filter by NUMA node when CONFIG_NUMA wasn't enabled in the kernel, instead fail loudly as numactl does:

  # numactl --cpunodebind=0 ls
  numactl: This system does not support NUMA policy

---

This enabling requires numactl to create a pkg-config file, which it currently does not. This support is added by the following patch which I just sent out:

https://patchwork.kernel.org/patch/10302135/

Quoted 7 lines
Quoted 4 lines

Hmm, it's going to be a while for that to be picked up and filter out into all the distributions so we can either wait for the next numactl release to become commonly available, or rework this ndctl change to be independent of pkgconfig dependency.

Sure - I'm not yet sure how to do that. :) Any tips on how to check for library dependencies without pgk-config support?

The AC_CHECK_LIB() autoconf macro is the place to start.
_______________________________________________
Linux-nvdimm mailing list [email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

#5 lore raw
In reply to Ross Zwisler
Quoted 10 lines · Ross Zwisler

commit 0a8dd795b4cf ("ndctl: removing daxctl io")

didn't fully remove all daxctl io, leaving behind a few of the lines which were added by the original commit:

commit 67b54c1c76e5 ("ndctl: daxctl: Adding io option for daxctl")

Cc Dave Jiang <[email protected]>
Fixes commit 0a8dd795b4cf ("ndctl: removing daxctl io")

Yup, looks good, applied.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm