[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9da5204f-5c8f-b47b-bcc6-d68ca63db08d@amd.com>
Date: Fri, 29 Jul 2022 09:25:20 -0500
From: Tom Lendacky <thomas.lendacky@....com>
To: Dave Hansen <dave.hansen@...el.com>, linux-kernel@...r.kernel.org,
x86@...nel.org
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"Kirill A. Shutemov" <kirill@...temov.name>,
"H. Peter Anvin" <hpa@...or.com>,
Michael Roth <michael.roth@....com>,
Joerg Roedel <jroedel@...e.de>,
Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH v1 1/2] x86/sev: Use per-CPU PSC structure in prep for
unaccepted memory support
On 7/29/22 09:18, Dave Hansen wrote:
> On 7/29/22 07:01, Tom Lendacky wrote:
>> diff --git a/arch/x86/kernel/sev.c b/arch/x86/kernel/sev.c
>> index c05f0124c410..1f7f6205c4f6 100644
>> --- a/arch/x86/kernel/sev.c
>> +++ b/arch/x86/kernel/sev.c
>> @@ -104,6 +104,15 @@ struct sev_es_runtime_data {
>> * is currently unsupported in SEV-ES guests.
>> */
>> unsigned long dr7;
>> +
>> + /*
>> + * Page State Change structure for use when accepting memory or when
>> + * changing page state. Interrupts are disabled when using the structure
>> + * but an NMI could still be raised, so use a flag to indicate when the
>> + * structure is in use and use the MSR protocol in these cases.
>> + */
>> + struct snp_psc_desc psc_desc;
>> + bool psc_active;
>> };
>
> This thing:
>
> struct snp_psc_desc {
> struct psc_hdr hdr;
> struct psc_entry entries[VMGEXIT_PSC_MAX_ENTRY];
> } __packed;
>
> is 16k, right? Being per-cpu, this might eat up a MB or two of memory
> on a big server?
It's just under 2K, 2,032 bytes.
>
> Considering that runtime acceptance is already single-threaded[1] *and*
> there's a fallback method, why not just have a single copy of this
> guarded by a single lock?
This function is called for more than just memory acceptance. It's also
called for any changes from or to private or shared, which isn't
single-threaded.
Thanks,
Tom
>
> 1.
> https://lore.kernel.org/all/20220614120231.48165-10-kirill.shutemov@linux.intel.com/
Powered by blists - more mailing lists