From patchwork Tue Apr 20 15:54:01 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 93681 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 o3KFsakq021856 for ; Tue, 20 Apr 2010 15:54:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753345Ab0DTPyd (ORCPT ); Tue, 20 Apr 2010 11:54:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60876 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752014Ab0DTPyc (ORCPT ); Tue, 20 Apr 2010 11:54:32 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o3KFsUq7029800 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 20 Apr 2010 11:54:30 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o3KFsT9m009431; Tue, 20 Apr 2010 11:54:29 -0400 Received: from amt.cnet (vpn-10-230.rdu.redhat.com [10.11.10.230]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o3KFsSKp012852; Tue, 20 Apr 2010 11:54:28 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 034B968A584; Tue, 20 Apr 2010 12:54:04 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id o3KFs1aK030562; Tue, 20 Apr 2010 12:54:01 -0300 Date: Tue, 20 Apr 2010 12:54:01 -0300 From: Marcelo Tosatti To: kvm Cc: bonenkamp@gmx.de, Chris Wright , "Yang, Sheng" Subject: [UNTESTED] KVM: do not call kvm_set_irq from irq disabled section Message-ID: <20100420155401.GA12982@amt.cnet> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-08-17) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 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]); Tue, 20 Apr 2010 15:54:36 +0000 (UTC) diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c index 47ca447..7ac7bbe 100644 --- a/virt/kvm/assigned-dev.c +++ b/virt/kvm/assigned-dev.c @@ -64,24 +64,33 @@ static void kvm_assigned_dev_interrupt_work_handler(struct work_struct *work) interrupt_work); kvm = assigned_dev->kvm; - spin_lock_irq(&assigned_dev->assigned_dev_lock); if (assigned_dev->irq_requested_type & KVM_DEV_IRQ_HOST_MSIX) { struct kvm_guest_msix_entry *guest_entries = assigned_dev->guest_msix_entries; + + spin_lock_irq(&assigned_dev->assigned_dev_lock); for (i = 0; i < assigned_dev->entries_nr; i++) { if (!(guest_entries[i].flags & KVM_ASSIGNED_MSIX_PENDING)) continue; guest_entries[i].flags &= ~KVM_ASSIGNED_MSIX_PENDING; + /* + * If kvm_assigned_dev_intr sets pending for an + * entry smaller than this work instance is + * currently processing, a new work instance + * will be queued. + */ + spin_unlock_irq(&assigned_dev->assigned_dev_lock); kvm_set_irq(assigned_dev->kvm, assigned_dev->irq_source_id, guest_entries[i].vector, 1); + spin_lock_irq(&assigned_dev->assigned_dev_lock); } + spin_unlock_irq(&assigned_dev->assigned_dev_lock); } else kvm_set_irq(assigned_dev->kvm, assigned_dev->irq_source_id, assigned_dev->guest_irq, 1); - spin_unlock_irq(&assigned_dev->assigned_dev_lock); } static irqreturn_t kvm_assigned_dev_intr(int irq, void *dev_id)