public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Vasant Hegde <vasant.hegde@amd.com>, linux-kernel@vger.kernel.org
Cc: x86@kernel.org, dave.hansen@linux.intel.com, bp@alien8.de,
	mingo@redhat.com, Vasant Hegde <vasant.hegde@amd.com>,
	Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>
Subject: Re: [PATCH] x86/smp: Validate APIC ID before parking CPU in INIT
Date: Wed, 09 Aug 2023 20:52:20 +0200	[thread overview]
Message-ID: <87cyzwjbff.ffs@tglx> (raw)
In-Reply-To: <87fs4sjbw0.ffs@tglx>

On Wed, Aug 09 2023 at 20:42, Thomas Gleixner wrote:
> On Wed, Jul 19 2023 at 05:13, Vasant Hegde wrote:
>> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
>> index e1aa2cd7734b..e5ca0689c4dd 100644
>> --- a/arch/x86/kernel/smpboot.c
>> +++ b/arch/x86/kernel/smpboot.c
>> @@ -1360,7 +1360,7 @@ bool smp_park_other_cpus_in_init(void)
>>  		if (cpu == this_cpu)
>>  			continue;
>>  		apicid = apic->cpu_present_to_apicid(cpu);
>> -		if (apicid == BAD_APICID)
>> +		if (apicid == BAD_APICID || !apic->apic_id_valid(apicid))
>>  			continue;
>>  		send_init_sequence(apicid);
>>  	}

I think this papers over the underlying problem that this sends INIT to
an APIC which was never booted. The below is curing the root cause.

Thanks,

        tglx
---
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1356,7 +1356,7 @@ bool smp_park_other_cpus_in_init(void)
 	if (this_cpu)
 		return false;
 
-	for_each_present_cpu(cpu) {
+	for_each_cpu_and(cpu, &cpus_booted_once_mask, cpu_present_mask) {
 		if (cpu == this_cpu)
 			continue;
 		apicid = apic->cpu_present_to_apicid(cpu);

  reply	other threads:[~2023-08-09 18:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-19  5:13 [PATCH] x86/smp: Validate APIC ID before parking CPU in INIT Vasant Hegde
2023-08-03 16:28 ` Vasant Hegde
2023-08-09 18:42 ` Thomas Gleixner
2023-08-09 18:52   ` Thomas Gleixner [this message]
2023-08-10 11:26     ` Vasant Hegde
2023-09-04  8:27       ` Vasant Hegde
2023-09-04 13:48     ` [tip: x86/urgent] x86/smp: Don't send INIT to non-present and non-booted CPUs tip-bot2 for Thomas Gleixner

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=87cyzwjbff.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=dheerajkumar.srivastava@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=vasant.hegde@amd.com \
    --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