From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mx2.suse.de ([195.135.220.15]) by Galois.linutronix.de with esmtps (TLS1.0:DHE_RSA_CAMELLIA_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1fBgMd-0004o0-1O for speck@linutronix.de; Thu, 26 Apr 2018 14:51:08 +0200 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 63619ABDB for ; Thu, 26 Apr 2018 12:51:01 +0000 (UTC) Date: Thu, 26 Apr 2018 14:50:46 +0200 From: Borislav Petkov Subject: [MODERATED] Re: [PATCH v5 07/11] [PATCH v5 07/10] Linux Patch #7 Message-ID: <20180426125046.GI15043@pd.tnic> References: <20180426020546.201159727@localhost.localdomain> MIME-Version: 1.0 In-Reply-To: <20180426020546.201159727@localhost.localdomain> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable To: speck@linutronix.de List-ID: On Wed, Apr 25, 2018 at 10:04:22PM -0400, speck for konrad.wilk_at_oracle.com= wrote: > diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c > index dff706bba3aa..99cdd44c20bc 100644 > --- a/arch/x86/kernel/cpu/bugs.c > +++ b/arch/x86/kernel/cpu/bugs.c > @@ -37,8 +37,6 @@ u64 __read_mostly x86_spec_ctrl_base; > =20 > void __init check_bugs(void) > { > - identify_boot_cpu(); > - > /* > * Read the SPEC_CTRL MSR to account for reserved bits which may have > * unknown values. This hunk breaks on AMD because after it I see in dmesg: [ 0.038706] Spectre V2 : Spectre mitigation: LFENCE not serializing, switc= hing to generic retpoline instead of [ 0.049074] Spectre V2 : Mitigation: Full AMD retpoline because the making LFENCE serializable bit is done in init_amd(). IOW, you need to have the following calling order: ssb_select_mitigation identify_boot_cpu spectre_v2_select_mitigation Hunk ontop: diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 289eefd6c67e..7f105f3d195a 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -50,9 +50,6 @@ void __init check_bugs(void) if (boot_cpu_has(X86_FEATURE_IBRS)) rdmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base); =20 - /* Select the proper spectre mitigation before patching alternatives */ - spectre_v2_select_mitigation(); - /* * Select proper mitigation for any exposure to the Speculative Store * Bypass vulnerability. @@ -60,11 +57,14 @@ void __init check_bugs(void) ssb_select_mitigation(); =20 /* - * Need to do this _after_ spec_store_bypass_select_mitigation to - * figure if any mitigation should be latched. + * Need to do this _after_ ssb_select_mitigation() to figure if any + * mitigation should be latched. */ identify_boot_cpu(); =20 + /* Select the proper spectre mitigation before patching alternatives */ + spectre_v2_select_mitigation(); + if (!IS_ENABLED(CONFIG_SMP)) { pr_info("CPU: "); print_cpu_info(&boot_cpu_data); --=20 Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imend=C3=B6rffer, Jane Smithard, Graham Norton, HR= B 21284 (AG N=C3=BCrnberg) --=20