From: Cornelia Huck <cohuck@redhat.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: linux-s390@vger.kernel.org, Janosch Frank <frankja@linux.ibm.com>,
kvm@vger.kernel.org, Marc Zyngier <marc.zyngier@arm.com>,
James Hogan <jhogan@kernel.org>, Joerg Roedel <joro@8bytes.org>,
David Hildenbrand <david@redhat.com>,
kvm-ppc@vger.kernel.org, linux-mips@vger.kernel.org,
Paul Mackerras <paulus@ozlabs.org>,
Christian Borntraeger <borntraeger@de.ibm.com>,
linux-arm-kernel@lists.infradead.org,
Paolo Bonzini <pbonzini@redhat.com>,
kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH] KVM: Directly return result from kvm_arch_check_processor_compat()
Date: Tue, 23 Apr 2019 10:57:25 +0200 [thread overview]
Message-ID: <20190423105725.73f5680e.cohuck@redhat.com> (raw)
In-Reply-To: <20190420051817.5644-1-sean.j.christopherson@intel.com>
On Fri, 19 Apr 2019 22:18:17 -0700
Sean Christopherson <sean.j.christopherson@intel.com> 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 <sean.j.christopherson@intel.com>
> ---
>
> 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 <cohuck@redhat.com>
WARNING: multiple messages have this Message-ID (diff)
From: Cornelia Huck <cohuck@redhat.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: linux-s390@vger.kernel.org, Janosch Frank <frankja@linux.ibm.com>,
kvm@vger.kernel.org, Marc Zyngier <marc.zyngier@arm.com>,
James Hogan <jhogan@kernel.org>, Joerg Roedel <joro@8bytes.org>,
David Hildenbrand <david@redhat.com>,
kvm-ppc@vger.kernel.org, linux-mips@vger.kernel.org,
Paul Mackerras <paulus@ozlabs.org>,
Christian Borntraeger <borntraeger@de.ibm.com>,
linux-arm-kernel@lists.infradead.org,
Paolo Bonzini <pbonzini@redhat.com>,
kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH] KVM: Directly return result from kvm_arch_check_processor_compat()
Date: Tue, 23 Apr 2019 10:57:25 +0200 [thread overview]
Message-ID: <20190423105725.73f5680e.cohuck@redhat.com> (raw)
Message-ID: <20190423085725.D0AEUAgZxcp9MulCn9CYQcpOklqKAZxfKA_eKQcXbqw@z> (raw)
In-Reply-To: <20190420051817.5644-1-sean.j.christopherson@intel.com>
On Fri, 19 Apr 2019 22:18:17 -0700
Sean Christopherson <sean.j.christopherson@intel.com> 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 <sean.j.christopherson@intel.com>
> ---
>
> 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 <cohuck@redhat.com>
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
next prev parent reply other threads:[~2019-04-23 8:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-20 5:18 [PATCH] KVM: Directly return result from kvm_arch_check_processor_compat() Sean Christopherson
2019-04-20 5:18 ` Sean Christopherson
2019-04-23 8:57 ` Cornelia Huck [this message]
2019-04-23 8:57 ` Cornelia Huck
2019-04-23 10:14 ` Marc Zyngier
2019-04-23 10:14 ` Marc Zyngier
2019-05-20 13:43 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190423105725.73f5680e.cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=jhogan@kernel.org \
--cc=joro@8bytes.org \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=paulus@ozlabs.org \
--cc=pbonzini@redhat.com \
--cc=sean.j.christopherson@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).