From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762294AbdJQNgE (ORCPT ); Tue, 17 Oct 2017 09:36:04 -0400 Received: from mail.skyhub.de ([5.9.137.197]:45200 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754355AbdJQNgC (ORCPT ); Tue, 17 Oct 2017 09:36:02 -0400 Date: Tue, 17 Oct 2017 15:35:55 +0200 From: Borislav Petkov To: Brijesh Singh Cc: x86@kernel.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Tom Lendacky , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [Part1 PATCH v6 16/17] X86/KVM: Decrypt shared per-cpu variables when SEV is active Message-ID: <20171017133555.de4omyuoveaijkk6@pd.tnic> References: <20171016153423.2980-1-brijesh.singh@amd.com> <20171016153423.2980-17-brijesh.singh@amd.com> <20171016222416.x26tp222x2ox3tkz@pd.tnic> <20171017082020.ctgjuo4xcvsaitdf@pd.tnic> <57ef6c36-1708-56f2-b0ac-ea2267f6aa9d@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <57ef6c36-1708-56f2-b0ac-ea2267f6aa9d@amd.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.