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: <EB397FEA-D36D-41C0-809A-A58450DF5967@infradead.org>
Date:   Tue, 21 Feb 2023 21:44:21 +0000
From:   David Woodhouse <dwmw2@...radead.org>
To:     Thomas Gleixner <tglx@...utronix.de>,
        Oleksandr Natalenko <oleksandr@...alenko.name>
CC:     Kim Phillips <kim.phillips@....com>,
        Usama Arif <usama.arif@...edance.com>, 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: [PATCH v9 0/8] Parallel CPU bringup for x86_64



On 21 February 2023 21:41:32 GMT, Thomas Gleixner <tglx@...utronix.de> wrote:
>David!
>
>On Tue, Feb 21 2023 at 19:10, David Woodhouse wrote:
>> On Tue, 2023-02-21 at 13:14 +0100, Oleksandr Natalenko wrote:
>> (Usama, I think my tree is fairly out of date now so I'll let you do
>> that? Thanks!).
>>
>> 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);
>> +	}
>
>My bad taste sensor reports: "Out of effective range"
>
>Why on earth can't you fix the wreckage exactly where it happens,
>i.e. in x86_acpi_suspend_lowlevel() ?

Er, that was my first instinct but for some reason I concluded that I couldn't put it back there, and it has to be done later because this was just a function called on the way down to suspend. Wrongly, it seems. :)

>--- a/arch/x86/kernel/acpi/sleep.c
>+++ b/arch/x86/kernel/acpi/sleep.c
>@@ -16,6 +16,7 @@
> #include <asm/cacheflush.h>
> #include <asm/realmode.h>
> #include <asm/hypervisor.h>
>+#include <asm/smp.h>
> 
> #include <linux/ftrace.h>
> #include "../../realmode/rm/wakeup.h"
>@@ -57,6 +58,7 @@ asmlinkage acpi_status __visible x86_acp
>  */
> int x86_acpi_suspend_lowlevel(void)
> {
>+	unsigned int __maybe_unused saved_smpboot_ctrl;
> 	struct wakeup_header *header =
> 		(struct wakeup_header *) __va(real_mode_header->wakeup_header);
> 
>@@ -115,7 +117,8 @@ int x86_acpi_suspend_lowlevel(void)
> 	early_gdt_descr.address =
> 			(unsigned long)get_cpu_gdt_rw(smp_processor_id());
> 	initial_gs = per_cpu_offset(smp_processor_id());
>-	smpboot_control = 0;
>+	/* Force the startup into boot mode */
>+	saved_smpboot_ctrl = xchg(&smpboot_control, 0);
> #endif
> 	initial_code = (unsigned long)wakeup_long64;
>        saved_magic = 0x123456789abcdef0L;
>@@ -128,6 +131,9 @@ int x86_acpi_suspend_lowlevel(void)
> 	pause_graph_tracing();
> 	do_suspend_lowlevel();
> 	unpause_graph_tracing();
>+
>+	if (IS_ENABLED(CONFIG_64BIT) && IS_ENABLED(CONFIG_SMP))
>+		smpboot_control = saved_smpboot_ctrl;
> 	return 0;
> }
> 
>
>That's too bloody obvious, too self explaining, not enough duplicated
>code and does not need any fixups when the smpboot_control bits are
>changed later, right?
>
>Thanks,
>
>        tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ