[Top] [All Lists]

Re: [PATCH v3 01/16] KVM: Take vcpu->mutex outside vcpu_load

To: Christoffer Dall <>,
Subject: Re: [PATCH v3 01/16] KVM: Take vcpu->mutex outside vcpu_load
From: Christian Borntraeger <>
Date: Tue, 5 Dec 2017 15:32:30 +0100
Cc: Andrew Jones <>, Christoffer Dall <>, Paolo Bonzini <>, Radim Krčmář <>, Marc Zyngier <>,,, James Hogan <>,, Paul Mackerras <>,, Cornelia Huck <>,
In-reply-to: <>
List-archive: <>
List-help: <>
List-id: linux-mips <>
List-owner: <>
List-post: <>
List-software: Ecartis version 1.0.0
List-subscribe: <>
List-unsubscribe: <>
Original-recipient: rfc822;
References: <> <>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0
On 12/04/2017 09:35 PM, Christoffer Dall wrote:
> From: Christoffer Dall <>
> 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 <>

Looks good to me.

<Prev in Thread] Current Thread [Next in Thread>