From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from p4fea4eb5.dip0.t-ipconnect.de ([79.234.78.181] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fGuyG-0006A2-6u for speck@linutronix.de; Fri, 11 May 2018 01:27:36 +0200 Date: Fri, 11 May 2018 01:27:35 +0200 (CEST) From: Thomas Gleixner Subject: Re: [PATCH v4 5/8] L1TFv4 8 In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: > +ssize_t cpu_show_l1tf(struct device *dev, struct device_attribute *attr, char *buf) > +{ > + if (!boot_cpu_has_bug(X86_BUG_L1TF)) > + return sprintf(buf, "Not affected\n"); > + > + if (boot_cpu_has(X86_FEATURE_L1TF_WA)) > + return sprintf(buf, "Mitigated\n"); > + > + return sprintf(buf, "Mitigation Unavailable\n"); That's 'Vulnerable' for all other issues, so please make it consistent. > +static bool __init l1tf_wa_possible(void) > +{ > +#if CONFIG_PGTABLE_LEVELS == 2 > + pr_warn("Kernel not compiled for PAE. No workaround for L1TF\n"); > + return false; > +#endif > + return true; > +} > + > /* > * Do minimum CPU detection early. > * Fields really needed: vendor, cpuid_level, family, model, mask, > @@ -989,8 +998,12 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c) > setup_force_cpu_cap(X86_FEATURE_ALWAYS); > > if (!x86_match_cpu(cpu_no_speculation)) { > - if (cpu_vulnerable_to_meltdown(c)) > + if (cpu_vulnerable_to_meltdown(c)) { > setup_force_cpu_bug(X86_BUG_CPU_MELTDOWN); > + setup_force_cpu_bug(X86_BUG_L1TF); > + if (l1tf_wa_possible()) > + setup_force_cpu_cap(X86_FEATURE_L1TF_WA); That extra indirection is pointless. static void __init l1tf_init_workaround(void) { #if CONFIG_PGTABLE_LEVELS == 2 pr_warn("Kernel not compiled for PAE. No workaround for L1TF\n"); #else setup_force_cpu_cap(X86_FEATURE_L1TF_WA); #endif } Hmm? > +ssize_t __weak cpu_show_l1tf(struct device *dev, > + struct device_attribute *attr, char *buf) Please align the arguments in the second row in the same way as all other weak functions do. Thanks, tglx