Re: [PATCH] x86/SVM: restrict hardware SSBD update upon guest VIRT_SPEC_CTRL write

2022-12-12 Thread Roger Pau Monné
On Fri, Dec 09, 2022 at 11:11:29AM +0100, Jan Beulich wrote: > On 09.12.2022 10:59, Roger Pau Monné wrote: > > On Thu, Dec 08, 2022 at 12:24:54PM +0100, Jan Beulich wrote: > >> --- a/xen/arch/x86/msr.c > >> +++ b/xen/arch/x86/msr.c > >> @@ -699,12 +699,16 @@ int guest_wrmsr(struct vcpu *v, uint32_t

Re: [PATCH] x86/SVM: restrict hardware SSBD update upon guest VIRT_SPEC_CTRL write

2022-12-09 Thread Andrew Cooper
On 09/12/2022 09:59, Roger Pau Monné wrote: > On Thu, Dec 08, 2022 at 12:24:54PM +0100, Jan Beulich wrote: >> core_set_legacy_ssbd() counts the number of times SSBD is being enabled >> via LS_CFG on a core. This assumes that calls there only occur if the >> state actually changes. While svm_ctxt_sw

Re: [PATCH] x86/SVM: restrict hardware SSBD update upon guest VIRT_SPEC_CTRL write

2022-12-09 Thread Jan Beulich
On 09.12.2022 10:59, Roger Pau Monné wrote: > On Thu, Dec 08, 2022 at 12:24:54PM +0100, Jan Beulich wrote: >> --- a/xen/arch/x86/msr.c >> +++ b/xen/arch/x86/msr.c >> @@ -699,12 +699,16 @@ int guest_wrmsr(struct vcpu *v, uint32_t >> } >> else > > I think you could turn this into a

Re: [PATCH] x86/SVM: restrict hardware SSBD update upon guest VIRT_SPEC_CTRL write

2022-12-09 Thread Roger Pau Monné
On Thu, Dec 08, 2022 at 12:24:54PM +0100, Jan Beulich wrote: > core_set_legacy_ssbd() counts the number of times SSBD is being enabled > via LS_CFG on a core. This assumes that calls there only occur if the > state actually changes. While svm_ctxt_switch_{to,from}() conform to > this, guest_wrmsr()

[PATCH] x86/SVM: restrict hardware SSBD update upon guest VIRT_SPEC_CTRL write

2022-12-08 Thread Jan Beulich
core_set_legacy_ssbd() counts the number of times SSBD is being enabled via LS_CFG on a core. This assumes that calls there only occur if the state actually changes. While svm_ctxt_switch_{to,from}() conform to this, guest_wrmsr() doesn't: It also calls the function when the bit doesn't actually ch