mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: K Prateek Nayak <kprateek.nayak@amd.com>
To: "Nikola Z. Ivanov" <zlatistiv@gmail.com>, <tglx@kernel.org>,
	<mingo@redhat.com>, <bp@alien8.de>, <dave.hansen@linux.intel.com>,
	<hpa@zytor.com>, <puwen@hygon.cn>, <peterz@infradead.org>,
	<mario.limonciello@amd.com>, <yazen.ghannam@amd.com>,
	<andrew.cooper3@citrix.com>, <kai.huang@intel.com>, <i@rong.moe>,
	<pawan.kumar.gupta@linux.intel.com>, <xin@zytor.com>,
	<darwi@linutronix.de>, <sohil.mehta@intel.com>,
	<suchitkarunakaran@gmail.com>, <sshegde@linux.ibm.com>,
	<yury.norov@gmail.com>, <ricardo.neri-calderon@linux.intel.com>
Cc: <linux-kernel@vger.kernel.org>, <x86@kernel.org>
Subject: Re: [RFC PATCH] x86/topo: Unify srat_detect_node among amd/intel/hygon
Date: Mon, 30 Mar 2026 10:27:58 +0530	[thread overview]
Message-ID: <4dde81e8-98cc-4666-a4e7-b5083210fbd0@amd.com> (raw)
In-Reply-To: <20260329120841.2118684-1-zlatistiv@gmail.com>

Hello Nikola,

On 3/29/2026 5:38 PM, Nikola Z. Ivanov wrote:
> This change is provoked by an observed warning after
> commit 717b64d58cff ("x86/topo: Replace x86_has_numa_in_package")
> when faking numa nodes on intel.
> 
> For example:
> 
> qemu-system-x86_64 \
>         -kernel arch/x86/boot/bzImage \
>         -append "console=ttyS0 root=/dev/sda debug numa=fake=2" \
>         -hda $IMAGES/unstable.img \
>         -cpu qemu64,vendor=GenuineIntel \
>         -nographic \
>         -m 2G \
>         -smp 2 \

You can also say:

    -smp 2,sockets=2

and that fixes the warning but that is not a valid solution? Why?

> 
> Will trigger:
> 
> [    0.066755][    T0] ------------[ cut here ]------------
> [    0.066755][    T0] WARNING: arch/x86/kernel/smpboot.c:698 at
> set_cpu_sibling_map+0xe41/0x1f90, CPU#1: swapper/1/0
> [    0.066755][    T0] Call Trace:
> [    0.066755][    T0]  <TASK>
> [    0.066755][    T0]  ap_starting+0x9e/0x140
> [    0.066755][    T0]  ? __pfx_ap_starting+0x10/0x10
> [    0.066755][    T0]  ? fpu__init_cpu_xstate+0x5c/0x320
> [    0.066755][    T0]  start_secondary+0x66/0x110
> [    0.066755][    T0]  common_startup_64+0x13e/0x147
> [    0.066755][    T0]  </TASK>
> 
> smpboot.c suggests that the topology is invalid as
> the CPUs are in the same package but different nodes.

To me, that looks like a broken topology from a virtualization use case
and the user can easily go fix their QEMU cmdlline if they care. I'm
pretty sure folks using NUMA emulation in production know what they are
doing.

> 
> Fix this by unifying the srat_detect_node function
> among amd/intel/hygon and taking the amd/hygon approach
> of falling back to LLC when SRAT is not detected.

As far as the AMD, Hygon unification goes, I don't mind that but
someone has to confirm if nearby_node() holds for all APICID
distribution on Intel.

> Place the function inside common.c and expose it in topology.h

There is no need to make it visible out of arch/x86/kernel/cpu/
Perhaps arch/x86/kernel/cpu/cpu/cpu.h?

> 
> The hygon code is already basically identical to amd
> except for the way it obtains the LLC ID.
> We can reuse that from the hygon code since we
> already have the struct cpuinfo_x86 passed to us.
> 
> Signed-off-by: Nikola Z. Ivanov <zlatistiv@gmail.com>
> ---
> This is marked RFC as I lack the context for the reason
> why the intel code looks the way it does. I can see
> it went through a few changes in the 2008-2010 year range,
> which makes be believe that the comment regarding
> "not doing AMD heuristics for now" is long overdue.

So prior to you patch, If I launch:

    -smp 4,sockets=2,cores=2

and "numa=fake=2", the srat_detect_node() for an Intel VM maps:

    CPU#0 -> Node#0
    CPU#1 -> Node#1
    CPU#2 -> Node#0
    CPU#3 -> Node#1

Which resembles Intel baremetal node assignments where the CPUs
are interleaved. After your patch, it does:

    CPU#0 -> Node#0
    CPU#1 -> Node#0
    CPU#2 -> Node#0
    CPU#3 -> Node#0

So despite there being 2 LLCs, the Node assignments all go to Node#0
which may have other unintended consequences.

The statement "falling back to LLC when SRAT is not detected." isn't
accurate right? We have 2 LLCs and 2 Nodes but topology bits associate
both LLCs to the same node.

I'm all for unifying the AMD and Hygon's srat_detect_node() but unifying
all three for an obviously broken use-case isn't a good motivation.

I'll let others comment since they are more familiar with the NUMA
emulation bits and maybe all this is acceptable.

-- 
Thanks and Regards,
Prateek


  reply	other threads:[~2026-03-30  4:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-29 12:08 Nikola Z. Ivanov
2026-03-30  4:57 ` K Prateek Nayak [this message]
2026-04-01 15:41   ` Nikola Z. Ivanov

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=4dde81e8-98cc-4666-a4e7-b5083210fbd0@amd.com \
    --to=kprateek.nayak@amd.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bp@alien8.de \
    --cc=darwi@linutronix.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=i@rong.moe \
    --cc=kai.huang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=mingo@redhat.com \
    --cc=pawan.kumar.gupta@linux.intel.com \
    --cc=peterz@infradead.org \
    --cc=puwen@hygon.cn \
    --cc=ricardo.neri-calderon@linux.intel.com \
    --cc=sohil.mehta@intel.com \
    --cc=sshegde@linux.ibm.com \
    --cc=suchitkarunakaran@gmail.com \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    --cc=xin@zytor.com \
    --cc=yazen.ghannam@amd.com \
    --cc=yury.norov@gmail.com \
    --cc=zlatistiv@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome