[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1 0/2] x86/amd_node: harden amd_smn_init() against Xen dom0 topology


  • To: Penny Zheng <penny.zheng@xxxxxxx>, x86@xxxxxxxxxx
  • From: Mario Limonciello <mario.limonciello@xxxxxxx>
  • Date: Wed, 6 May 2026 12:17:24 -0500
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=V9NVsZpXp7wdlk3ZA4diyLo0TbxzKlpQAYGTEuHvLiE=; b=mifkQextXN12Wp5yY8QJudUlY0kS98FIupFPiJEvjbPEuwp0y5Z3rfGv0aQbTi1HAHqQQZ1bsc1DHgaRmZnRnOF4Hdks61lCR/77frol33mjZJfFj2CLw9+AGv4j3DM8DXOIElxZm9Y91F9rTJuSz+uG+O+9M/4/7XVOoT0cxJsT10V8y8vUmJZI87EfxYk4oK1rmYGwiXbGnyLOjSpKzGiTSZVtXlk1Tzwtt6cXe7vyWwsZsDZNjNe9UN3UeXcpaBdrD9Htzg+NsG37ReFLHBPrPBbs4kKy0iJBF3vXk0blKSy7VS4dLNXSHBzs/pZidA24OY7BSj6+z6+Rh6VysQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yUAMcVnGEQCivMmKagwzrNPHXAQZYjW5+Nq3k6Sx7iHvq810Uw1Kka1s4sbvCaVsxqGWH5QB4mIJXPx70ELVCSvuMYCBKDqhQNYwchjvuclmlCv1Dh+dRBJVNIvaDg2HGlma1oJPnrU8qgunR5l577vQOYDYgEzDN7S1HCTmfMiaRauZP9XZXGc+EOYwBmucHcY7LhkHA9dXSR68Jg6yj/vbVMsSqtVGt31OknIOhibL98vYfzh/5CYzdE1oLaZwYtZU0NjOjPO23gcinPh3jpSes+IUYqg/X1SQVeM4l/PsOckLKRpeIT281piRlRshqz6j0m3g3xmAi70Ko9U+Vw==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: ray.huang@xxxxxxx, Jason.Andryuk@xxxxxxx, stefano.stabellini@xxxxxxx, Yazen Ghannam <yazen.ghannam@xxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
  • Delivery-date: Wed, 06 May 2026 17:17:46 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>



On 5/6/26 00: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).

So to confirm - does amd_pmc_probe work properly with this series now?


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(-)





 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.