From patchwork Sun Jul 26 15:47:01 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: 37426 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 n6QFmA6W004309 for ; Sun, 26 Jul 2009 15:48:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753341AbZGZPsH (ORCPT ); Sun, 26 Jul 2009 11:48:07 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753324AbZGZPsG (ORCPT ); Sun, 26 Jul 2009 11:48:06 -0400 Received: from mx2.redhat.com ([66.187.237.31]:46361 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752742AbZGZPsF (ORCPT ); Sun, 26 Jul 2009 11:48:05 -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 n6QFm0AG009461; Sun, 26 Jul 2009 11:48:00 -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 n6QFlxHO026285; Sun, 26 Jul 2009 11:47:59 -0400 Received: from redhat.com (vpn-6-213.tlv.redhat.com [10.35.6.213]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6QFluJF030225; Sun, 26 Jul 2009 11:47:57 -0400 Date: Sun, 26 Jul 2009 18:47:01 +0300 From: "Michael S. Tsirkin" To: Christian Borntraeger , virtualization@lists.linux-foundation.org, Anthony Liguori , kvm@vger.kernel.org, avi@redhat.com, Carsten Otte , Rusty Russell , amit.shah@redhat.com Subject: [PATCHv4 1/2] virtio: make del_vq delete vq from list Message-ID: <20090726154701.GB21829@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 This makes delete vq the reverse of find vq. This is required to make it possible to retry find_vqs after a failure, otherwise the list gets corrupted. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 7e21389..4c74c72 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c @@ -464,7 +464,11 @@ static void vp_del_vq(struct virtqueue *vq) { struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev); struct virtio_pci_vq_info *info = vq->priv; - unsigned long size; + unsigned long flags, size; + + spin_lock_irqsave(&vp_dev->lock, flags); + list_del(&info->node); + spin_unlock_irqrestore(&vp_dev->lock, flags); iowrite16(info->queue_index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_SEL);