From patchwork Mon Jun 29 17:34:21 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 32996 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n5THZFto013535 for ; Mon, 29 Jun 2009 17:35:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757640AbZF2Rex (ORCPT ); Mon, 29 Jun 2009 13:34:53 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757646AbZF2Rew (ORCPT ); Mon, 29 Jun 2009 13:34:52 -0400 Received: from mx2.redhat.com ([66.187.237.31]:39853 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757493AbZF2Rev (ORCPT ); Mon, 29 Jun 2009 13:34:51 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n5THYspC022904; Mon, 29 Jun 2009 13:34:54 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n5THYqLu019591; Mon, 29 Jun 2009 13:34:53 -0400 Received: from redhat.com (vpn-6-102.tlv.redhat.com [10.35.6.102]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n5THYnAG015650; Mon, 29 Jun 2009 13:34:50 -0400 Date: Mon, 29 Jun 2009 20:34:21 +0300 From: "Michael S. Tsirkin" To: Gregory Haskins , avi@redhat.com Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, avi@redhat.com, mtosatti@redhat.com, paulmck@linux.vnet.ibm.com, markmc@redhat.com Subject: [PATCHv4 3/6] kvm: switch pit creation to slots_lock Message-ID: <20090629173421.GD22855@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org switch pit creation to slots_lock. slots_lock is already taken for read everywhere, so we only need to take it for write when creating pit. This is in preparation to removing in_range and kvm->lock around it. Signed-off-by: Michael S. Tsirkin --- arch/x86/kvm/x86.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 5a66bb9..a2505ca 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -2115,7 +2115,7 @@ long kvm_arch_vm_ioctl(struct file *filp, sizeof(struct kvm_pit_config))) goto out; create_pit: - mutex_lock(&kvm->lock); + down_write(&kvm->slots_lock); r = -EEXIST; if (kvm->arch.vpit) goto create_pit_unlock; @@ -2124,7 +2124,7 @@ long kvm_arch_vm_ioctl(struct file *filp, if (kvm->arch.vpit) r = 0; create_pit_unlock: - mutex_unlock(&kvm->lock); + up_write(&kvm->slots_lock); break; case KVM_IRQ_LINE_STATUS: case KVM_IRQ_LINE: {