From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 23 Apr 2019 10:57:25 +0200 From: Cornelia Huck Subject: Re: [PATCH] KVM: Directly return result from kvm_arch_check_processor_compat() Message-ID: <20190423105725.73f5680e.cohuck@redhat.com> In-Reply-To: <20190420051817.5644-1-sean.j.christopherson@intel.com> References: <20190420051817.5644-1-sean.j.christopherson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: kvm-owner@vger.kernel.org List-Archive: List-Post: To: Sean Christopherson Cc: James Hogan , Paul Mackerras , Christian Borntraeger , Janosch Frank , Paolo Bonzini , Radim =?UTF-8?B?S3LEjW3DocWZ?= , Joerg Roedel , Christoffer Dall , Marc Zyngier , David Hildenbrand , James Morse , Julien Thierry , Suzuki K Pouloze , linux-mips@vger.kernel.org, kvm-ppc@vger.kernel.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu List-ID: On Fri, 19 Apr 2019 22:18:17 -0700 Sean Christopherson wrote: > Add a wrapper to invoke kvm_arch_check_processor_compat() so that the > boilerplate ugliness of checking virtualization support on all CPUs is > hidden from the arch specific code. x86's implementation in particular > is quite heinous, as it unnecessarily propagates the out-param pattern > into kvm_x86_ops. > > While the x86 specific issue could be resolved solely by changing > kvm_x86_ops, make the change for all architectures as returning a value > directly is prettier and technically more robust, e.g. s390 doesn't set > the out param, which could lead to subtle breakage in the (highly > unlikely) scenario where the out-param was not pre-initialized by the > caller. > > Opportunistically annotate svm_check_processor_compat() with __init. > > Signed-off-by: Sean Christopherson > --- > > Tested on VMX only. > > arch/mips/kvm/mips.c | 4 ++-- > arch/powerpc/kvm/powerpc.c | 4 ++-- > arch/s390/include/asm/kvm_host.h | 1 - > arch/s390/kvm/kvm-s390.c | 5 +++++ > arch/x86/include/asm/kvm_host.h | 2 +- > arch/x86/kvm/svm.c | 4 ++-- > arch/x86/kvm/vmx/vmx.c | 8 ++++---- > arch/x86/kvm/x86.c | 4 ++-- > include/linux/kvm_host.h | 2 +- > virt/kvm/arm/arm.c | 4 ++-- > virt/kvm/kvm_main.c | 9 ++++++--- > 11 files changed, 27 insertions(+), 20 deletions(-) Yes, this does look nicer. Reviewed-by: Cornelia Huck