nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "Williams, Dan J" <dan.j.williams@intel.com>,
	"ross.zwisler@linux.intel.com" <ross.zwisler@linux.intel.com>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: [ndctl PATCH] ndctl: fail NUMA filtering when unsupported
Date: Fri, 9 Mar 2018 23:47:22 +0000	[thread overview]
Message-ID: <1520639241.6316.59.camel@intel.com> (raw)
In-Reply-To: <20180309233416.13243-1-ross.zwisler@linux.intel.com>


On Fri, 2018-03-09 at 16:34 -0700, Ross Zwisler wrote:
> For systems that don't support NUMA, numactl gives a loud and fatal
> error:
> 
>   # numactl -N 0 ls
>   numactl: This system does not support NUMA policy
> 
> Follow this model in ndctl for NUMA based filtering:
> 
>   # ./ndctl/ndctl list --numa-node=0
>     Error: This system does not support NUMA
> 
> This is done instead of just quietly filtering out all dimms, regions
> and
> namespaces because the NUMA node they were trying to match didn't
> exist in
> the system.
> 
> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> Suggested-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  util/filter.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/util/filter.c b/util/filter.c
> index 291d7ed..fdc46a3 100644
> --- a/util/filter.c
> +++ b/util/filter.c
> @@ -14,7 +14,10 @@
>  #include <string.h>
>  #include <stdlib.h>
>  #include <limits.h>
> +#include <unistd.h>
> +#include <sys/stat.h>
>  #include <util/util.h>
> +#include <sys/types.h>
>  #include <ndctl/ndctl.h>
>  #include <util/filter.h>
>  #include <ndctl/libndctl.h>
> @@ -328,6 +331,13 @@ int util_filter_walk(struct ndctl_ctx *ctx,
> struct util_filter_ctx *fctx,
>  	}
>  
>  	if (param->numa_node && strcmp(param->numa_node, "all") !=
> 0) {
> +		struct stat st;
> +
> +		if (stat("/sys/devices/system/node", &st)) {
> +			error("This system does not support
> NUMA\n");
> +			return -EINVAL;
> +		}

Is it ok to just directly read sysfs here? Alternatively we could use
the get_mempolicy syscall (like libnuma does) but that requires linking
with -lnuma..

https://github.com/numactl/numactl/blob/master/libnuma.c#L800

> +
>  		numa_node = strtol(param->numa_node, &end, 0);
>  		if (end == param->numa_node || end[0]) {
>  			error("invalid numa_node: '%s'\n", param-
> >numa_node);
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2018-03-09 23:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-09 23:34 [ndctl PATCH] ndctl: fail NUMA filtering when unsupported Ross Zwisler
2018-03-09 23:47 ` Verma, Vishal L [this message]
2018-03-10  0:20   ` Dan Williams
2018-03-23 23:08 Ross Zwisler
2018-03-23 23:31 ` Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1520639241.6316.59.camel@intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    --cc=ross.zwisler@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).