From: Shaohui Zheng on
On Fri, May 14, 2010 at 12:11:36PM +0800, Wu Fengguang wrote:
> > 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
>
> How about this?
>
> err = strict_strtol(buf, 0, &nid);
> if (err < 0)
> return err;
>
> err = hotadd_hidden_nodes(nid);
> if (err < 0)
> return err;
>
> return count;
>
> Thanks,
> Fengguang

Both seems good.

Haicheng's code is prefered, since it was already reviewed.

--
Thanks & Regards,
Shaohui

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Haicheng Li on
Wu Fengguang wrote:
>> 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
>
> How about this?
>
> err = strict_strtol(buf, 0, &nid);
> if (err < 0)
> return err;

other negative value would be odd here.

> err = hotadd_hidden_nodes(nid);
> if (err < 0)
> return err;

hotadd_hidden_nodes could return -EEXIST, which is also odd here, right?

> return count;
>
> Thanks,
> Fengguang

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Paul Mundt on
On Fri, May 14, 2010 at 11:16:15AM +0900, KAMEZAWA Hiroyuki wrote:
> On Thu, 13 May 2010 19:45:44 +0800
> Shaohui Zheng <shaohui.zheng(a)intel.com> wrote:
>
> > x86: infrastructure of NUMA hotplug emulation
> >
>
> Hmm. do we have to create this for x86 only ?
> Can't we live with lmb ? as
>
> lmb_hide_node() or some.
>
> IIUC, x86-version lmb is now under development.
>
Indeed. There is very little x86-specific about this patch series at all
except for the e820 bits and tying in the CPU topology. Most of what this
series is doing wrapping around e820 could be done on top of LMB, which
would also make it possible to use on non-x86 architectures.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Paul Mundt on
On Thu, May 13, 2010 at 08:14:57PM +0800, Shaohui Zheng wrote:
> hotplug emulator: support cpu probe/release in x86
>
> Add cpu interface probe/release under sysfs for x86. User can use this
> interface to emulate the cpu hot-add process, it is for cpu hotplug
> test purpose. Add a kernel option CONFIG_ARCH_CPU_PROBE_RELEASE for this
> feature.
>
> This interface provides a mechanism to emulate cpu hotplug with software
> methods, it becomes possible to do cpu hotplug automation and stress
> testing.
>
At a quick glance, is this really necessary? It seems like you could
easily replace most of this with a CPU notifier chain that takes care of
the node handling. See for example how ppc64 manages the CPU hotplug/numa
emulation case in arch/powerpc/mm/numa.c. arch_register_cpu() just looks
like some topology hack for ACPI, it would be nice not to perpetuate that
too much.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Wu Fengguang on
On Fri, May 14, 2010 at 01:32:02PM +0800, Haicheng Li wrote:
> Wu Fengguang wrote:
> >> 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
> >
> > How about this?
> >
> > err = strict_strtol(buf, 0, &nid);
> > if (err < 0)
> > return err;
>
> other negative value would be odd here.

Yes, strict_strtoul() will be better.

> > err = hotadd_hidden_nodes(nid);
> > if (err < 0)
> > return err;
>
> hotadd_hidden_nodes could return -EEXIST, which is also odd here, right?

Why not? write(2) says "Other errors may occur, depending on the
object connected to fd."

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