From: Jiaqing Zhao <Zhao.Jiaqing@amd.com>
To: Penny Zheng <penny.zheng@amd.com>, x86@kernel.org
Cc: ray.huang@amd.com, Jason.Andryuk@amd.com,
stefano.stabellini@amd.com,
Mario Limonciello <mario.limonciello@amd.com>,
Yazen Ghannam <yazen.ghannam@amd.com>,
Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 0/2] x86/amd_node: harden amd_smn_init() against Xen dom0 topology
Date: Thu, 7 May 2026 16:37:43 +0800 [thread overview]
Message-ID: <3531c9e1-97a8-42ab-aae7-4cfa8976f443@amd.com> (raw)
In-Reply-To: <20260506055528.476493-1-penny.zheng@amd.com>
This amd_smn_init div0 oops is also observed on 6.19.14+deb14 (Debian testing)
and 6.18.27. Given that 6.18 is LTS, suggesting `Cc: stable@vger.kernel.org`
to get it backported.
Thanks,
Jiaqing
On 2026-05-06 13:55, Penny Zheng wrote:
> While booting a recent linux-next kernel as a Xen PVH dom0 on x86, the kernel
> oopses very early during fs_initcall:
>
> Oops: divide error: 0000 [#1] SMP NOPTI
> RIP: 0010:amd_smn_init+0x188/0x2e0
>
> Followed: on a kernel that survives the divide, it will fail by a NULL pointer
> dereference from the first SMN consumer (amd_pmc_probe -> amd_smn_read).
>
> Root cause
> ==========
>
> To prevent each dom0 vCPU from looking like an SMT sibling of another
> vCPU, Xen synthesizes guest x2APIC IDs as vcpu_index * 2. This spacing every
> vCPU's APIC ID by 2 can push the synthesized IDs past the package-field
> boundary. Linux then infers more "packages" and therefore more AMD
> nodes via amd_num_nodes() than the platform actually has, while the
> PCI-side host-bridge scan correctly reports the number of root complex.
>
> The fixes are tested on Xen 4.20 PVH dom0 on AMD Zen (16 vCPUs) on top of
> linux-next/master (next-20260505).
>
> Penny Zheng (2):
> x86/amd_node: avoid divide-by-zero in amd_smn_init() under Xen dom0
> x86/amd_node: reject SMN access when amd_smn_init() did not complete
>
> arch/x86/kernel/amd_node.c | 23 ++++++++++++++++++++---
> 1 file changed, 20 insertions(+), 3 deletions(-)
>
prev parent reply other threads:[~2026-05-07 8:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 5:55 [PATCH v1 0/2] x86/amd_node: harden amd_smn_init() against Xen dom0 topology Penny Zheng
2026-05-06 5:55 ` [PATCH v1 1/2] x86/amd_node: avoid divide-by-zero in amd_smn_init() under Xen dom0 Penny Zheng
2026-05-06 5:55 ` [PATCH v1 2/2] x86/amd_node: reject SMN access when amd_smn_init() did not complete Penny Zheng
2026-05-06 17:17 ` [PATCH v1 0/2] x86/amd_node: harden amd_smn_init() against Xen dom0 topology Mario Limonciello
2026-05-07 8:37 ` Jiaqing Zhao [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=3531c9e1-97a8-42ab-aae7-4cfa8976f443@amd.com \
--to=zhao.jiaqing@amd.com \
--cc=Jason.Andryuk@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=mingo@redhat.com \
--cc=penny.zheng@amd.com \
--cc=ray.huang@amd.com \
--cc=stefano.stabellini@amd.com \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.org \
--cc=yazen.ghannam@amd.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