From: Brijesh Singh <brijesh.singh@amd.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: brijesh.singh@amd.com, x86@kernel.org,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
"Tom Lendacky" <thomas.lendacky@amd.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Borislav Petkov" <bp@suse.de>, "H. Peter Anvin" <hpa@zytor.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>
Subject: Re: [PATCH v4 4/4] x86/kvm: use __decrypted attribute in shared variables
Date: Wed, 5 Sep 2018 13:09:45 -0500 [thread overview]
Message-ID: <7b004581-dfb0-1418-1252-0860e5e93cd0@amd.com> (raw)
In-Reply-To: <20180904223200.GA7248@linux.intel.com>
Hi Sean,
On 09/04/2018 05:32 PM, Sean Christopherson wrote:
...
>>
>> /* Use the static page for the first CPUs, allocate otherwise */
>> - if (cpu < HVC_BOOT_ARRAY_SIZE)
>> + if (cpu < HVC_BOOT_ARRAY_SIZE) {
>> p = &hv_clock_boot[cpu];
>> - else
>> - p = kzalloc(sizeof(*p), GFP_KERNEL);
>> + } else {
>> + int rc;
>> + unsigned int sz = sizeof(*p);
>> +
>> + if (sev_active())
>> + sz = PAGE_ALIGN(sz);
>
> Hmm, again we're wasting a fairly sizable amount of memory since each
> CPU is doing a separate 4k allocation. What if we defined an auxilary
> array in __decrypted to be used for cpus > HVC_BOOT_ARRAY_SIZE when
> SEV is active? struct pvclock_vsyscall_time_info is 32 bytes so we
> could handle the max of 8192 CPUs with 256kb of data (252kb if you
> subtract the pre-existing 4k page), i.e. the SEV case wouldn't need
> additional memory beyond the 2mb page that's reserved for __decrypted.
> The non-SEV case could do free_kernel_image_pages() on the unused
> array (which would need to be page sized) so it wouldn't waste memory.
Sure, we could use unused memory range from .data..decrypted section
for cpu > HVC_BOOT_ARRAY_SIZE when SEV is active. I will rework the
patch.
-Brijesh
prev parent reply other threads:[~2018-09-05 18:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-04 1:29 [PATCH v4 0/4] x86: Fix SEV guest regression Brijesh Singh
2018-09-04 1:29 ` [PATCH v4 1/4] x86/mm: Restructure sme_encrypt_kernel() Brijesh Singh
2018-09-04 1:29 ` [PATCH v4 2/4] x86/mm: fix sme_populate_pgd() to update page flags Brijesh Singh
2018-09-04 1:29 ` [PATCH v4 3/4] x86/mm: add .data..decrypted section to hold shared variables Brijesh Singh
2018-09-04 1:29 ` [PATCH v4 4/4] x86/kvm: use __decrypted attribute in " Brijesh Singh
2018-09-04 22:32 ` Sean Christopherson
2018-09-05 18:09 ` Brijesh Singh [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7b004581-dfb0-1418-1252-0860e5e93cd0@amd.com \
--to=brijesh.singh@amd.com \
--cc=bp@suse.de \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®