[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220826064418.GF2538772@ls.amr.corp.intel.com>
Date: Thu, 25 Aug 2022 23:44:18 -0700
From: Isaku Yamahata <isaku.yamahata@...il.com>
To: Erdem Aktas <erdemaktas@...gle.com>
Cc: "Yamahata, Isaku" <isaku.yamahata@...el.com>,
"open list:KERNEL VIRTUAL MACHINE (KVM)" <kvm@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>,
Isaku Yamahata <isaku.yamahata@...il.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <seanjc@...gle.com>,
Sagi Shahar <sagis@...gle.com>
Subject: Re: [PATCH v8 020/103] KVM: TDX: create/destroy VM structure
On Tue, Aug 23, 2022 at 05:53:00PM -0700,
Erdem Aktas <erdemaktas@...gle.com> wrote:
> On Sun, Aug 7, 2022 at 3:03 PM <isaku.yamahata@...el.com> wrote:
> > +static void tdx_clear_page(unsigned long page)
> > +{
> > + const void *zero_page = (const void *) __va(page_to_phys(ZERO_PAGE(0)));
> > + unsigned long i;
> > +
> > + /*
> > + * Zeroing the page is only necessary for systems with MKTME-i:
> > + * when re-assign one page from old keyid to a new keyid, MOVDIR64B is
> > + * required to clear/write the page with new keyid to prevent integrity
> > + * error when read on the page with new keyid.
> > + */
>
> Are we saying that we do not need to use MOVDIR64B to clear pages with Li?
Yes. TDX module spec, Table 15.3: Checks on Memory Reads in Li mode says that
read with shared HKID doesn't result in #MC. Read of poisoned cache line is
another story, though.
> > + if (!static_cpu_has(X86_FEATURE_MOVDIR64B))
> > + return;
> > +
> > + for (i = 0; i < 4096; i += 64)
> > + /* MOVDIR64B [rdx], es:rdi */
> > + asm (".byte 0x66, 0x0f, 0x38, 0xf8, 0x3a"
> > + : : "d" (zero_page), "D" (page + i) : "memory");
> > +}
>
> According to the Software Developer Manual, mfence is required for a
> strong ordering on stores. Should we not use mfence here?
Right. I'll add __mb(). thanks for catching it.
--
Isaku Yamahata <isaku.yamahata@...il.com>
Powered by blists - more mailing lists