Re: [PATCH] x86/platform/uv: Use alternate source for socket to node data

From: Steve Wahl
Date: Tue Sep 05 2023 - 12:42:49 EST


On Fri, Sep 01, 2023 at 02:01:52PM -0500, Steve Wahl wrote:
> On Fri, Sep 01, 2023 at 10:18:20AM -0700, Dave Hansen wrote:
> > On 8/7/23 07:17, Steve Wahl wrote:
> > > When nr_cpus is set to a smaller number than actually present, the
> > > cpu_to_node() mapping information for unused CPUs is not available to
> > > build_socket_tables(). This results in an incomplete table and will
> > > later cause use of a -1 value for some array indexing, and eventual
> > > kernel page faults.
> > >
> > > Switch to using the __apicid_to_node array, which still contains all
> > > the information mapping apicids to nodes, even for CPUs disabled with
> > > a reduced nr_cpus setting.
> >
> > Before, the lookup went:
> >
> > CPU => APICID => SOCKET
> >
> > But when the CPU wasn't present, there wasn't a way to start this lookup.
> >
> > So, instead of looping over all CPUs, looking up their APICIDs and
> > mapping those to sockets, just take CPUs out of the equation entirely.
> >
> > Loop over all APICIDs which are mapped to a valid NUMA node. Then just
> > extract the socket-id from the APICID.
> >
> > Right?
> >
> > That seems sane enough. It's also way less code than the previous approach.
>
> Yes. That's it precisely. And, yes, way less code.

Are you willling to give a "Reviewed-by:"?

--> Steve

--
Steve Wahl, Hewlett Packard Enterprise