mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: K Prateek Nayak <kprateek.nayak@amd.com>
To: Naveen N Rao <naveen@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	"H. Peter Anvin" <hpa@zytor.com>,
	Sairaj Kodilkar <sarunkod@amd.com>,
	Mario Limonciello <mario.limonciello@amd.com>,
	Pawan Gupta <pawan.kumar.gupta@linux.intel.com>,
	"Gautham R. Shenoy" <gautham.shenoy@amd.com>,
	Babu Moger <babu.moger@amd.com>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Subject: Re: [PATCH 2/2] x86/cpu/topology: Use initial APICID from XTOPOEXT on AMD/HYGON
Date: Wed, 18 Jun 2025 10:56:11 +0530	[thread overview]
Message-ID: <df39d7d9-4291-450b-85b7-4c57a3c4a025@amd.com> (raw)
In-Reply-To: <2vanc3xxtjx3ytcl2dwcu3vmn7d2ixpco3mj6p7qyloga5j25p@5ldwqxycaeko>

Hello Naveen,

On 6/18/2025 9:30 AM, Naveen N Rao wrote:
>> diff --git a/arch/x86/kernel/cpu/topology_amd.c b/arch/x86/kernel/cpu/topology_amd.c
>> index fec849fff82f..2ff6988e020a 100644
>> --- a/arch/x86/kernel/cpu/topology_amd.c
>> +++ b/arch/x86/kernel/cpu/topology_amd.c
>> @@ -80,7 +80,13 @@ static bool parse_8000_001e(struct topo_scan *tscan, bool has_topoext)
>>   
>>   	cpuid_leaf(0x8000001e, &leaf);
>>   
>> -	tscan->c->topo.initial_apicid = leaf.ext_apic_id;
>> +	/*
>> +	 * Prefer initial_apicid parsed from CPUID leaf 0x8000026 or 0xb
>> +	 * if available. Otherwise prefer the one from leaf 0x8000001e
>> +	 * over 0x1.
>> +	 */
>> +	if (!has_topoext)
>> +		tscan->c->topo.initial_apicid = leaf.ext_apic_id;
> 
> My understanding is that the rest of this function continues to work
> properly with an all-zero return value from CPUID leaf 0x8000001e - data
> from topoext is preferred where available, and other sources are used
> for llc_id.

Yes. QEMU just errs on the side of caution for CoreID collision in
0x8000001e and "NumSharingCache" in 0x8000001d EAX[25:14] can still
represent 2^12 (4096) CPUs in each cache domain which is larger than
the total number of vCPUs possible currently I believe.

> And, this fixes the firmware bug warning seen during a guest boot in
> qemu for me, so for this patch:
> Tested-by: Naveen N Rao (AMD) <naveen@kernel.org>

Thank you for debugging the issue and testing :)

-- 
Thanks and Regards,
Prateek


  reply	other threads:[~2025-06-18  5:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-12  7:29 [PATCH 0/2] x86/cpu/topology: Work around the nuances of virtualization on AMD/Hygon K Prateek Nayak
2025-06-12  7:29 ` [PATCH 1/2] x86/cpu/topology: Always try cpu_parse_topology_ext() " K Prateek Nayak
2025-06-12  7:29 ` [PATCH 2/2] x86/cpu/topology: Use initial APICID from XTOPOEXT on AMD/HYGON K Prateek Nayak
2025-06-18  4:00   ` Naveen N Rao
2025-06-18  5:26     ` K Prateek Nayak [this message]
2025-06-25  6:28 ` [PATCH 0/2] x86/cpu/topology: Work around the nuances of virtualization on AMD/Hygon K Prateek Nayak
2025-07-02  8:27   ` K Prateek Nayak

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=df39d7d9-4291-450b-85b7-4c57a3c4a025@amd.com \
    --to=kprateek.nayak@amd.com \
    --cc=babu.moger@amd.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=gautham.shenoy@amd.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=mingo@redhat.com \
    --cc=naveen@kernel.org \
    --cc=pawan.kumar.gupta@linux.intel.com \
    --cc=sarunkod@amd.com \
    --cc=suravee.suthikulpanit@amd.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®