lkml.org 
[lkml]   [2022]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCHv6 29/30] ACPICA: Avoid cache flush inside virtual machines
Date
On Wed, Mar 16 2022 at 05:08, Kirill A. Shutemov wrote:

> While running inside virtual machine, the kernel can bypass cache
> flushing. Changing sleep state in a virtual machine doesn't affect the
> host system sleep state and cannot lead to data loss.
>
> Before entering sleep states, the ACPI code flushes caches to prevent
> data loss using the WBINVD instruction. This mechanism is required on
> bare metal.
>
> But, any use WBINVD inside of a guest is worthless. Changing sleep
> state in a virtual machine doesn't affect the host system sleep state
> and cannot lead to data loss, so most hypervisors simply ignore it.
> Despite this, the ACPI code calls WBINVD unconditionally anyway.
> It's useless, but also normally harmless.
>
> In TDX guests, though, WBINVD stops being harmless; it triggers a
> virtualization exception (#VE). If the ACPI cache-flushing WBINVD
> were left in place, TDX guests would need handling to recover from
> the exception.
>
> Avoid using WBINVD whenever running under a hypervisor. This both
> removes the useless WBINVDs and saves TDX from implementing WBINVD
> handling.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>

\
 
 \ /
  Last update: 2022-03-17 16:25    [W:0.302 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site