[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <X9DTUIkBSfsfSQMR@localhost>
Date: Wed, 9 Dec 2020 14:38:24 +0100
From: Johan Hovold <johan@...nel.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Johan Hovold <johan@...nel.org>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, Rob Herring <robh@...nel.org>,
linux-kernel@...r.kernel.org,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Jens Frederich <jfrederich@...il.com>,
Daniel Drake <dsd@...top.org>,
Jon Nettleton <jon.nettleton@...il.com>
Subject: Re: [PATCH] x86/apic: Fix CPU devicetree-node lookups
On Wed, Dec 09, 2020 at 03:19:26AM +0100, Thomas Gleixner wrote:
> On Tue, Dec 08 2020 at 11:05, Johan Hovold wrote:
>
> > On Tue, Nov 24, 2020 at 02:42:47PM +0100, Johan Hovold wrote:
> >> Fix CPU devicetree-node lookups by implementing
> >> arch_match_cpu_phys_id().
> >>
> >> This allows using of_get_cpu_node() and of_cpu_device_node_get() to look
> >> up CPU devicetree nodes and specifically makes sure that CPU struct
> >> devices are linked to the correct devicetree nodes.
> >>
> >> Note that CPUs are described in devicetree using their APIC ids and
> >> that those do not generally coincide with the logical ids (e.g. used by
> >> the default arch_match_cpu_phys_id() implementation).
>
> Can you please explain why this is relevant for any of the existing few
> x86 DT users?
Let me try to break it down.
> The above is incoherent word salad TBH:
>
> 1) Fix .....
>
> without any information what is broken
CPU device-tree node lookups are broken as the subject and introductory
paragraph indicates.
> 2) This allows ...
>
> It allows. Cool. Is it mandatory, desired or whatever?
It is mandatory in that any arch with devicetree support which does not
have an identity mapping between physical and logical CPU ids need to
override the default implementation of arch_match_cpu_phys_id().
Failing to do so breaks the lookups done using the above mentioned
helpers and also results in in the CPU struct devices pointing to the
wrong devicetree node (e.g. exported through sysfs).
> 3) Note ...
>
> That might be an actual problem decsription, but I can't say for
> sure.
Yeah, that is why this is needed on x86 and also explains why this isn't
an issue on a UP system where the physical and logical id of CPU0
coincides.
I agree that this is unnecessarily terse.
> I still have no idea what this 'Fix' is fixing if it is fixing anything
> at all. Is is a fix which needs to be backported or is it a 'fix' which
> fixes something which got changed elsewhere and forgotten.
The only in-tree devicetree source for x86 is for a UP system where CPU0
has APIC id 0 and the initial code didn't even fetch the APIC id from
devicetree (even if the CPU was described in DT).
Support for SMP was later added by added by commit 4e07db9c8db8
("x86/devicetree: Use CPU description from Device Tree") and since then
we need to provide an arch_match_cpu_phys_id() implementation.
I'll resend with a better explanation.
Johan
Powered by blists - more mailing lists