[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/4] x86/spec-ctrl: Synthesize RSBA/RRSBA bits with older microcode
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- Date: Tue, 30 May 2023 11:00:54 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yOt5yhWUZyOGvdUK1BpYksoi5YdvLivI4nWrbB08dww=; b=kp4I1MwKzcNHjRTO4FAVP3734NMgqHjPFUzEx3bMGAueQjTezOKMOPnaS6vbho5ivRBcSfiZRaAyKOa9ksB/DARfc4LFQVdfCvheY+0xTRbQ49m/qBvscFEhbPIUaMHo+DPdboZo7bmuoIOtQtwBGMC/euzVWitUkwEiJXwyeoOr8NzSQWasjOjo+8ebt2a2ZlnwJiNptToaU5L5NODF4sh3RsQILBd2PrY/GcrnGOTVDhYzAm40SmvBF+RQ4z7IEOCBILd4ZqMmhOljyyE1rJbuFsAQFywbtTOgyuE4FmNKkDuUvOmZ+Mn8kHhcnEQ8z8e/L0SH4PoYNgCWB7RaTw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hLl+N8kkucjPmlXl9fjHW6OoeHY4PRVk3fcYn2SalKj5BXAFsHrpV3gZ5EWj5rS5OSZ72w60R7FhLnrX4oelRTs+8pvGYBiBvrY+JNJzeXgE2dmN8syffaXKh7dKv8MXSmbYcFG0aLjRR7y910Ugb/bB49JRaZYGiHP15vnfPMrwsZXeSeEtY5hhZ+Gb/pfqiECFPopd+eBq+vZpKuSogNgO34p2jpNVIPEmWr2z6yyckI9gPXfLkiYaEKOe+2IiSFOcIKYUTvwbIoA2CMP7eXWWMGdsVADtvbw6H3vGFmYOzPXuTIKtDrL1Cgudf0ZIPMT0vyv5uERlyjttkTSBCA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Tue, 30 May 2023 10:01:21 +0000
- Ironport-data: A9a23:2JW7i6DOXFK80xVW/wTiw5YqxClBgxIJ4kV8jS/XYbTApD0m0TQOn TEXW2jUPv6CNmb8L9F2aonkoBsFsZWBmN5gQQY4rX1jcSlH+JHPbTi7wuUcHAvJd5GeExg3h yk6QoOdRCzhZiaE/n9BCpC48T8nk/nOHuGmYAL9EngZbRd+Tys8gg5Ulec8g4p56fC0GArIs t7pyyHlEAbNNwVcbCRMs8pvlDs15K6p4G5D5gRnDRx2lAS2e0c9Xcp3yZ6ZdxMUcqEMdsamS uDKyq2O/2+x13/B3fv8z94X2mVTKlLjFVDmZkh+AsBOsTAbzsAG6Y4pNeJ0VKtio27hc+ada jl6ncfYpQ8BZsUgkQmGOvVSO3kW0aZuoNcrLZUj2CA6IoKvn3bEmp1T4E8K0YIw4P58AEh36 qYkOWoydVeNvMKNwpeyc7w57igjBJGD0II3nFhFlW2cKMl8BJfJTuPN+MNS2yo2ioZWB/HCa sEFaD1pKhPdfxlIPVRRA5U79AuqriCnL3sE9xTK/uxuvDa7IA9ZidABNPL8fNCQSNoTtUGfv m/cpEzyAw0ANczZwj2Amp6prraWxnikCN9ITNVU8NZz3QSdy0kNLicUcnC1jfe9zXGgfeBQf hl8Fi0G6PJaGFaQZtv3UgC8oXWElgUBQNcWGOo/gCmSzoLE7gDfAXILJhZRZdpjuMIoSDgC0 l6Sg8ivFTFpqKeSS3+W6vGTtzzaBMQOBWoLZCtBSBRf5dDm+N03lkiWEYglF7OphNroHz222 yqNsCU1m7QUi4gMyrm/+lfExTmro/AlUzII2+keZUr9hisRWWJvT9XABYTzhRqYELukcw==
- Ironport-hdrordr: A9a23:AoPpda5R/p6IxFX1bAPXwMzXdLJyesId70hD6qkXc3Bom62j+P xG+c5x6faaslgssR0b+OxoWpPwIk80hKQU3WB5B97LNmTbUQCTXeNfBOXZslndMhy72ulB1b pxN4hSYeeAamSSVPyKhTWFLw==
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 30/05/2023 10:18 am, Jan Beulich wrote:
> On 26.05.2023 13:06, Andrew Cooper wrote:
>> @@ -687,6 +697,32 @@ static bool __init retpoline_calculations(void)
>> if ( safe )
>> return true;
>>
>> + /*
>> + * The meaning of the RSBA and RRSBA bits have evolved over time. The
>> + * agreed upon meaning at the time of writing (May 2023) is thus:
>> + *
>> + * - RSBA (RSB Alterantive) means that an RSB may fall back to an
>> + * alternative predictor on underflow. Skylake uarch and later all
>> have
>> + * this property. Broadwell too, when running microcode versions
>> prior
>> + * to Jan 2018.
>> + *
>> + * - All eIBRS-capable processors suffer RSBA, but eIBRS also introduces
>> + * tagging of predictions with the mode in which they were learned.
>> So
>> + * when eIBRS is active, RSBA becomes RRSBA (Restricted RSBA).
>> + *
>> + * Some parts (Broadwell) are not expected to ever enumerate this
>> + * behaviour directly. Other parts have differing enumeration with
>> + * microcode version. Fix up Xen's idea, so we can advertise them
>> safely
>> + * to guests, and so toolstacks can level a VM safelty for migration.
>> + */
> If the difference between the two is whether eIBRS is active (as you did
> word it yet more explicitly in e.g. [1]), then ...
>
>> + unsafe_maybe_fixup_rrsba:
>> + if ( !cpu_has_rrsba )
>> + setup_force_cpu_cap(X86_FEATURE_RRSBA);
>> +
>> + unsafe_maybe_fixup_rsba:
>> + if ( !cpu_has_rsba )
>> + setup_force_cpu_cap(X86_FEATURE_RSBA);
>> +
>> return false;
>> }
> ... can both actually be active at the same time? IOW is there a "return
> false" missing ahead of the 2nd label?
I've already got a question out to Intel to this effect. (I didn't say
the enumeration made much sense...)
> Not having looked at further patches yet it also strikes me as odd that
> each of the two labels is used exactly once only. Leaving the shared
> comment aside, imo this would then better avoid "goto".
They're both used twice, not once. You asked why it wasn't "return
safe;" in the previous patch? Well this is why.
> Finally, what use are the two if()s? There's nothing wrong with forcing
> a feature which is already available.
It breaks is_forced_cpu_cap().
Also, I considered having a printk() here. I've still got it around in
a debug patch, but I decided against it.
~Andrew
|