From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cornelia Huck Subject: Re: [PATCH] KVM: Directly return result from kvm_arch_check_processor_compat() Date: Tue, 23 Apr 2019 10:57:25 +0200 Message-ID: <20190423105725.73f5680e.cohuck@redhat.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 Return-path: Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 41D454A476 for ; Tue, 23 Apr 2019 04:57:36 -0400 (EDT) Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YIki2F6D7LvK for ; Tue, 23 Apr 2019 04:57:35 -0400 (EDT) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 233414A36C for ; Tue, 23 Apr 2019 04:57:35 -0400 (EDT) In-Reply-To: <20190420051817.5644-1-sean.j.christopherson@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu To: Sean Christopherson Cc: linux-s390@vger.kernel.org, Janosch Frank , kvm@vger.kernel.org, Marc Zyngier , James Hogan , Joerg Roedel , David Hildenbrand , kvm-ppc@vger.kernel.org, linux-mips@vger.kernel.org, Paul Mackerras , Christian Borntraeger , linux-arm-kernel@lists.infradead.org, Paolo Bonzini , kvmarm@lists.cs.columbia.edu List-Id: kvmarm@lists.cs.columbia.edu 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEDB9C10F14 for ; Tue, 23 Apr 2019 08:57:39 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 520D7214AE for ; Tue, 23 Apr 2019 08:57:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 520D7214AE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 82FD14A4C3; Tue, 23 Apr 2019 04:57:38 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id osLT0fitggji; Tue, 23 Apr 2019 04:57:37 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 52DB24A476; Tue, 23 Apr 2019 04:57:37 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 41D454A476 for ; Tue, 23 Apr 2019 04:57:36 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YIki2F6D7LvK for ; Tue, 23 Apr 2019 04:57:35 -0400 (EDT) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 233414A36C for ; Tue, 23 Apr 2019 04:57:35 -0400 (EDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 024C83087924; Tue, 23 Apr 2019 08:57:34 +0000 (UTC) Received: from gondolin (dhcp-192-187.str.redhat.com [10.33.192.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0EA041A91A; Tue, 23 Apr 2019 08:57:27 +0000 (UTC) Date: Tue, 23 Apr 2019 10:57:25 +0200 From: Cornelia Huck To: Sean Christopherson 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> Organization: Red Hat GmbH MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 23 Apr 2019 08:57:34 +0000 (UTC) Cc: linux-s390@vger.kernel.org, Janosch Frank , kvm@vger.kernel.org, Marc Zyngier , James Hogan , Joerg Roedel , David Hildenbrand , kvm-ppc@vger.kernel.org, linux-mips@vger.kernel.org, Paul Mackerras , Christian Borntraeger , linux-arm-kernel@lists.infradead.org, Paolo Bonzini , kvmarm@lists.cs.columbia.edu X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Message-ID: <20190423085725.D0AEUAgZxcp9MulCn9CYQcpOklqKAZxfKA_eKQcXbqw@z> 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 _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm