Re: [Part1 PATCH v6 16/17] X86/KVM: Decrypt shared per-cpu variables when SEV is active
From: Borislav Petkov
Date: Tue Oct 17 2017 - 09:36:09 EST
On Tue, Oct 17, 2017 at 06:54:52AM -0500, Brijesh Singh wrote:
> Will do. Do you want me to send v7 with that addressed. Because this
> require changes in 3 patches (PATCH 14, 16, 17)
Just send me those three first as a reply to the thread so that I can
test the whole queue everywhere. Or even better, point me to the v7 git
branch once you have it ready.
> The second call is for UP cases. The kvm_smp_prepapre_boot_cpu() is
> called only when CONFIG_SMP is enabled. Am I missing something ?
Yes, you are.
kvm_guest_init() gets called unconditionally from setup_arch(). But then
you said kvm_guest_init() is called before setup_per_cpu_areas() so why
do you need that call there at all? percpu areas are not ready yet, what
makes them ready in the UP case?
IOW, this sev_map_percpu_data() needs to happen only once, during boot.
So call it only once by finding the right spot and not by adding a
second call for the UP case.
AFAICT, it looks the easiest if you put it in kvm_guest_cpu_init() and
do something like:
if (smp_processor_id() == boot_cpu_data.cpu_index)
sev_map_percpu_data();
...
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.