lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4BECC418.2080602@linux.intel.com>
Date:	Fri, 14 May 2010 11:31:36 +0800
From:	Haicheng Li <haicheng.li@...ux.intel.com>
To:	akpm@...ux-foundation.org, linux-mm@...ck.org,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
	Hidetoshi Seto <seto.hidetoshi@...fujitsu.com>,
	Greg Kroah-Hartman <gregkh@...e.de>,
	David Rientjes <rientjes@...gle.com>,
	Alex Chiang <achiang@...com>, linux-kernel@...r.kernel.org,
	ak@...ux.intel.co, fengguang.wu@...el.com,
	haicheng.li@...ux.intel.com, shaohui.zheng@...ux.intel.com
Subject: Re: [RFC, 3/7] NUMA hotplug emulator

Shaohui Zheng wrote:
> Userland interface to hotplug-add fake offlined nodes.
> 
> Add a sysfs entry "probe" under /sys/devices/system/node/:
> 
>  - to show all fake offlined nodes:
>     $ cat /sys/devices/system/node/probe
> 
>  - to hotadd a fake offlined node, e.g. nodeid is N:
>     $ echo N > /sys/devices/system/node/probe
> 
> Signed-off-by: Haicheng Li <haicheng.li@...ux.intel.com>
> Signed-off-by: Shaohui Zheng <shaohui.zheng@...el.com>
> ---
> diff --git a/drivers/base/node.c b/drivers/base/node.c
> index 057979a..a0be257 100644
> --- a/drivers/base/node.c
> +++ b/drivers/base/node.c
> @@ -535,6 +535,26 @@ void unregister_one_node(int nid)
>  	unregister_node(&node_devices[nid]);
>  }
>  
> +#ifdef CONFIG_NODE_HOTPLUG_EMU
> +static ssize_t store_nodes_probe(struct sysdev_class *class,
> +				  struct sysdev_class_attribute *attr,
> +				  const char *buf, size_t count)
> +{
> +	long nid;
> +	int ret;
> +
> +	strict_strtol(buf, 0, &nid);
> +	if (nid < 0 || nid > nr_node_ids - 1) {

Shaohui,

In fact, no need to do such check here, hotadd_hidden_nodes() can handle such invalid parameter by 
itself.

> +		printk(KERN_ERR "Invalid NUMA node id: %d (0 <= nid < %d).\n",
> +			nid, nr_node_ids);
> +		return -EPERM;

Per Andi's earlier review comments, -EPERM is odd, we'd fix it.

> +	}
> +	hotadd_hidden_nodes(nid);
> +
> +	return count;
> +}
> +#endif

Pls. replace it with following code:

+#ifdef CONFIG_NODE_HOTPLUG_EMU
+static ssize_t store_nodes_probe(struct sysdev_class *class,
+                                 struct sysdev_class_attribute *attr,
+                                 const char *buf, size_t count)
+{
+       long nid;
+       int ret;
+
+       ret = strict_strtol(buf, 0, &nid);
+       if (ret == -EINVAL)
+               return ret;
+
+       ret = hotadd_hidden_nodes(nid);
+       if (!ret)
+               return count;
+       else
+               return -EIO;
+}
+#endif


-haicheng
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ