lkml.org 
[lkml]   [2017]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Part1 PATCH v6 16/17] X86/KVM: Decrypt shared per-cpu variables when SEV is active
On Tue, Oct 17, 2017 at 10:42:45AM -0500, Brijesh Singh wrote:
> OK, this goes back to your initial feedback during RFC v3 where I tried
> to do similar thing. But since sev_map_percpu_data() uses __init
> functions hence we need to mark the kvm_guest_cpu_init() as __ref but
> you didn't like the idea and asked me to call the sev_map_percpu_data
> from kvm_smp_prepare_boot_cpu() which is already __init.

So looking at this more, I'm wondering how did I miss this: this whole
SEV code doesn't belong in kvm.c but in svm.c! This is AMD-only and
should be there.

Now, for that you need those three percpu variables to not be static but
I think we can do this by adding their declarations to a kvm-internal.h
header which is in arch/x86/kernel/kvm-internal.h, i.e., not in the
include path and only kvm-related units can include it.

@Paolo: thoughts?

Then, you can call sev_map_percpu_data() during module init, i.e.,
svm_init(). Or in one of the init functions you're adding later,
sev_hardware_setup() for example, or so. I.e., one of those init paths.
Because, AFAICT, you want to clear the physical C-bit only once in the
percpu pages.

I think this is much better than the "grafted" situation now.

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

\
 
 \ /
  Last update: 2017-10-17 18:23    [W:0.050 / U:9.192 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site