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

Salil Mehta salil.mehta at huawei.com
Tue Sep 3 22:15:24 AEST 2019


> From: Linuxarm [mailto:linuxarm-bounces at huawei.com] On Behalf Of Peter Zijlstra
> Sent: Tuesday, September 3, 2019 8:11 AM
> 
> On Tue, Sep 03, 2019 at 02:19:04PM +0800, Yunsheng Lin wrote:
> > On 2019/9/2 20:56, Peter Zijlstra wrote:
> > > On Mon, Sep 02, 2019 at 08:25:24PM +0800, Yunsheng Lin wrote:
> > >> On 2019/9/2 15:25, Peter Zijlstra wrote:
> > >>> On Mon, Sep 02, 2019 at 01:46:51PM +0800, Yunsheng Lin wrote:
> > >>>> On 2019/9/1 0:12, Peter Zijlstra wrote:
> > >>>
> > >>>>> 1) because even it is not set, the device really does belong to a node.
> > >>>>> It is impossible a device will have magic uniform access to memory when
> > >>>>> CPUs cannot.
> > >>>>
> > >>>> So it means dev_to_node() will return either NUMA_NO_NODE or a
> > >>>> valid node id?
> > >>>
> > >>> NUMA_NO_NODE := -1, which is not a valid node number. It is also, like> I
> > >>> said, not a valid device location on a NUMA system.
> > >>>
> > >>> Just because ACPI/BIOS is shit, doesn't mean the device doesn't have a
> > >>> node association. It just means we don't know and might have to guess.
> > >>
> > >> How do we guess the device's location when ACPI/BIOS does not set it?
> > >
> > > See device_add(), it looks to the device's parent and on NO_NODE, puts
> > > it there.
> > >
> > > Lacking any hints, just stick it to node0 and print a FW_BUG or
> > > something.
> > >
> > >> It seems dev_to_node() does not do anything about that and leave the
> > >> job to the caller or whatever function that get called with its return
> > >> value, such as cpumask_of_node().
> > >
> > > Well, dev_to_node() doesn't do anything; nor should it. It are the
> > > callers of set_dev_node() that should be taking care.
> > >
> > > Also note how device_add() sets the device node to the parent device's
> > > node on NUMA_NO_NODE. Arguably we should change it to complain when it
> > > finds NUMA_NO_NODE and !parent.
> >
> > Is it possible that the node id set by device_add() become invalid
> > if the node is offlined, then dev_to_node() may return a invalid
> > node id.
> 
> In that case I would expect the device to go away too. Once the memory
> controller goes away, the PCI bus connected to it cannot continue to
> function.

I am not sure if this is *exactly* true on our system as NUMA nodes are
part of the SoCs and devices could still be used even if all the memory
and CPUs part of the node are turned off. Although, it is highly unlikely
anybody would do that(maybe could be debated for the Power Management case?) 

Best Regards
Salil



More information about the Linuxppc-dev mailing list