* [PATCH] x86: correct default_xen_spec_ctrl calculation
@ 2018-05-25 11:08 Jan Beulich
2018-05-25 12:53 ` Andrew Cooper
0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2018-05-25 11:08 UTC (permalink / raw)
To: xen-devel; +Cc: Juergen Gross, Andrew Cooper
Even with opt_msr_sc_{pv,hvm} both false we should set up the variable
as usual, to ensure proper one-time setup during boot and CPU bringup.
This then also brings the code in line with the comment immediately
ahead of the printk() being modified saying "irrespective of guests".
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -195,8 +195,6 @@ custom_param("spec-ctrl", parse_spec_ctr
static void __init print_details(enum ind_thunk thunk, uint64_t caps)
{
- bool use_spec_ctrl = (boot_cpu_has(X86_FEATURE_SC_MSR_PV) ||
- boot_cpu_has(X86_FEATURE_SC_MSR_HVM));
unsigned int _7d0 = 0, e8b = 0, tmp;
/* Collect diagnostics about available mitigations. */
@@ -228,10 +226,9 @@ static void __init print_details(enum in
thunk == THUNK_RETPOLINE ? "RETPOLINE" :
thunk == THUNK_LFENCE ? "LFENCE" :
thunk == THUNK_JMP ? "JMP" : "?",
- !use_spec_ctrl ? "No" :
- (default_xen_spec_ctrl & SPEC_CTRL_IBRS) ? "IBRS+" : "IBRS-",
- !use_spec_ctrl || !boot_cpu_has(X86_FEATURE_SSBD)
- ? "" :
+ !boot_cpu_has(X86_FEATURE_IBRSB) ? "No" :
+ (default_xen_spec_ctrl & SPEC_CTRL_IBRS) ? "IBRS+" : "IBRS-",
+ !boot_cpu_has(X86_FEATURE_SSBD) ? "" :
(default_xen_spec_ctrl & SPEC_CTRL_SSBD) ? " SSBD+" : " SSBD-",
opt_ibpb ? " IBPB" : "");
@@ -493,16 +490,14 @@ void __init init_speculation_mitigations
}
if ( use_spec_ctrl )
- {
- if ( ibrs )
- default_xen_spec_ctrl |= SPEC_CTRL_IBRS;
-
default_spec_ctrl_flags |= SCF_ist_wrmsr;
- }
+
+ if ( ibrs )
+ default_xen_spec_ctrl |= SPEC_CTRL_IBRS;
}
/* If we have SSBD available, see whether we should use it. */
- if ( boot_cpu_has(X86_FEATURE_SSBD) && use_spec_ctrl && opt_ssbd )
+ if ( boot_cpu_has(X86_FEATURE_SSBD) && opt_ssbd )
default_xen_spec_ctrl |= SPEC_CTRL_SSBD;
/*
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: correct default_xen_spec_ctrl calculation
2018-05-25 11:08 [PATCH] x86: correct default_xen_spec_ctrl calculation Jan Beulich
@ 2018-05-25 12:53 ` Andrew Cooper
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2018-05-25 12:53 UTC (permalink / raw)
To: Jan Beulich, xen-devel; +Cc: Juergen Gross
On 25/05/18 12:08, Jan Beulich wrote:
> Even with opt_msr_sc_{pv,hvm} both false we should set up the variable
> as usual, to ensure proper one-time setup during boot and CPU bringup.
> This then also brings the code in line with the comment immediately
> ahead of the printk() being modified saying "irrespective of guests".
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Hmm yes - I think the logic here got a bit tangled over the course of
development.
AFAICT, this should work, so tentatively Reviewed-by: Andrew Cooper
<andrew.cooper3@citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: correct default_xen_spec_ctrl calculation
[not found] <5B07EE9702000078001C5E5B@suse.com>
@ 2018-05-29 10:12 ` Juergen Gross
0 siblings, 0 replies; 3+ messages in thread
From: Juergen Gross @ 2018-05-29 10:12 UTC (permalink / raw)
To: Jan Beulich, xen-devel; +Cc: Andrew Cooper
On 25/05/18 13:08, Jan Beulich wrote:
> Even with opt_msr_sc_{pv,hvm} both false we should set up the variable
> as usual, to ensure proper one-time setup during boot and CPU bringup.
> This then also brings the code in line with the comment immediately
> ahead of the printk() being modified saying "irrespective of guests".
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
Juergen
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-29 10:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-25 11:08 [PATCH] x86: correct default_xen_spec_ctrl calculation Jan Beulich
2018-05-25 12:53 ` Andrew Cooper
[not found] <5B07EE9702000078001C5E5B@suse.com>
2018-05-29 10:12 ` Juergen Gross
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.