init_scattered_cpuid_features() changes spectre mitigation state.
Not all callers obtained spec_ctrl_mutex. Move the lock/unlock of
spec_ctrl_mutex to init_scattered_cpuid_features() rather than have
the callers obtain it. That also allows init_scattered_cpuid_features()
to serialize just the spectre state changes instead of the entire
function.
Orabug:
27625404
Signed-off-by: Chuck Anderson <chuck.anderson@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
perf_check_microcode();
/* check spec_ctrl capabilities */
- mutex_lock(&spec_ctrl_mutex);
init_scattered_cpuid_features(&boot_cpu_data);
- mutex_unlock(&spec_ctrl_mutex);
mutex_unlock(µcode_mutex);
put_online_cpus();
clear_cpu_cap(c, X86_FEATURE_STIBP);
}
+ mutex_lock(&spec_ctrl_mutex);
+
if (cpu_has(c, X86_FEATURE_IBRS)) {
set_ibrs_supported();
/*
set_ibpb_supported();
sysctl_ibpb_enabled = ibpb_inuse ? 1 : 0;
}
+
+ mutex_unlock(&spec_ctrl_mutex);
}