Received: from eggs.gnu.org ([2001:4830:134:3::10]:50923) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQy0X-00068K-EL for qemu-devel@nongnu.org; Thu, 26 Feb 2015 07:57:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQy0R-0004di-5A for qemu-devel@nongnu.org; Thu, 26 Feb 2015 07:57:37 -0500 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:56623) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQy0Q-0004cT-SC for qemu-devel@nongnu.org; Thu, 26 Feb 2015 07:57:31 -0500 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 26 Feb 2015 12:57:25 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id A076B17D8059 for ; Thu, 26 Feb 2015 12:57:38 +0000 (GMT) Received: from d06av03.portsmouth.uk.ibm.com (d06av03.portsmouth.uk.ibm.com [9.149.37.213]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t1QCvLjQ9044278 for ; Thu, 26 Feb 2015 12:57:21 GMT Received: from d06av03.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av03.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t1QCvKNc032525 for ; Thu, 26 Feb 2015 05:57:21 -0700 Date: Thu, 26 Feb 2015 13:57:17 +0100 From: Cornelia Huck Message-ID: <20150226135717.3f5b5789.cornelia.huck@de.ibm.com> In-Reply-To: <1424934286-7099-4-git-send-email-jasowang@redhat.com> References: <1424934286-7099-1-git-send-email-jasowang@redhat.com> <1424934286-7099-4-git-send-email-jasowang@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V2 03/11] virito: introduce bus specific queue limit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jason Wang Cc: mst@redhat.com, Alexander Graf , qemu-devel@nongnu.org, Christian Borntraeger , Anthony Liguori , Paolo Bonzini , Richard Henderson On Thu, 26 Feb 2015 15:04:38 +0800 Jason Wang wrote: > This patch introduces a bus specific queue limitation. It will be > useful for increasing the limit for one of the bus without disturbing > other buses. > > Cc: Anthony Liguori > Cc: Michael S. Tsirkin > Cc: Alexander Graf > Cc: Richard Henderson > Cc: Cornelia Huck > Cc: Christian Borntraeger > Cc: Paolo Bonzini > Signed-off-by: Jason Wang > --- > hw/net/virtio-net.c | 4 ++-- > hw/s390x/s390-virtio-bus.c | 1 + > hw/s390x/virtio-ccw.c | 1 + > hw/scsi/virtio-scsi.c | 4 ++-- > hw/virtio/virtio-mmio.c | 1 + > hw/virtio/virtio-pci.c | 1 + > hw/virtio/virtio.c | 52 +++++++++++++++++++++++++++++++----------- > include/hw/virtio/virtio-bus.h | 1 + > include/hw/virtio/virtio.h | 1 + > 9 files changed, 49 insertions(+), 17 deletions(-) > > diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c > index ffc22e8..5a806b5 100644 > --- a/hw/virtio/virtio.c > +++ b/hw/virtio/virtio.c > @@ -541,6 +541,14 @@ void virtio_update_irq(VirtIODevice *vdev) > virtio_notify_vector(vdev, VIRTIO_NO_VECTOR); > } > > +int virtio_get_queue_max(VirtIODevice *vdev) > +{ > + BusState *qbus = qdev_get_parent_bus(DEVICE(vdev)); > + VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); > + > + return k->queue_max; > +} > + Are all callers of this in the slow path? So we don't introduce processing overhead. > void virtio_set_status(VirtIODevice *vdev, uint8_t val) > { > VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); (...) > @@ -777,27 +790,35 @@ void virtio_queue_notify(VirtIODevice *vdev, int n) > > uint16_t virtio_queue_vector(VirtIODevice *vdev, int n) > { > - return n < VIRTIO_PCI_QUEUE_MAX ? vdev->vq[n].vector : > + BusState *qbus = qdev_get_parent_bus(DEVICE(vdev)); > + VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); > + > + return n < k->queue_max ? vdev->vq[n].vector : Any reason you're not using the newly introduced virtio_get_queue_max()? > VIRTIO_NO_VECTOR; > } Do we need to care about migration if the target supports a different number of queues? I'm also not sure whether it would be sufficient to allow transports to limit queues to a lower number than the core supports. We'd basically only need to block off queue creation in the individual transports, I think.