All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Johan Hovold <johan@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Rob Herring <robh@kernel.org>,
	linux-kernel@vger.kernel.org,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Jens Frederich <jfrederich@gmail.com>,
	Daniel Drake <dsd@laptop.org>,
	Jon Nettleton <jon.nettleton@gmail.com>
Subject: Re: [PATCH] x86/apic: Fix CPU devicetree-node lookups
Date: Wed, 9 Dec 2020 14:38:24 +0100	[thread overview]
Message-ID: <X9DTUIkBSfsfSQMR@localhost> (raw)
In-Reply-To: <87o8j32029.fsf@nanos.tec.linutronix.de>

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

      reply	other threads:[~2020-12-09 13:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 13:42 [PATCH] x86/apic: Fix CPU devicetree-node lookups Johan Hovold
2020-12-08 10:05 ` Johan Hovold
2020-12-09  2:19   ` Thomas Gleixner
2020-12-09 13:38     ` Johan Hovold [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=X9DTUIkBSfsfSQMR@localhost \
    --to=johan@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=bp@alien8.de \
    --cc=dsd@laptop.org \
    --cc=hpa@zytor.com \
    --cc=jfrederich@gmail.com \
    --cc=jon.nettleton@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=robh@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.