[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b1a8aed8-6f57-18cf-94b6-58b4ec1563de@amd.com>
Date: Tue, 19 Sep 2017 09:00:39 -0500
From: Brijesh Singh <brijesh.singh@....com>
To: Borislav Petkov <bp@...e.de>
Cc: brijesh.singh@....com, linux-kernel@...r.kernel.org,
x86@...nel.org, kvm@...r.kernel.org,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H . Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...nel.org>,
Tom Lendacky <thomas.lendacky@....com>,
Paolo Bonzini <pbonzini@...hat.com>,
Radim Krčmář <rkrcmar@...hat.com>
Subject: Re: [Part1 PATCH v4 16/17] X86/KVM: Unencrypt shared per-cpu
variables when SEV is active
On 09/19/2017 06:06 AM, Borislav Petkov wrote:
...
>> + unsigned long pa = slow_virt_to_phys(var);
>> +
>> + /* decrypt the memory in-place */
>> + sme_early_decrypt(pa, size);
>> +
>> + /* clear the C-bit from the page table */
>> + early_set_memory_decrypted(pa, size);
>
> So those two do a lot of work like TLB flushing and WBINVD for each
> per-CPU variable and normally I'd say you do this on one go instead of
> variable per variable and thus save yourself the subsequent expensive
> invalidation calls but we do it once only during boot so maybe something
> to think about later, when there's more time and boredom.
>
> :)
Yes, we can revisit it later to optimize it.
...
>
> Let it stick out and shorten function name:
>
> for_each_possible_cpu(cpu) {
> __set_percpu_decrypted(&per_cpu(apf_reason, cpu), sizeof(struct kvm_vcpu_pv_apf_data));
> __set_percpu_decrypted(&per_cpu(steal_time, cpu), sizeof(struct kvm_steal_time));
> __set_percpu_decrypted(&per_cpu(kvm_apic_eoi, cpu), sizeof(unsigned long));
> }
>
> Also, we agreed to call everything that's not encrypted "decrypted" so
> that we have only two different states: encrypted and decrypted and thus
> less confusion.
Will do.
Powered by blists - more mailing lists