lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d081ffa14a8c1f9f68e393a56520da764721a110.camel@infradead.org>
Date:   Tue, 21 Feb 2023 13:22:20 +0000
From:   David Woodhouse <dwmw2@...radead.org>
To:     Usama Arif <usama.arif@...edance.com>,
        Oleksandr Natalenko <oleksandr@...alenko.name>
Cc:     Kim Phillips <kim.phillips@....com>, tglx@...utronix.de,
        arjan@...ux.intel.com, mingo@...hat.com, bp@...en8.de,
        dave.hansen@...ux.intel.com, hpa@...or.com, x86@...nel.org,
        pbonzini@...hat.com, paulmck@...nel.org,
        linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
        rcu@...r.kernel.org, mimoja@...oja.de, hewenliang4@...wei.com,
        thomas.lendacky@....com, seanjc@...gle.com, pmenzel@...gen.mpg.de,
        fam.zheng@...edance.com, punit.agrawal@...edance.com,
        simon.evans@...edance.com, liangma@...ngbit.com,
        "Limonciello, Mario" <Mario.Limonciello@....com>,
        Piotr Gorski <piotrgorski@...hyos.org>
Subject: Re: [External] Re: [PATCH v9 0/8] Parallel CPU bringup for x86_64

On Tue, 2023-02-21 at 11:54 +0000, Usama Arif wrote:
> 
> 
> On 21/02/2023 11:42, Oleksandr Natalenko wrote:
> > On 21.02.2023 11:47, Usama Arif wrote:
> > > On 21/02/2023 10:27, David Woodhouse wrote:
> > > > 
> > > > On 21 February 2023 09:49:51 GMT, Oleksandr Natalenko 
> > > > <oleksandr@...alenko.name> wrote:
> > > > > On 21.02.2023 10:06, David Woodhouse wrote:
> > > > > > Why does arch/x86/kernel/acpi/sleep.c::x86_acpi_suspend_lowlevel() set
> > > > > > 
> > > > > >      initial_gs = per_cpu_offset(smp_processor_id()) ?
> > > > > > 
> > > > > > Would it not be CPU#0 that comes back up, and should it not get
> > > > > > per_cpu_offset(0) ?
> > > > > 
> > > > > Wanna me try `initial_gs = per_cpu_offset(0);` too?
> > > > 
> > > 
> > > I think it might be smp_processor_id() and not 0 incase CPU0 was 
> > > offline at the point the system was suspended?
> > 
> > Is it even possible for CPU 0 to be offline, at least on x86?
> > 
> 
> It is possible on x86 (using BOOTPARAM_HOTPLUG_CPU0), but I just read
> the Kconfig option and it says:
> 
> "resume from hibernate or suspend always starts from CPU0.
> So hibernate and suspend are prevented if CPU0 is offline."
> 
> so I guess switching to 0 should be ok.

The interesting question is who ends up using whose stack?

Leaving smpboot_control alone (for the parallel case only; we can't
just leave it with the APIC ID of the last CPU started in the serial
case) will make each CPU find the same CPU# and stack it used to have,
from its own APIC ID and the cpuid_to_apicid[] table.

I don't really grok what's happening in the non-parallel case. We leave
behind the stack for the CPU that happens to be running the suspend
function. And then whichever CPU comes back, it'll get *that* stack.

I don't understand why the parallel bringup changes this. Does the
cpuid to apicid mapping *change* on resume, if the suspending and
resuming CPU are different? Do they swap stacks and CPU# somehow?

Download attachment "smime.p7s" of type "application/pkcs7-signature" (5965 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ