[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 4/9] x86/spec-ctrl: Don't use spec_ctrl_{enter,exit}_idle() for S3
- To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
- Date: Sat, 29 Jan 2022 01:09:15 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=QnKEPdCpG8jWWcCViSR22MoKTp3jDlGlpgl3YtgJBj4=; b=FInQseF98iyYKCt5vk3hFglpnqA2FYWckTiHGEnNMugAga3kFAUVjEoAEUjZw/rGVTjgEwEJF3luhYU5Ykc3823+TlAXZCrzeikdPeFy3CLFox/X8LgMnUL3XX/XzcZw8TXOXALEzgfvymft5XaUDJlimZLfdzZo3QHhWWa79+INYt2R8ikO6rf3meOSVg4v73c3cPZREquMGrmoWjlpjum48mtrZrJt2vbF1NX5479RGfW96aLfCw984HZjKWq1LhPPjAJV5zw/ma3uSWrwSfYZJg5uh/tFGDgnZJ4Um6OVbTD1AyOQ2GJQiHEawHJ4ISzGJPxBFHwDtVNNvhClyw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ItKzzg8PFopGq2LbGH0Np8izHdjpE4AhbFwuC8s5Yg+ZZ2X+ce4fRszG9SqUs6IjKzq0rz7uLab4fDEJzxOltCcs1gaDsoVgMOuGcysh8nQAcXBQLZd2HerNjsZQaTszQDk+Am0sSsY4GNsaaX26JU+s7H3MR89BNqUpj90SpkES22yaJHNYcgjhhKSZspvOqpeY8gokDnvWDniPVI0pujxBWsSZqc0qJ147V0X4LQfk8DRyuDAA7eNNas/vh8P70lj033llysQ1lntayKOvInFyMLdOutlmISk9psH0GiMTL8DjdcL324sqWZpIplcVs5Zo9lyfyw4BoxUL5MXLow==
- Authentication-results: esa5.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
- Cc: Jan Beulich <JBeulich@xxxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
- Delivery-date: Sat, 29 Jan 2022 01:09:48 +0000
- Ironport-data: A9a23:5ouYfK9DsbYQqWzten6+DrUDbXmTJUtcMsCJ2f8bNWPcYEJGY0x3m GZNWDyAO/jZNzbyLo10PNmx9h8F7JLQx4IyHgA4pCw8E34SpcT7XtnIdU2Y0wF+jyHgoOCLy +1EN7Es+ehtFie0Si9AttENlFEkvU2ybuOU5NXsZ2YhFWeIdA970Ug5w7dj0tY16TSEK1jlV e3a8pW31GCNg1aYAkpMg05UgEoy1BhakGpwUm0WPZinjneH/5UmJMt3yZWKB2n5WuFp8tuSH I4v+l0bElTxpH/BAvv9+lryn9ZjrrT6ZWBigVIOM0Sub4QrSoXfHc/XOdJFAXq7hQllkPhex YRiqaerZTsoGZSVv/kEeShHOHthaPguFL/veRBTsOSWxkzCNXDt3+9vHAc9OohwFuRfWD8Us 6ZCcXZUM07F17neLLGTE4GAguwKKsXxMZxZkXZn1TzDVt4tQIzZQrWM7thdtNs1rp4UQaeDP pNIAdZpRAjKYg1FBQ8rMZE3trmmhj6nNB93ll3A8MLb5ECMlVcsgdABKuH9ZdiiVchT2EGCq Qru3U70HxUbP9y30iee/zSngeqntTP2XsceGaO18tZugUaP3SoDBRsOT1y5rPKlzEmkVLpix 1c8o3R06/JorQryE4e7D0bQTGO4UgA0dNcBPPEB8y2xy43tuiGEH0I1URUbd4lz3CMpfgAC2 liMltLvIDVgtryJVH6QnoupQSOO1Ts9djFbO3JdJecRy5y6+dxo0EqTJjp2OPPt1rX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urtbLcBQGDxko5E2lljWz8oP3FBCew1M3Ty5P6a1Kyx mHryXJooGY992rwB7V0GHeq75MnsH699dFDMuQzuAINzTXjBqybogJYczBgNl1mpDr1L8Zqq iKn/4SBbU015oXRBDtnfLZ4Xil7N/p0Q679bbXuwq5nSWzfkNENyMIv/MmTvKe0Tt8gDg06t M644rS3aAnfC/ojWDz4cPFWAptkVfxqX0+kfQLh3gaSocGbqRNxLZvtn+9Pa1wVB4S0rpXW9 WGzfuskMp+YBefdTTUr2NvyNujUjA6GQqHWFELvoiQ3yJNlH50wkMEzIhH901wuK4VWt1B/a DJI65onLZBQosfar98Hv4IRY+yBnbWSRzBPWqOKRDsFb0BOXjKt5nriY9Fqd2CadgN1t8/iZ 7BWFRXuSo7fF/vE9SH2NlR/hXEUAyGLH3QIwFllu5EU5HHNcjW2By4OScTepGb0oYi6+XgKo OOBK4=
- Ironport-sdr: yH9fWa9XX1qavvS4oDbJvQbJnqBZ9fea/tojkOL9ZVCUCwPEHwjiV2o/Qj/7PoG0PhdFgdTYBj BNrJFLN++H7JmPxtQHl1TFIMQvqNdVBY3VCx2Bkq/3+TuhHyBiCoLEnc2sT/HJv+60kpQ9o3pk hkGlVO+Myyn1/k3QTPk+0YTcse+NBPnpIK3ektIzixVGzqOuQA3frl8ks840CljsJbx/s6fM8o NifuE/PzDpNtDWVLCCqf95RAGt+OUk6T3m80/DkrWufzrgvLJQ3GfEu6yukJKgAR36GH8FKpVa 1t/1LZoIEqS9HWXm6TH7SZF6
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHYFEslNylcZ92lUUmGXdMcKHF6zqx5MROA
- Thread-topic: [PATCH v2 4/9] x86/spec-ctrl: Don't use spec_ctrl_{enter,exit}_idle() for S3
On 28/01/2022 13:29, Andrew Cooper wrote:
> 'idle' here refers to hlt/mwait. The S3 path isn't an idle path - it is a
> platform reset.
>
> Conditionally clearing IBRS and flushing the store buffers on the way down is
> a waste of time.
>
> Furthermore, we want to load default_xen_mcu_opt_ctrl unilaterally on the way
> back up. Currently it happens as a side effect of X86_FEATURE_SC_MSR_IDLE or
> the next return-to-guest, but that's fragile behaviour.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> ---
> CC: Jan Beulich <JBeulich@xxxxxxxx>
> CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> CC: Wei Liu <wl@xxxxxxx>
>
> v2:
> * New
> ---
> xen/arch/x86/acpi/power.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
> index 31a56f02d083..ea2bd8bbfe93 100644
> --- a/xen/arch/x86/acpi/power.c
> +++ b/xen/arch/x86/acpi/power.c
> @@ -248,7 +248,6 @@ static int enter_state(u32 state)
> error = 0;
>
> ci = get_cpu_info();
> - spec_ctrl_enter_idle(ci);
> /* Avoid NMI/#MC using MSR_SPEC_CTRL until we've reloaded microcode. */
> ci->spec_ctrl_flags &= ~SCF_ist_wrmsr;
>
> @@ -295,7 +294,9 @@ static int enter_state(u32 state)
>
> /* Re-enabled default NMI/#MC use of MSR_SPEC_CTRL. */
> ci->spec_ctrl_flags |= (default_spec_ctrl_flags & SCF_ist_wrmsr);
> - spec_ctrl_exit_idle(ci);
> +
> + if ( boot_cpu_has(X86_FEATURE_IBRSB) )
> + wrmsrl(MSR_SPEC_CTRL, default_xen_mcu_opt_ctrl);
This logic works rather better when it gets the right variable.
default_xen_spec_ctrl.
~Andrew
>
> if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
> wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
|