[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <amk4ozai3l65d6ef3k2rsnapaislbvlwpfx7p35tqqhesmc4w7@5vmi52a3qv3o>
Date: Thu, 22 Feb 2024 12:50:11 +0200
From: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
To: Tom Lendacky <thomas.lendacky@....com>
Cc: Ashish Kalra <Ashish.Kalra@....com>, tglx@...utronix.de,
mingo@...hat.com, bp@...en8.de, dave.hansen@...ux.intel.com, luto@...nel.org,
x86@...nel.org, ardb@...nel.org, hpa@...or.com, linux-efi@...r.kernel.org,
linux-kernel@...r.kernel.org, rafael@...nel.org, peterz@...radead.org, adrian.hunter@...el.com,
sathyanarayanan.kuppuswamy@...ux.intel.com, elena.reshetova@...el.com, jun.nakajima@...el.com,
rick.p.edgecombe@...el.com, seanjc@...gle.com, kai.huang@...el.com, bhe@...hat.com,
kexec@...ts.infradead.org, linux-coco@...ts.linux.dev, anisinha@...hat.com,
michael.roth@....com, bdas@...hat.com, vkuznets@...hat.com, dionnaglaze@...gle.com,
jroedel@...e.de, ashwin.kamat@...adcom.com
Subject: Re: [PATCH 2/2] x86/snp: Convert shared memory back to private on
kexec
On Wed, Feb 21, 2024 at 02:35:13PM -0600, Tom Lendacky wrote:
> > @@ -906,6 +917,206 @@ void snp_accept_memory(phys_addr_t start, phys_addr_t end)
> > set_pages_state(vaddr, npages, SNP_PAGE_STATE_PRIVATE);
> > }
> > +static inline bool pte_decrypted(pte_t pte)
> > +{
> > + return cc_mkdec(pte_val(pte)) == pte_val(pte);
> > +}
> > +
>
> This is duplicated in TDX code, arch/x86/coco/tdx/tdx.c, looks like
> something that can go in a header file, maybe mem_encrypt.h.
>
I think <asm/pgtable.h> is a better fit.
> > +void snp_kexec_stop_conversion(bool crash)
> > +{
> > + /* Stop new private<->shared conversions */
> > + conversion_allowed = false;
> > + crash_requested = crash;
> > +
> > + /*
> > + * Make sure conversion_allowed is cleared before checking
> > + * conversions_in_progress.
> > + */
> > + barrier();
>
> This should be smp_wmb().
>
Why?
--
Kiryl Shutsemau / Kirill A. Shutemov
Powered by blists - more mailing lists