From patchwork Thu May 13 11:17:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 99303 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4DBIAND006752 for ; Thu, 13 May 2010 11:18:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758728Ab0EMLR4 (ORCPT ); Thu, 13 May 2010 07:17:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4407 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758703Ab0EMLRo (ORCPT ); Thu, 13 May 2010 07:17:44 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4DBHgNR007351 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 13 May 2010 07:17:42 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4DBHf51012293; Thu, 13 May 2010 07:17:42 -0400 Received: from localhost.localdomain (file.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id 4410E250ADE; Thu, 13 May 2010 14:17:40 +0300 (IDT) From: Avi Kivity To: Marcelo Tosatti , kvm@vger.kernel.org, kvm-ia64@vger.kernel.org, kvm-ppc@vger.kernel.org, carsteno@de.ibm.com Subject: [PATCH 6/7] KVM: PPC: Centralize locking of arch specific vcpu ioctls Date: Thu, 13 May 2010 14:17:38 +0300 Message-Id: <1273749459-622-7-git-send-email-avi@redhat.com> In-Reply-To: <1273749459-622-1-git-send-email-avi@redhat.com> References: <1273749459-622-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 13 May 2010 11:18:10 +0000 (UTC) diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index e0fae7a..caeed7b 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -512,15 +512,17 @@ long kvm_arch_vcpu_ioctl(struct file *filp, void __user *argp = (void __user *)arg; long r; - switch (ioctl) { - case KVM_INTERRUPT: { + if (ioctl == KVM_INTERRUPT) { struct kvm_interrupt irq; r = -EFAULT; if (copy_from_user(&irq, argp, sizeof(irq))) - goto out; + goto out_nolock; r = kvm_vcpu_ioctl_interrupt(vcpu, &irq); - break; + goto out_nolock; } + + vcpu_load(vcpu); + switch (ioctl) { case KVM_ENABLE_CAP: { struct kvm_enable_cap cap; @@ -535,6 +537,8 @@ long kvm_arch_vcpu_ioctl(struct file *filp, } out: + vcpu_put(vcpu); +out_nolock: return r; }