]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
x86/cpufeatures: use cpu_data in init_scattered_cpuid_flags()
authorAnkur Arora <ankur.a.arora@oracle.com>
Wed, 25 Apr 2018 21:38:58 +0000 (17:38 -0400)
committerBrian Maly <brian.maly@oracle.com>
Tue, 8 May 2018 19:58:37 +0000 (15:58 -0400)
Post SMP init, cpu_data() contains the current cpuinfo state with
the boot_cpu_data potentially going stale.

Switch all boot_cpu_data references to cpu_data() in
init_scattered_cpuid_flags().

Orabug: 27878230

Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Reviewed-by: John Haxby <john.haxby@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
(cherry-picked from commit 6258d6d6ce2b9cf41830e8616ffc7841b3fddca9)

Conflict:
  arch/x86/kernel/cpu/common.c

[Backport: Modify init_scattered_cpuid_flags() instead of
 init_speculation_control().]

Signed-off-by: Brian Maly <brian.maly@oracle.com>
arch/x86/kernel/cpu/scattered.c

index aceb904642fa817164531e4953e02d736831bd22..4cbbf2520bddafafe4296fdbd8bed65f5116569c 100644 (file)
@@ -160,13 +160,13 @@ void init_scattered_cpuid_features(struct cpuinfo_x86 *c,
                if (xen_pv_domain())
                        ignore = true;
 
-               if (boot_cpu_has(X86_FEATURE_IBRS)) {
+               if (cpu_has(c, X86_FEATURE_IBRS)) {
                        printk_once(KERN_INFO "FEATURE SPEC_CTRL Present%s\n",
                                    ignore ? " but ignored (Xen)": "");
                } else {
                        printk(KERN_INFO "FEATURE SPEC_CTRL Not Present\n");
                }
-               if (boot_cpu_has(X86_FEATURE_IBPB)) {
+               if (cpu_has(c, X86_FEATURE_IBPB)) {
                        printk_once(KERN_INFO "FEATURE IBPB Present%s\n",
                                            ignore ? " but ignored (Xen)": "");
                } else {
@@ -178,14 +178,14 @@ void init_scattered_cpuid_features(struct cpuinfo_x86 *c,
 
        if ((cpu_has(c, X86_FEATURE_IBRS) ||
             cpu_has(c, X86_FEATURE_STIBP)) && bad_spectre_microcode(c)) {
-               if (&boot_cpu_data == c)
+               if (c->cpu_index == 0)
                        pr_warn("Intel Spectre v2 broken microcode detected; disabling SPEC_CTRL/IBRS\n");
                clear_cpu_cap(c, X86_FEATURE_IBRS);
                clear_cpu_cap(c, X86_FEATURE_IBPB);
                clear_cpu_cap(c, X86_FEATURE_STIBP);
        }
 
-       if (&boot_cpu_data == c) {
+       if (c->cpu_index == 0) {
                mutex_lock(&spec_ctrl_mutex);
                if (cpu_has(c, X86_FEATURE_IBRS)) {
                        set_ibrs_supported();