All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>, Wei Liu <wl@xen.org>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v5 2/3] amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guests
Date: Tue, 17 May 2022 16:46:44 +0200	[thread overview]
Message-ID: <95d9658b-dda2-0c05-297c-a75959f7653d@suse.com> (raw)
In-Reply-To: <YoOm4iVYO3jdjzw3@Air-de-Roger>

On 17.05.2022 15:45, Roger Pau Monné wrote:
> On Tue, May 17, 2022 at 02:10:29PM +0200, Jan Beulich wrote:
>> On 09.05.2022 12:23, Roger Pau Monné wrote:
>>> On Fri, May 06, 2022 at 02:15:47PM +0200, Jan Beulich wrote:
>>>> On 03.05.2022 10:26, Roger Pau Monne wrote:
>>>>> --- a/xen/arch/x86/cpuid.c
>>>>> +++ b/xen/arch/x86/cpuid.c
>>>>> @@ -541,6 +541,9 @@ static void __init calculate_hvm_max_policy(void)
>>>>>           raw_cpuid_policy.basic.sep )
>>>>>          __set_bit(X86_FEATURE_SEP, hvm_featureset);
>>>>>  
>>>>> +    if ( boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) )
>>>>> +        __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
>>>>> +
>>>>>      /*
>>>>>       * If Xen isn't virtualising MSR_SPEC_CTRL for HVM guests (functional
>>>>>       * availability, or admin choice), hide the feature.
>>>>
>>>> Especially with the setting of VIRT_SSBD below here (from patch 1) I
>>>> don't think this can go without comment. The more that the other
>>>> instance ...
>>>>
>>>>> @@ -597,6 +600,13 @@ static void __init calculate_hvm_def_policy(void)
>>>>>      guest_common_feature_adjustments(hvm_featureset);
>>>>>      guest_common_default_feature_adjustments(hvm_featureset);
>>>>>  
>>>>> +    /*
>>>>> +     * Only expose VIRT_SSBD if AMD_SSBD is not available, and thus
>>>>> +     * VIRT_SC_MSR_HVM is set.
>>>>> +     */
>>>>> +    if ( boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) )
>>>>> +        __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
>>>>> +
>>>>>      sanitise_featureset(hvm_featureset);
>>>>>      cpuid_featureset_to_policy(hvm_featureset, p);
>>>>>      recalculate_xstate(p);
>>>>
>>>> ... here is about default exposure, so cannot really be extended to
>>>> the condition under which this is put in "max" (except that of course
>>>> "max" needs to include everything "def" has).
>>>
>>> Would you be OK with adding:
>>>
>>>     /*
>>>      * VIRT_SC_MSR_HVM ensures the selection of SSBD is context
>>>      * switched between the hypervisor and guest selected values for
>>>      * HVM when the platform doesn't expose AMD_SSBD support.
>>>      */
>>
>> I'm afraid this doesn't explain what I'm after. In
>> calculate_hvm_def_policy() the comment explains why / when the feature
>> is exposed by _default_. Taking into account patch 1 (where another
>> maximum exposure of the feature was introduced), I'd like the
>> comment in calculate_hvm_max_policy() to focus on the difference
>> between default and maximum exposure (which could be as simple as "if
>> exposed by default, also needs exposing in max, irrespective of the
>> further max exposure below(?)").
> 
> So something like:
> 
> /*
>  * When VIRT_SSBD is exposed in the default policy as a result of
>  * VIRT_SC_MSR_HVM being set  also needs exposing in the max policy.
>  */
> 
> Would address your concerns?

Yes (with - nit - the double blank dealt with, perhaps by inserting
"it" and maybe a comma).

Jan



  reply	other threads:[~2022-05-17 14:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03  8:26 [PATCH v5 0/3] amd/msr: implement MSR_VIRT_SPEC_CTRL for HVM guests Roger Pau Monne
2022-05-03  8:26 ` [PATCH v5 1/3] amd/msr: implement VIRT_SPEC_CTRL for HVM guests on top of SPEC_CTRL Roger Pau Monne
2022-05-03  8:26 ` [PATCH v5 2/3] amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guests Roger Pau Monne
2022-05-06 12:15   ` Jan Beulich
2022-05-09 10:23     ` Roger Pau Monné
2022-05-17 12:10       ` Jan Beulich
2022-05-17 13:45         ` Roger Pau Monné
2022-05-17 14:46           ` Jan Beulich [this message]
2022-05-03  8:26 ` [PATCH v5 3/3] amd/msr: implement VIRT_SPEC_CTRL for HVM guests using legacy SSBD Roger Pau Monne
2022-05-06 12:41   ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=95d9658b-dda2-0c05-297c-a75959f7653d@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.