From: Jan Beulich <jbeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>,
Xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH] x86/spec-ctrl: Support for SRSO_US_NO and SRSO_MSR_FIX
Date: Tue, 26 Mar 2024 14:15:31 +0100 [thread overview]
Message-ID: <f0eb123a-c756-4eec-944f-cc7804c7c6a0@suse.com> (raw)
In-Reply-To: <78be9d6c-2b3d-43ad-92fe-23d58767e2d6@citrix.com>
On 26.03.2024 12:33, Andrew Cooper wrote:
> On 26/03/2024 9:13 am, Jan Beulich wrote:
>> On 25.03.2024 19:18, Andrew Cooper wrote:
>>> + /* Avoid reading BP_CFG if we don't intend to change anything. */
>>> + if (!new)
>>> return;
>>>
>>> rdmsrl(MSR_AMD64_BP_CFG, val);
>>>
>>> - if (val & chickenbit)
>>> + if ((val & new) == new)
>>> return;
>> Since bits may also need turning off:
>>
>> if (!((val ^ new) & (BP_CFG_SPEC_REDUCE | (1 << 5))))
>> return;
>>
>> and the !new early-out dropped, too? Looks like this wasn't quite right
>> before, either.
>
> That's adding unnecessary complexity. It's unlikely that we'll ever
> need to clear bits like this.
Okay. Half a sentence in a comment would be nice, to make clear the
behavior is intended to only ever set bits.
>>> @@ -1078,22 +1082,41 @@ static void __init ibpb_calculations(void)
>>> * Confusion. Mitigate with IBPB-on-entry.
>>> */
>>> if ( !boot_cpu_has(X86_FEATURE_BTC_NO) )
>>> - def_ibpb_entry = true;
>>> + def_ibpb_entry_pv = def_ibpb_entry_hvm = true;
>>>
>>> /*
>>> - * Further to BTC, Zen3/4 CPUs suffer from Speculative Return Stack
>>> - * Overflow in most configurations. Mitigate with IBPB-on-entry if we
>>> - * have the microcode that makes this an effective option.
>>> + * Further to BTC, Zen3 and later CPUs suffer from Speculative Return
>>> + * Stack Overflow in most configurations. Mitigate with IBPB-on-entry
>>> + * if we have the microcode that makes this an effective option,
>>> + * except where there are other mitigating factors available.
>>> */
>> Hmm, is "Zen3 and later" really appropriate?
>
> Yes.
>
> SRSO isn't fixed until SRSO_NO is enumerated.
IOW even on Zen5 that's going to be only by ucode update?
>>> --- a/xen/include/public/arch-x86/cpufeatureset.h
>>> +++ b/xen/include/public/arch-x86/cpufeatureset.h
>>> @@ -304,7 +304,9 @@ XEN_CPUFEATURE(FSRSC, 11*32+19) /*A Fast Short REP SCASB */
>>> XEN_CPUFEATURE(AMD_PREFETCHI, 11*32+20) /*A PREFETCHIT{0,1} Instructions */
>>> XEN_CPUFEATURE(SBPB, 11*32+27) /*A Selective Branch Predictor Barrier */
>>> XEN_CPUFEATURE(IBPB_BRTYPE, 11*32+28) /*A IBPB flushes Branch Type predictions too */
>>> -XEN_CPUFEATURE(SRSO_NO, 11*32+29) /*A Hardware not vulenrable to Speculative Return Stack Overflow */
>>> +XEN_CPUFEATURE(SRSO_NO, 11*32+29) /*A Hardware not vulnerable to Speculative Return Stack Overflow */
>>> +XEN_CPUFEATURE(SRSO_US_NO, 11*32+30) /*A Hardware not vulnerable to SRSO across the User/Supervisor boundary */
>> Can we validly expose this to 64-bit PV guests, where there's no CPL
>> boundary? Or else isn't my "x86/PV: issue branch prediction barrier
>> when switching 64-bit guest to kernel mode" needed as a prereq?
>
> Based on uarch details, if BP-SPEC-REDUCE is active, we can advertise
> SRSO_US_NO to PV guests.
Which would make it at best !A, for the PV exposure then depending on
the HVM side choice.
Jan
prev parent reply other threads:[~2024-03-26 13:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-25 18:18 [PATCH] x86/spec-ctrl: Support for SRSO_US_NO and SRSO_MSR_FIX Andrew Cooper
2024-03-26 9:13 ` Jan Beulich
2024-03-26 11:33 ` Andrew Cooper
2024-03-26 13:15 ` Jan Beulich [this message]
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=f0eb123a-c756-4eec-944f-cc7804c7c6a0@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=roger.pau@citrix.com \
--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.