Re: [PATCH v2 2/9] x86: numa: check the node id consistently for x86

From: Peter Zijlstra
Date: Mon Sep 02 2019 - 15:15:53 EST


On Mon, Sep 02, 2019 at 08:22:52PM +0200, Ingo Molnar wrote:
>
> * Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> > diff --git a/drivers/base/core.c b/drivers/base/core.c
> > index f0dd8e38fee3..2caf204966a0 100644
> > --- a/drivers/base/core.c
> > +++ b/drivers/base/core.c
> > @@ -2120,8 +2120,16 @@ int device_add(struct device *dev)
> > dev->kobj.parent = kobj;
> >
> > /* use parent numa_node */
> > - if (parent && (dev_to_node(dev) == NUMA_NO_NODE))
> > - set_dev_node(dev, dev_to_node(parent));
> > + if (dev_to_node(dev) == NUMA_NO_NODE) {
> > + if (parent)
> > + set_dev_node(dev, dev_to_node(parent));
> > +#ifdef CONFIG_NUMA
> > + else {
> > + pr_err("device: '%s': has no assigned NUMA node\n", dev_name(dev));
> > + set_dev_node(dev, 0);
> > + }
> > +#endif
>
> BTW., is firmware required to always provide a NUMA node on NUMA systems?
>
> I.e. do we really want this warning on non-NUMA systems that don't assign
> NUMA nodes?

Good point; we might have to exclude nr_node_ids==1 systems from
warning.

> Also, even on NUMA systems, is firmware required to provide a NUMA node -
> i.e. is it in principle invalid to offer no NUMA binding?

I think so; a device needs to be _somewhere_, right? Typically though;
devices are on a PCI bus, and the PCI bridge itself will have a NUMA
binding and then the above parent rule will make everything just work.

But I don't see how you can be outside of the NUMA topology.