[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YKxK4jD2mhfDmOYf@google.com>
Date: Tue, 25 May 2021 00:54:58 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Dan Williams <dan.j.williams@...el.com>
Cc: "Kuppuswamy, Sathyanarayanan"
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Andy Lutomirski <luto@...nel.org>,
Dave Hansen <dave.hansen@...el.com>,
Tony Luck <tony.luck@...el.com>,
Andi Kleen <ak@...ux.intel.com>,
Kirill Shutemov <kirill.shutemov@...ux.intel.com>,
Kuppuswamy Sathyanarayanan <knsathya@...nel.org>,
Raj Ashok <ashok.raj@...el.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [RFC v2-fix-v2 2/2] x86/tdx: Ignore WBINVD instruction for TDX
guest
On Mon, May 24, 2021, Dan Williams wrote:
> On Mon, May 24, 2021 at 5:30 PM Kuppuswamy, Sathyanarayanan
> <sathyanarayanan.kuppuswamy@...ux.intel.com> wrote:
> >
> >
> >
> > On 5/24/21 4:39 PM, Dan Williams wrote:
> > >> Functionally only DMA devices can notice a side effect from
> > >> WBINVD's cache flushing. But, TDX does not support DMA,
> > >> because DMA typically needs uncached access for MMIO, and
> > >> the current TDX module always sets the IgnorePAT bit, which
> > >> prevents that.
> >
> > > I thought we discussed that there are other considerations for wbinvd
> > > besides DMA? In any event this paragraph is actively misleading
> > > because it disregards ACPI and Persistent Memory secure-erase whose
> > > usages of wbinvd have nothing to do with DMA. I would much prefer a
> > > patch to shutdown all the known wbinvd users as a precursor to this
> > > patch rather than assuming it's ok to simply ignore it. You have
> > > mentioned that TDX does not need to use those paths, but rather than
> > > assume they can't be used why not do the audit to explicitly disable
> > > them? Otherwise this statement seems to imply that the audit has not
> > > been done.
> >
> > But KVM also emulates WBINVD only if DMA is supported. Otherwise it
> > will be treated as noop.
> >
> > static bool need_emulate_wbinvd(struct kvm_vcpu *vcpu)
> > {
> > return kvm_arch_has_noncoherent_dma(vcpu->kvm);
> > }
>
> That makes KVM also broken for the cases where wbinvd is needed, but
> it does not make the description of this patch correct.
Yep! KVM has a long and dubious history of making things work for specific use
cases without stricitly adhering to the architecture.
KVM also has to worry about malicious/buggy guests, e.g. letting the guest do
WBINVD at will would be a massive noisy neighbor problem (at best), while
ratelimiting might unnecessarily harm legitimate use case. I.e. KVM has a
somewhat sane reason for "emulating" WBINVD as a nop.
And FWIW, IIRC all modern hardware has a coherent IOMMU, though that could be me
making things up.
Powered by blists - more mailing lists