All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Christoffer Dall <cdall@kernel.org>
Cc: kvm@vger.kernel.org, "Andrew Jones" <drjones@redhat.com>,
	"Christoffer Dall" <christoffer.dall@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Marc Zyngier" <marc.zyngier@arm.com>,
	kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org,
	"James Hogan" <jhogan@kernel.org>,
	linux-mips@linux-mips.org, "Paul Mackerras" <paulus@ozlabs.org>,
	kvm-ppc@vger.kernel.org,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	linux-s390@vger.kernel.org
Subject: Re: [PATCH v3 01/16] KVM: Take vcpu->mutex outside vcpu_load
Date: Mon, 11 Dec 2017 11:51:01 +0000	[thread overview]
Message-ID: <20171211125101.662dc8b1.cohuck@redhat.com> (raw)
In-Reply-To: <20171204203538.8370-2-cdall@kernel.org>

On Mon,  4 Dec 2017 21:35:23 +0100
Christoffer Dall <cdall@kernel.org> wrote:

> From: Christoffer Dall <christoffer.dall@linaro.org>
> 
> As we're about to call vcpu_load() from architecture-specific
> implementations of the KVM vcpu ioctls, but yet we access data
> structures protected by the vcpu->mutex in the generic code, factor
> this logic out from vcpu_load().
> 
> x86 is the only architecture which calls vcpu_load() outside of the main
> vcpu ioctl function, and these calls will no longer take the vcpu mutex
> following this patch.  However, with the exception of
> kvm_arch_vcpu_postcreate (see below), the callers are either in the
> creation or destruction path of the VCPU, which means there cannot be
> any concurrent access to the data structure, because the file descriptor
> is not yet accessible, or is already gone.
> 
> kvm_arch_vcpu_postcreate makes the newly created vcpu potentially
> accessible by other in-kernel threads through the kvm->vcpus array, and
> we therefore take the vcpu mutex in this case directly.
> 
> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
> ---
>  arch/x86/kvm/vmx.c       |  4 +---
>  arch/x86/kvm/x86.c       | 20 +++++++-------------
>  include/linux/kvm_host.h |  2 +-
>  virt/kvm/kvm_main.c      | 17 ++++++-----------
>  4 files changed, 15 insertions(+), 28 deletions(-)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>

WARNING: multiple messages have this Message-ID (diff)
From: Cornelia Huck <cohuck@redhat.com>
To: Christoffer Dall <cdall@kernel.org>
Cc: kvm@vger.kernel.org, "Andrew Jones" <drjones@redhat.com>,
	"Christoffer Dall" <christoffer.dall@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Marc Zyngier" <marc.zyngier@arm.com>,
	kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org,
	"James Hogan" <jhogan@kernel.org>,
	linux-mips@linux-mips.org, "Paul Mackerras" <paulus@ozlabs.org>,
	kvm-ppc@vger.kernel.org,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	linux-s390@vger.kernel.org
Subject: Re: [PATCH v3 01/16] KVM: Take vcpu->mutex outside vcpu_load
Date: Mon, 11 Dec 2017 12:51:01 +0100	[thread overview]
Message-ID: <20171211125101.662dc8b1.cohuck@redhat.com> (raw)
In-Reply-To: <20171204203538.8370-2-cdall@kernel.org>

On Mon,  4 Dec 2017 21:35:23 +0100
Christoffer Dall <cdall@kernel.org> wrote:

> From: Christoffer Dall <christoffer.dall@linaro.org>
> 
> As we're about to call vcpu_load() from architecture-specific
> implementations of the KVM vcpu ioctls, but yet we access data
> structures protected by the vcpu->mutex in the generic code, factor
> this logic out from vcpu_load().
> 
> x86 is the only architecture which calls vcpu_load() outside of the main
> vcpu ioctl function, and these calls will no longer take the vcpu mutex
> following this patch.  However, with the exception of
> kvm_arch_vcpu_postcreate (see below), the callers are either in the
> creation or destruction path of the VCPU, which means there cannot be
> any concurrent access to the data structure, because the file descriptor
> is not yet accessible, or is already gone.
> 
> kvm_arch_vcpu_postcreate makes the newly created vcpu potentially
> accessible by other in-kernel threads through the kvm->vcpus array, and
> we therefore take the vcpu mutex in this case directly.
> 
> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
> ---
>  arch/x86/kvm/vmx.c       |  4 +---
>  arch/x86/kvm/x86.c       | 20 +++++++-------------
>  include/linux/kvm_host.h |  2 +-
>  virt/kvm/kvm_main.c      | 17 ++++++-----------
>  4 files changed, 15 insertions(+), 28 deletions(-)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>

WARNING: multiple messages have this Message-ID (diff)
From: cohuck@redhat.com (Cornelia Huck)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 01/16] KVM: Take vcpu->mutex outside vcpu_load
Date: Mon, 11 Dec 2017 12:51:01 +0100	[thread overview]
Message-ID: <20171211125101.662dc8b1.cohuck@redhat.com> (raw)
In-Reply-To: <20171204203538.8370-2-cdall@kernel.org>

On Mon,  4 Dec 2017 21:35:23 +0100
Christoffer Dall <cdall@kernel.org> wrote:

> From: Christoffer Dall <christoffer.dall@linaro.org>
> 
> As we're about to call vcpu_load() from architecture-specific
> implementations of the KVM vcpu ioctls, but yet we access data
> structures protected by the vcpu->mutex in the generic code, factor
> this logic out from vcpu_load().
> 
> x86 is the only architecture which calls vcpu_load() outside of the main
> vcpu ioctl function, and these calls will no longer take the vcpu mutex
> following this patch.  However, with the exception of
> kvm_arch_vcpu_postcreate (see below), the callers are either in the
> creation or destruction path of the VCPU, which means there cannot be
> any concurrent access to the data structure, because the file descriptor
> is not yet accessible, or is already gone.
> 
> kvm_arch_vcpu_postcreate makes the newly created vcpu potentially
> accessible by other in-kernel threads through the kvm->vcpus array, and
> we therefore take the vcpu mutex in this case directly.
> 
> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
> ---
>  arch/x86/kvm/vmx.c       |  4 +---
>  arch/x86/kvm/x86.c       | 20 +++++++-------------
>  include/linux/kvm_host.h |  2 +-
>  virt/kvm/kvm_main.c      | 17 ++++++-----------
>  4 files changed, 15 insertions(+), 28 deletions(-)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>

  parent reply	other threads:[~2017-12-11 11:51 UTC|newest]

Thread overview: 152+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-04 20:35 [PATCH v3 00/16] Move vcpu_load and vcpu_put calls to arch code Christoffer Dall
2017-12-04 20:35 ` Christoffer Dall
2017-12-04 20:35 ` Christoffer Dall
2017-12-04 20:35 ` Christoffer Dall
2017-12-04 20:35 ` [PATCH v3 01/16] KVM: Take vcpu->mutex outside vcpu_load Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-05 14:32   ` Christian Borntraeger
2017-12-05 14:32     ` Christian Borntraeger
2017-12-05 14:32     ` Christian Borntraeger
2017-12-11 11:51   ` Cornelia Huck [this message]
2017-12-11 11:51     ` Cornelia Huck
2017-12-11 11:51     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 02/16] KVM: Prepare for moving vcpu_load/vcpu_put into arch specific code Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-11 11:57   ` Cornelia Huck
2017-12-11 11:57     ` Cornelia Huck
2017-12-11 11:57     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 03/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_run Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-05 14:39   ` Christian Borntraeger
2017-12-05 14:39     ` Christian Borntraeger
2017-12-05 14:39     ` Christian Borntraeger
2017-12-11 12:02   ` Cornelia Huck
2017-12-11 12:02     ` Cornelia Huck
2017-12-11 12:02     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 04/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_get_regs Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-08 16:21   ` David Hildenbrand
2017-12-08 16:21     ` David Hildenbrand
2017-12-08 16:21     ` David Hildenbrand
2017-12-11 12:07   ` Cornelia Huck
2017-12-11 12:07     ` Cornelia Huck
2017-12-11 12:07     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 05/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_regs Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-08 16:22   ` David Hildenbrand
2017-12-08 16:22     ` David Hildenbrand
2017-12-08 16:22     ` David Hildenbrand
2017-12-08 16:22     ` David Hildenbrand
2017-12-11 12:09   ` Cornelia Huck
2017-12-11 12:09     ` Cornelia Huck
2017-12-11 12:09     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 06/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_get_sregs Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-08 16:23   ` David Hildenbrand
2017-12-08 16:23     ` David Hildenbrand
2017-12-08 16:23     ` David Hildenbrand
2017-12-11 12:13   ` Cornelia Huck
2017-12-11 12:13     ` Cornelia Huck
2017-12-11 12:13     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 07/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_sregs Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-08 16:26   ` David Hildenbrand
2017-12-08 16:26     ` David Hildenbrand
2017-12-08 16:26     ` David Hildenbrand
2017-12-11  9:19     ` Christoffer Dall
2017-12-11  9:19       ` Christoffer Dall
2017-12-11  9:19       ` Christoffer Dall
2017-12-11  9:19       ` Christoffer Dall
2017-12-12 16:33       ` Paolo Bonzini
2017-12-12 16:33         ` Paolo Bonzini
2017-12-12 16:33         ` Paolo Bonzini
2017-12-12 16:33         ` Paolo Bonzini
2017-12-11 12:15   ` Cornelia Huck
2017-12-11 12:15     ` Cornelia Huck
2017-12-11 12:15     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 08/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_get_mpstate Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-11 12:23   ` Cornelia Huck
2017-12-11 12:23     ` Cornelia Huck
2017-12-11 12:23     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 09/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_mpstate Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-11 12:25   ` Cornelia Huck
2017-12-11 12:25     ` Cornelia Huck
2017-12-11 12:25     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 10/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_translate Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-11 12:29   ` Cornelia Huck
2017-12-11 12:29     ` Cornelia Huck
2017-12-11 12:29     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 11/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_guest_debug Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-11 12:39   ` Cornelia Huck
2017-12-11 12:39     ` Cornelia Huck
2017-12-11 12:39     ` Cornelia Huck
2017-12-11 12:39     ` Cornelia Huck
2017-12-11 15:18     ` Christoffer Dall
2017-12-11 15:18       ` Christoffer Dall
2017-12-11 15:18       ` Christoffer Dall
2017-12-11 15:18       ` Christoffer Dall
2017-12-12 16:36     ` Paolo Bonzini
2017-12-12 16:36       ` Paolo Bonzini
2017-12-12 16:36       ` Paolo Bonzini
2017-12-04 20:35 ` [PATCH v3 12/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_get_fpu Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-11 12:43   ` Cornelia Huck
2017-12-11 12:43     ` Cornelia Huck
2017-12-11 12:43     ` Cornelia Huck
2017-12-11 12:43     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 13/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_fpu Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-11 12:45   ` Cornelia Huck
2017-12-11 12:45     ` Cornelia Huck
2017-12-11 12:45     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 14/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-11 13:12   ` Cornelia Huck
2017-12-11 13:12     ` Cornelia Huck
2017-12-11 13:12     ` Cornelia Huck
2017-12-11 15:22     ` Christoffer Dall
2017-12-11 15:22       ` Christoffer Dall
2017-12-11 15:22       ` Christoffer Dall
2017-12-12 16:47       ` Paolo Bonzini
2017-12-12 16:47         ` Paolo Bonzini
2017-12-12 16:47         ` Paolo Bonzini
2017-12-04 20:35 ` [PATCH v3 15/16] KVM: arm/arm64: Avoid vcpu_load for other vcpu ioctls than KVM_RUN Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35 ` [PATCH v3 16/16] KVM: arm/arm64: Move vcpu_load call after kvm_vcpu_first_run_init Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall

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=20171211125101.662dc8b1.cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cdall@kernel.org \
    --cc=christoffer.dall@linaro.org \
    --cc=drjones@redhat.com \
    --cc=jhogan@kernel.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@linux-mips.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=paulus@ozlabs.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.