Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp516821ybb; Wed, 1 Apr 2020 04:44:01 -0700 (PDT) X-Google-Smtp-Source: APiQypLLikfxYezUVmJsuyJsbkE8HSI2lRqGHpqpTAPmEIrTiQqedxUnY+xJQXyfBx5nkU/E/vth X-Received: by 2002:aca:fd44:: with SMTP id b65mr2248811oii.119.1585741441154; Wed, 01 Apr 2020 04:44:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585741441; cv=none; d=google.com; s=arc-20160816; b=OPrP3/4ERC7r8zP4zb+pCGq6+XiUCqi8WvNrIhRKtBONkTkMV032duyt9uwHP5sUh5 0BujMGtDQBzxoUe8HRbvyCsA2AYNUnQmmuf2+dnhQnSG+M2CwC4JVH9oy72oTIBMYZ3m wtJpYkXR98ThwWyzWArO7B6vUA9lRjVKsbvBMW50+ER8KN+itCsiPZvsOP2N6rQ3W07D 5dBEkflEzo5iyJCnsmLNAz5y+gDrr10K5NXJ7jnvQB5iXZuuL3hZ9ZIzTVLaMiXNJ5eJ FWBEoldMNFPiKLj37hR4Ufmkh3brVaAGIvAi3mD5Y3np/QaXsuZsOOh0cuQ+e8eoSNm3 +RsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=B6LtkV31Mx0Wb2yWk+q4vycLOOPy+wzd4O74v4uZk5c=; b=K5lPpdkQnjxe7YOgIUN83noLfWi1my3tFrpsMDZLEjEa5EEXRyaGezF2AXd61RS1Pv 0sYCY2Csp0q5dK4ESg4CJpM4TAxGoDjkY7UMjrfqE3u6YzSXnBIrkfrz2VPr2gtAnHSL zSPt/izP3TabbfviqoR+XQxM85mmKAvYCXDDq+eV++UONx43JgCmALuEYW1bLNzMWMxZ A2du6F+lESlWgPjHVyZ7/nbhV3EeO9XjNbQIdN6Ae3sl3IIaefbzSuka4wyN4YknaiAq gyTsCxYMBUFuqvs83jVZwej/JR8OnbEAt0lK0o3krQW+6m2gjIwIG8Do+lbiKoC71GHW 48Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=n6roFE5d; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w21si828085oia.257.2020.04.01.04.43.48; Wed, 01 Apr 2020 04:44:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=n6roFE5d; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732427AbgDALja (ORCPT + 99 others); Wed, 1 Apr 2020 07:39:30 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:35094 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726612AbgDALja (ORCPT ); Wed, 1 Apr 2020 07:39:30 -0400 Received: by mail-io1-f68.google.com with SMTP id o3so19690321ioh.2 for ; Wed, 01 Apr 2020 04:39:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=B6LtkV31Mx0Wb2yWk+q4vycLOOPy+wzd4O74v4uZk5c=; b=n6roFE5dLAi4JKjmSsulf2z+8Omo6kkxYtrR1zQC48clYebJV3t5LbN0FcqhYZ9rLp Q9qu6iMTDaVaWr5jo9STCgs6GkqQK0qdL5jaReYmYfpMUzSfh8LDdo6rOrfIN6yoz+7T NBZnggh28MMaUluimTxJt44ZWOBkSv60Q/j0ms1mrozVASJhJOqjnKwIkjrOOf6NGABN qF0VWNuJ7QL3LAEbzWipYJZLowk9oMHyjaKxmFr4j20JgvPR6wBwlSMaIepoEJPnWPKE PrkT+PZIc1T8jXG270hT9KQr3X7Y9zDRNtH0DjYLe0Da8lxtpY7Vq4CD67KAa7KAABkM P/6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=B6LtkV31Mx0Wb2yWk+q4vycLOOPy+wzd4O74v4uZk5c=; b=d1/bj2dhCDGiBE2pxJuPYjObGbzPcYdUspuzmewyC3nL5AIIiikFtQePMrAtJdCX2X ZnhIe1FP3lB7+7Spp0ZcVe6Df8z9WjOWuxzIs3YrhuqvOrYqu64q1aEoLM3obko+dO3x mJkTj9hgxuU+rSeF7vyBWl5j33EEEKA6qbC9JtVJAxJtXtjv+X3BJfb4oONJ4UlguH9+ lLJbGOKB8yaFICSEr/KO4ouij/Cs7MkK10S6OfDk9VJDjBiP62gE78hri59PGj016ZrX 8n3hZD4kinfUb5HZtaO2k/X+GiVyVny/UFLVTKZZXykzQluPLZGJdYI1ZktuH0qf0sa/ c+XA== X-Gm-Message-State: ANhLgQ0Ynw3P+w3wO33FdEeyVkC/VW9LVq3A9AInMSO3/IksSZjZfTCE cBlftK6bcnAGi0+bEJqQuzhQGxD6iIHNMcfXWQ== X-Received: by 2002:a05:6602:2242:: with SMTP id o2mr19807209ioo.22.1585741167864; Wed, 01 Apr 2020 04:39:27 -0700 (PDT) MIME-Version: 1.0 References: <20200325101431.12341-1-andrew.cooper3@citrix.com> <20200331175810.30204-1-andrew.cooper3@citrix.com> In-Reply-To: From: Brian Gerst Date: Wed, 1 Apr 2020 07:39:16 -0400 Message-ID: Subject: Re: [PATCH v2] x86/smpboot: Remove 486-isms from the modern AP boot path To: Andrew Cooper Cc: LKML , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "the arch/x86 maintainers" , Jan Kiszka , James Morris , David Howells , Matthew Garrett , Josh Boyer , Steve Wahl , Mike Travis , Dimitri Sivanich , Arnd Bergmann , "Peter Zijlstra (Intel)" , Giovanni Gherdovich , "Rafael J. Wysocki" , Len Brown , Kees Cook , Martin Molnar , Pingfan Liu , jailhouse-dev@googlegroups.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 1, 2020 at 5:22 AM Andrew Cooper wrote: > > On 31/03/2020 23:53, Brian Gerst wrote: > > On Tue, Mar 31, 2020 at 6:44 PM Andrew Cooper wrote: > >> On 31/03/2020 23:23, Brian Gerst wrote: > >>> On Tue, Mar 31, 2020 at 1:59 PM Andrew Cooper wrote: > >>>> Linux has an implementation of the Universal Start-up Algorithm (MP spec, > >>>> Appendix B.4, Application Processor Startup), which includes unconditionally > >>>> writing to the Bios Data Area and CMOS registers. > >>>> > >>>> The warm reset vector is only necessary in the non-integrated Local APIC case. > >>>> UV and Jailhouse already have an opt-out for this behaviour, but blindly using > >>>> the BDA and CMOS on a UEFI or other reduced hardware system isn't clever. > >>>> > >>>> We could make this conditional on the integrated-ness of the Local APIC, but > >>>> 486-era SMP isn't supported. Drop the logic completely, tidying up the includ > >>>> list and header files as appropriate. > >>>> > >>>> CC: Thomas Gleixner > >>>> CC: Ingo Molnar > >>>> CC: Borislav Petkov > >>>> CC: "H. Peter Anvin" > >>>> CC: x86@kernel.org > >>>> CC: Jan Kiszka > >>>> CC: James Morris > >>>> CC: David Howells > >>>> CC: Andrew Cooper > >>>> CC: Matthew Garrett > >>>> CC: Josh Boyer > >>>> CC: Steve Wahl > >>>> CC: Mike Travis > >>>> CC: Dimitri Sivanich > >>>> CC: Arnd Bergmann > >>>> CC: "Peter Zijlstra (Intel)" > >>>> CC: Giovanni Gherdovich > >>>> CC: "Rafael J. Wysocki" > >>>> CC: Len Brown > >>>> CC: Kees Cook > >>>> CC: Martin Molnar > >>>> CC: Pingfan Liu > >>>> CC: linux-kernel@vger.kernel.org > >>>> CC: jailhouse-dev@googlegroups.com > >>>> Suggested-by: "H. Peter Anvin" > >>>> Signed-off-by: Andrew Cooper > >>>> --- > >>>> v2: > >>>> * Drop logic entirely, rather than retaining support in 32bit builds. > >>>> --- > >>>> arch/x86/include/asm/apic.h | 6 ----- > >>>> arch/x86/include/asm/x86_init.h | 1 - > >>>> arch/x86/kernel/apic/x2apic_uv_x.c | 1 - > >>>> arch/x86/kernel/jailhouse.c | 1 - > >>>> arch/x86/kernel/platform-quirks.c | 1 - > >>>> arch/x86/kernel/smpboot.c | 50 -------------------------------------- > >>>> 6 files changed, 60 deletions(-) > >>>> > >>>> diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h > >>>> index 19e94af9cc5d..5c33f9374b28 100644 > >>>> --- a/arch/x86/include/asm/apic.h > >>>> +++ b/arch/x86/include/asm/apic.h > >>>> @@ -472,12 +472,6 @@ static inline unsigned default_get_apic_id(unsigned long x) > >>>> return (x >> 24) & 0x0F; > >>>> } > >>>> > >>>> -/* > >>>> - * Warm reset vector position: > >>>> - */ > >>>> -#define TRAMPOLINE_PHYS_LOW 0x467 > >>>> -#define TRAMPOLINE_PHYS_HIGH 0x469 > >>>> - > >>>> extern void generic_bigsmp_probe(void); > >>>> > >>>> #ifdef CONFIG_X86_LOCAL_APIC > >>>> diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h > >>>> index 96d9cd208610..006a5d7fd7eb 100644 > >>>> --- a/arch/x86/include/asm/x86_init.h > >>>> +++ b/arch/x86/include/asm/x86_init.h > >>>> @@ -229,7 +229,6 @@ enum x86_legacy_i8042_state { > >>>> struct x86_legacy_features { > >>>> enum x86_legacy_i8042_state i8042; > >>>> int rtc; > >>>> - int warm_reset; > >>>> int no_vga; > >>>> int reserve_bios_regions; > >>>> struct x86_legacy_devices devices; > >>>> diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c > >>>> index ad53b2abc859..5afcfd193592 100644 > >>>> --- a/arch/x86/kernel/apic/x2apic_uv_x.c > >>>> +++ b/arch/x86/kernel/apic/x2apic_uv_x.c > >>>> @@ -343,7 +343,6 @@ static int __init uv_acpi_madt_oem_check(char *_oem_id, char *_oem_table_id) > >>>> } else if (!strcmp(oem_table_id, "UVH")) { > >>>> /* Only UV1 systems: */ > >>>> uv_system_type = UV_NON_UNIQUE_APIC; > >>>> - x86_platform.legacy.warm_reset = 0; > >>>> __this_cpu_write(x2apic_extra_bits, pnodeid << uvh_apicid.s.pnode_shift); > >>>> uv_set_apicid_hibit(); > >>>> uv_apic = 1; > >>>> diff --git a/arch/x86/kernel/jailhouse.c b/arch/x86/kernel/jailhouse.c > >>>> index 6eb8b50ea07e..d628fe92d6af 100644 > >>>> --- a/arch/x86/kernel/jailhouse.c > >>>> +++ b/arch/x86/kernel/jailhouse.c > >>>> @@ -210,7 +210,6 @@ static void __init jailhouse_init_platform(void) > >>>> x86_platform.calibrate_tsc = jailhouse_get_tsc; > >>>> x86_platform.get_wallclock = jailhouse_get_wallclock; > >>>> x86_platform.legacy.rtc = 0; > >>>> - x86_platform.legacy.warm_reset = 0; > >>>> x86_platform.legacy.i8042 = X86_LEGACY_I8042_PLATFORM_ABSENT; > >>>> > >>>> legacy_pic = &null_legacy_pic; > >>>> diff --git a/arch/x86/kernel/platform-quirks.c b/arch/x86/kernel/platform-quirks.c > >>>> index b348a672f71d..d922c5e0c678 100644 > >>>> --- a/arch/x86/kernel/platform-quirks.c > >>>> +++ b/arch/x86/kernel/platform-quirks.c > >>>> @@ -9,7 +9,6 @@ void __init x86_early_init_platform_quirks(void) > >>>> { > >>>> x86_platform.legacy.i8042 = X86_LEGACY_I8042_EXPECTED_PRESENT; > >>>> x86_platform.legacy.rtc = 1; > >>>> - x86_platform.legacy.warm_reset = 1; > >>>> x86_platform.legacy.reserve_bios_regions = 0; > >>>> x86_platform.legacy.devices.pnpbios = 1; > >>>> > >>>> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c > >>>> index fe3ab9632f3b..a9f5b511d0b4 100644 > >>>> --- a/arch/x86/kernel/smpboot.c > >>>> +++ b/arch/x86/kernel/smpboot.c > >>>> @@ -72,7 +72,6 @@ > >>>> #include > >>>> #include > >>>> #include > >>>> -#include > >>>> #include > >>>> #include > >>>> #include > >>>> @@ -119,34 +118,6 @@ int arch_update_cpu_topology(void) > >>>> return retval; > >>>> } > >>>> > >>>> -static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip) > >>>> -{ > >>>> - unsigned long flags; > >>>> - > >>>> - spin_lock_irqsave(&rtc_lock, flags); > >>>> - CMOS_WRITE(0xa, 0xf); > >>>> - spin_unlock_irqrestore(&rtc_lock, flags); > >>>> - *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_HIGH)) = > >>>> - start_eip >> 4; > >>>> - *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) = > >>>> - start_eip & 0xf; > >>>> -} > >>>> - > >>>> -static inline void smpboot_restore_warm_reset_vector(void) > >>>> -{ > >>>> - unsigned long flags; > >>>> - > >>>> - /* > >>>> - * Paranoid: Set warm reset code and vector here back > >>>> - * to default values. > >>>> - */ > >>>> - spin_lock_irqsave(&rtc_lock, flags); > >>>> - CMOS_WRITE(0, 0xf); > >>>> - spin_unlock_irqrestore(&rtc_lock, flags); > >>>> - > >>>> - *((volatile u32 *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) = 0; > >>>> -} > >>>> - > >>>> static void init_freq_invariance(void); > >>>> > >>>> /* > >>>> @@ -1049,20 +1020,6 @@ static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle, > >>>> * the targeted processor. > >>>> */ > >>>> > >>>> - if (x86_platform.legacy.warm_reset) { > >>>> - > >>>> - pr_debug("Setting warm reset code and vector.\n"); > >>>> - > >>>> - smpboot_setup_warm_reset_vector(start_ip); > >>>> - /* > >>>> - * Be paranoid about clearing APIC errors. > >>>> - */ > >>>> - if (APIC_INTEGRATED(boot_cpu_apic_version)) { > >>>> - apic_write(APIC_ESR, 0); > >>>> - apic_read(APIC_ESR); > >>>> - } > >>>> - } > >>>> - > >>>> /* > >>>> * AP might wait on cpu_callout_mask in cpu_init() with > >>>> * cpu_initialized_mask set if previous attempt to online > >>>> @@ -1118,13 +1075,6 @@ static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle, > >>>> } > >>>> } > >>>> > >>>> - if (x86_platform.legacy.warm_reset) { > >>>> - /* > >>>> - * Cleanup possible dangling ends... > >>>> - */ > >>>> - smpboot_restore_warm_reset_vector(); > >>>> - } > >>>> - > >>>> return boot_error; > >>>> } > >>> You removed x86_platform.legacy.warm_reset in the original patch, but > >>> that is missing in V2. > >> Second hunk? Or are you referring to something different? > > Removing the warm_reset field from struct x86_legacy_features. > > Ok, but that is still present as the 2nd hunk of the patch. My apologies, Gmail was hiding that section of the patch because it was a reply to the original patch. For future reference, add the version number to the title when resubmitting a patch (ie. [PATCH v2]). -- Brian Gerst