[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220228163713.5eewdwcqhmulsp4z@black.fi.intel.com>
Date: Mon, 28 Feb 2022 19:37:13 +0300
From: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
To: Dan Williams <dan.j.williams@...el.com>
Cc: Josh Poimboeuf <jpoimboe@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...el.com>,
Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Andi Kleen <ak@...ux.intel.com>,
David Hildenbrand <david@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, Juergen Gross <jgross@...e.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
Kuppuswamy Sathyanarayanan <knsathya@...nel.org>,
Paolo Bonzini <pbonzini@...hat.com>, sdeep@...are.com,
Sean Christopherson <seanjc@...gle.com>,
"Luck, Tony" <tony.luck@...el.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Tom Lendacky <thomas.lendacky@....com>,
Brijesh Singh <brijesh.singh@....com>, X86 ML <x86@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCHv4 29/30] ACPICA: Avoid cache flush on TDX guest
On Sun, Feb 27, 2022 at 05:34:45PM -0800, Dan Williams wrote:
> On Sun, Feb 27, 2022 at 2:05 PM Josh Poimboeuf <jpoimboe@...hat.com> wrote:
> >
> > On Thu, Feb 24, 2022 at 06:56:29PM +0300, Kirill A. Shutemov wrote:
> > > +/*
> > > + * ACPI_FLUSH_CPU_CACHE() flushes caches on entering sleep states.
> > > + * It is required to prevent data loss.
> > > + *
> > > + * While running inside TDX guest, 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.
> > > + *
> > > + * TODO: Is it safe to generalize this from TDX guests to all guest kernels?
> > > + */
> > > +#define ACPI_FLUSH_CPU_CACHE() \
> > > +do { \
> > > + if (!cpu_feature_enabled(X86_FEATURE_TDX_GUEST)) \
> > > + wbinvd(); \
> > > +} while (0)
> >
> > If it's safe, why not do it for all VMs? Is there something specific
> > about TDX which makes this more obviously known to be safe than for
> > regular VMs?
> >
> > The patch description and the above comment make it sound like "we're
> > not really sure this is safe, so we'll just use TDX as a testing ground
> > for the idea." Which doesn't really inspire a lot of confidence in the
> > stability of TD sleep states.
>
> Agree, why is this marked as "TODO"? The cache flushes associated with
> ACPI sleep states are to flush cache before bare metal power loss to
> CPU caches and bare metal transition of DDR in self-refresh mode. If a
> cache flush is required it is the responsibility of the hypervisor.
> Either it is safe for all guests or it is unsafe for all guests, not
> TD specific.
Do we have "any VM" check? I can't find it right away.
--
Kirill A. Shutemov
Powered by blists - more mailing lists