Linux RCU subsystem development
 help / color / mirror / Atom feed
From: Oleksandr Natalenko <oleksandr@natalenko.name>
To: Usama Arif <usama.arif@bytedance.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
	Kim Phillips <kim.phillips@amd.com>,
	tglx@linutronix.de, arjan@linux.intel.com, mingo@redhat.com,
	bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com,
	x86@kernel.org, pbonzini@redhat.com, paulmck@kernel.org,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	rcu@vger.kernel.org, mimoja@mimoja.de, hewenliang4@huawei.com,
	thomas.lendacky@amd.com, seanjc@google.com,
	pmenzel@molgen.mpg.de, fam.zheng@bytedance.com,
	punit.agrawal@bytedance.com, simon.evans@bytedance.com,
	liangma@liangbit.com, "Limonciello,
	Mario" <Mario.Limonciello@amd.com>,
	Piotr Gorski <piotrgorski@cachyos.org>
Subject: Re: [External] Re: [PATCH v9 0/8] Parallel CPU bringup for x86_64
Date: Tue, 21 Feb 2023 22:04:29 +0100	[thread overview]
Message-ID: <056c22523573943347906d0235708d2a@natalenko.name> (raw)
In-Reply-To: <538080af-b876-6462-c591-be66dceb4b8d@bytedance.com>

On 21.02.2023 21:04, Usama Arif wrote:
> On 21/02/2023 19:10, David Woodhouse wrote:
>> On Tue, 2023-02-21 at 13:14 +0100, Oleksandr Natalenko wrote:
>>> 
>>> With this in place:
>>> 
>>> ```
>>>          early_gdt_descr.address = (unsigned long)get_cpu_gdt_rw(0);
>>>          initial_gs = per_cpu_offset(0);
>>>          smpboot_control = 0;
>>> ```
>>> 
>>> the resume does not work.
>> 
>> Yeah, I think it's always running on CPU0 after the other CPUs are
>> taken down anyway.
>> 
>> We definitely *do* need to clear smpboot_control because we absolutely
>> want it using the temp_stack we explicitly put into initial_stack, not
>> finding its own idle thread.
>> 
>> The problem was that it was never being restored to STARTUP_SECONDARY
>> in the parallel modes, because that's a one-time setup in
>> native_smp_prepare_cpus(). So we can just restore it in
>> arch_thaw_secondary_cpus_begin() too, by working this into patch 6 of
>> the series.
>> 
>> (Usama, I think my tree is fairly out of date now so I'll let you do
>> that? Thanks!).
> 
> Sounds good! Will send out the next revision with below diff, 
> checkpatch
> fixes and rebased to 6.2 (testing it now). The below fix looks good! 
> Oleksandr, would you mind testing out suspend/resume with the below 
> diff on your AMD machine just to make sure it fixes the issue before I 
> send out the next revision with it. Thanks!

Right, so I applied the whole series + this fix, and the suspend/resume 
works. Thanks!

Reported-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>

There's another open question pending though: why would this series 
cause booting up one CPU only on an older AMD CPU. But I'd expect 
Piotr's fellow to chime in occasionally.

>> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
>> index 50621793671d..3db77a257ae2 100644
>> --- a/arch/x86/kernel/smpboot.c
>> +++ b/arch/x86/kernel/smpboot.c
>> @@ -1571,6 +1571,17 @@ void __init native_smp_prepare_cpus(unsigned 
>> int max_cpus)
>>     void arch_thaw_secondary_cpus_begin(void)
>>   {
>> +	/*
>> +	 * On suspend, smpboot_control will have been zeroed to allow the
>> +	 * boot CPU to use explicitly passed values including a temporary
>> +	 * stack. Since native_smp_prepare_cpus() won't be called again,
>> +	 * restore the appropriate value for the parallel startup modes.
>> +	 */
>> +	if (do_parallel_bringup) {
>> +		smpboot_control = STARTUP_SECONDARY |
>> +			(x2apic_mode ? STARTUP_APICID_CPUID_0B : STARTUP_APICID_CPUID_01);
>> +	}
>> +
>>   	set_cache_aps_delayed_init(true);
>>   }
>> 

-- 
   Oleksandr Natalenko (post-factum)

  reply	other threads:[~2023-02-21 21:04 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15 14:54 [PATCH v9 0/8] Parallel CPU bringup for x86_64 Usama Arif
2023-02-15 14:54 ` [PATCH v9 1/8] x86/apic/x2apic: Allow CPU cluster_mask to be populated in parallel Usama Arif
2023-02-16 20:58   ` Kim Phillips
2023-02-15 14:54 ` [PATCH v9 2/8] cpu/hotplug: Move idle_thread_get() to <linux/smpboot.h> Usama Arif
2023-02-15 14:54 ` [PATCH v9 3/8] cpu/hotplug: Add dynamic parallel bringup states before CPUHP_BRINGUP_CPU Usama Arif
2023-02-15 14:54 ` [PATCH v9 4/8] x86/smpboot: Reference count on smpboot_setup_warm_reset_vector() Usama Arif
2023-02-15 14:54 ` [PATCH v9 5/8] x86/smpboot: Split up native_cpu_up into separate phases and document them Usama Arif
2023-02-15 14:54 ` [PATCH v9 6/8] x86/smpboot: Support parallel startup of secondary CPUs Usama Arif
2023-02-15 14:54 ` [PATCH v9 7/8] x86/smpboot: Send INIT/SIPI/SIPI to secondary CPUs in parallel Usama Arif
2023-02-15 14:54 ` [PATCH v9 8/8] x86/smpboot: Serialize topology updates for secondary bringup Usama Arif
2023-02-16  6:34 ` [PATCH v9 0/8] Parallel CPU bringup for x86_64 Paul E. McKenney
2023-02-20 16:08 ` Oleksandr Natalenko
2023-02-20 16:20   ` David Woodhouse
2023-02-20 16:40     ` Oleksandr Natalenko
2023-02-20 20:31       ` David Woodhouse
2023-02-20 21:23         ` Oleksandr Natalenko
2023-02-20 21:34           ` Piotr Gorski
2023-02-20 21:39           ` David Woodhouse
2023-02-20 23:23             ` Kim Phillips
2023-02-20 23:30               ` David Woodhouse
2023-02-21  4:20                 ` Kim Phillips
2023-02-21  7:16                   ` David Woodhouse
2023-02-21  7:27                 ` Oleksandr Natalenko
2023-02-21  7:53                   ` David Woodhouse
2023-02-21  8:05                     ` Oleksandr Natalenko
2023-02-21  8:17                       ` David Woodhouse
2023-02-21  8:25                         ` Oleksandr Natalenko
2023-02-21  8:35                           ` David Woodhouse
2023-02-21  8:44                             ` Oleksandr Natalenko
2023-02-21  9:06                               ` David Woodhouse
2023-02-21  9:49                                 ` Oleksandr Natalenko
2023-02-21 10:27                                   ` David Woodhouse
2023-02-21 10:47                                     ` [External] " Usama Arif
2023-02-21 11:42                                       ` Oleksandr Natalenko
2023-02-21 11:54                                         ` Usama Arif
2023-02-21 13:22                                           ` David Woodhouse
2023-02-21 11:46                                     ` Oleksandr Natalenko
2023-02-21 11:49                                       ` David Woodhouse
2023-02-21 12:14                                         ` Oleksandr Natalenko
2023-02-21 19:10                                           ` David Woodhouse
2023-02-21 20:04                                             ` [External] " Usama Arif
2023-02-21 21:04                                               ` Oleksandr Natalenko [this message]
2023-02-21 21:41                                             ` Thomas Gleixner
2023-02-21 21:44                                               ` David Woodhouse
2023-02-21 23:18                                               ` David Woodhouse
2023-02-22  0:00                                                 ` [External] " Usama Arif
2023-02-22  8:19                                                   ` David Woodhouse
2023-02-22  9:46                                                     ` Thomas Gleixner
2023-02-22  9:51                                                       ` David Woodhouse
2023-02-22  9:31                                                 ` Thomas Gleixner
2023-02-20 22:22           ` Piotr Gorski
2023-02-20 22:23           ` [External] " Usama Arif
2023-02-20 22:41             ` Oleksandr Natalenko
2023-02-22 10:11 ` David Woodhouse
2023-02-22 11:11   ` [External] " Usama Arif
2023-02-22 12:08   ` Brian Gerst
2023-02-22 12:53     ` David Woodhouse
2023-02-22 16:42   ` Thomas Gleixner
2023-02-23 11:07     ` David Woodhouse
2023-02-23 14:37       ` Thomas Gleixner
2023-02-23 15:12         ` David Woodhouse
2023-02-23 19:24       ` [External] " Usama Arif

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=056c22523573943347906d0235708d2a@natalenko.name \
    --to=oleksandr@natalenko.name \
    --cc=Mario.Limonciello@amd.com \
    --cc=arjan@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=fam.zheng@bytedance.com \
    --cc=hewenliang4@huawei.com \
    --cc=hpa@zytor.com \
    --cc=kim.phillips@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=liangma@liangbit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mimoja@mimoja.de \
    --cc=mingo@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=piotrgorski@cachyos.org \
    --cc=pmenzel@molgen.mpg.de \
    --cc=punit.agrawal@bytedance.com \
    --cc=rcu@vger.kernel.org \
    --cc=seanjc@google.com \
    --cc=simon.evans@bytedance.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=usama.arif@bytedance.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