From nobody Sat Feb 7 09:14:51 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601568584; cv=none; d=zohomail.com; s=zohoarc; b=MZjRgWrzg5EvGItlNwYvUMdgjMz0Lvu4nNl35x2VDCFaEjy6EI2GD43v0moXoVSlgDMoisB9KJbB1Ou8rVj/heRpn9tLtIkhA4z26rgM1tCpMKCZa8TSjUFOWT4SOweZW8U6FDBGstpgOp2qvuoPzTlsERiO/8FaMpwlrHcTWck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601568584; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iNeHQoVA2L35DcRBRd+F87afg3Mh/4wlkWCIdSOSOVc=; b=jDNG8HODbrLsmW+LlVGkVj08WYKxtuu5flJv0w2IqFTBcCMf9DRfWdU5JhT9cawmST7YnGPA+RI8GwHGM3RiCn0twqGgiNAuBE71yYxUal5f+DpTtlD4eH/zpxR93umQUmMIL3owCKOXpRx+cIOGXk4S5IrQ1T1Skjx1q+5yQU8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601568584224369.6475969876509; Thu, 1 Oct 2020 09:09:44 -0700 (PDT) Received: from localhost ([::1]:36318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kNzvf-0008ID-CH for importer@patchew.org; Thu, 01 Oct 2020 10:51:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kNzqb-0003b6-Tj for qemu-devel@nongnu.org; Thu, 01 Oct 2020 10:46:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:56933) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kNzqY-0002nJ-Uo for qemu-devel@nongnu.org; Thu, 01 Oct 2020 10:46:17 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-208-5VNBoQLeMduCe_RakCAmfg-1; Thu, 01 Oct 2020 10:46:11 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3369081E20C; Thu, 1 Oct 2020 14:46:10 +0000 (UTC) Received: from localhost (ovpn-115-144.ams2.redhat.com [10.36.115.144]) by smtp.corp.redhat.com (Postfix) with ESMTP id 223C319931; Thu, 1 Oct 2020 14:46:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601563573; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iNeHQoVA2L35DcRBRd+F87afg3Mh/4wlkWCIdSOSOVc=; b=A+34vDQwRpsaae/IDmvA0pNSCu5FQBkqNwbgn6i7ZnBfS8gsfohlDgXqlcMwSvuIAegfOj jG/kOZPPQs2ZgTMFR8A2/mzBRzeKnK329q6eBrEMNyqDD8UNyc2tEww0ykGMaPYxz0VVDv fYt+4SpKBM2Vr+ISA7udf5GHzrfp+Pg= X-MC-Unique: 5VNBoQLeMduCe_RakCAmfg-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH 1/2] block/export: add vhost-user-blk multi-queue support Date: Thu, 1 Oct 2020 15:46:03 +0100 Message-Id: <20201001144604.559733-2-stefanha@redhat.com> In-Reply-To: <20201001144604.559733-1-stefanha@redhat.com> References: <20201001144604.559733-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=stefanha@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/01 02:15:30 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MIME_BASE64_TEXT=1.741, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Laurent Vivier , Thomas Huth , qemu-block@nongnu.org, Markus Armbruster , Coiby Xu , Max Reitz , Stefan Hajnoczi , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Allow the number of queues to be configured using --export vhost-user-blk,num-queues=3DN. This setting should match the QEMU --device vhost-user-blk-pci,num-queues=3DN setting but QEMU vhost-user-blk.c lowers its own value if the vhost-user-blk backend offers fewer queues than QEMU. The vhost-user-blk-server.c code is already capable of multi-queue. All virtqueue processing runs in the same AioContext. No new locking is needed. Add the num-queues=3DN option and set the VIRTIO_BLK_F_MQ feature bit. Note that the feature bit only announces the presence of the num_queues configuration space field. It does not promise that there is more than 1 virtqueue, so we can set it unconditionally. I tested multi-queue by running a random read fio test with numjobs=3D4 on an -smp 4 guest. After the benchmark finished the guest /proc/interrupts file showed activity on all 4 virtio-blk MSI-X. The /sys/block/vda/mq/ directory shows that Linux blk-mq has 4 queues configured. An automated test is included in the next commit. Signed-off-by: Stefan Hajnoczi Acked-by: Markus Armbruster --- qapi/block-export.json | 6 +++++- block/export/vhost-user-blk-server.c | 24 ++++++++++++++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/qapi/block-export.json b/qapi/block-export.json index a793e34af9..17020de257 100644 --- a/qapi/block-export.json +++ b/qapi/block-export.json @@ -93,11 +93,15 @@ # SocketAddress types are supported. Passed fds must be UNIX domain # sockets. # @logical-block-size: Logical block size in bytes. Defaults to 512 bytes. +# @num-queues: Number of request virtqueues. Must be greater than 0. Defau= lts +# to 1. # # Since: 5.2 ## { 'struct': 'BlockExportOptionsVhostUserBlk', - 'data': { 'addr': 'SocketAddress', '*logical-block-size': 'size' } } + 'data': { 'addr': 'SocketAddress', + '*logical-block-size': 'size', + '*num-queues': 'uint16'} } =20 ## # @NbdServerAddOptions: diff --git a/block/export/vhost-user-blk-server.c b/block/export/vhost-user= -blk-server.c index 81072a5a46..bf84b45ecd 100644 --- a/block/export/vhost-user-blk-server.c +++ b/block/export/vhost-user-blk-server.c @@ -21,7 +21,7 @@ #include "util/block-helpers.h" =20 enum { - VHOST_USER_BLK_MAX_QUEUES =3D 1, + VHOST_USER_BLK_NUM_QUEUES_DEFAULT =3D 1, }; struct virtio_blk_inhdr { unsigned char status; @@ -242,6 +242,7 @@ static uint64_t vu_blk_get_features(VuDev *dev) 1ull << VIRTIO_BLK_F_DISCARD | 1ull << VIRTIO_BLK_F_WRITE_ZEROES | 1ull << VIRTIO_BLK_F_CONFIG_WCE | + 1ull << VIRTIO_BLK_F_MQ | 1ull << VIRTIO_F_VERSION_1 | 1ull << VIRTIO_RING_F_INDIRECT_DESC | 1ull << VIRTIO_RING_F_EVENT_IDX | @@ -334,7 +335,9 @@ static void blk_aio_detach(void *opaque) =20 static void vu_blk_initialize_config(BlockDriverState *bs, - struct virtio_blk_config *config, uint32_t blk_= size) + struct virtio_blk_config *config, + uint32_t blk_size, + uint16_t num_queues) { config->capacity =3D bdrv_getlength(bs) >> BDRV_SECTOR_BITS; config->blk_size =3D blk_size; @@ -342,7 +345,7 @@ vu_blk_initialize_config(BlockDriverState *bs, config->seg_max =3D 128 - 2; config->min_io_size =3D 1; config->opt_io_size =3D 1; - config->num_queues =3D VHOST_USER_BLK_MAX_QUEUES; + config->num_queues =3D num_queues; config->max_discard_sectors =3D 32768; config->max_discard_seg =3D 1; config->discard_sector_alignment =3D config->blk_size >> 9; @@ -364,6 +367,7 @@ static int vu_blk_exp_create(BlockExport *exp, BlockExp= ortOptions *opts, BlockExportOptionsVhostUserBlk *vu_opts =3D &opts->u.vhost_user_blk; Error *local_err =3D NULL; uint64_t logical_block_size; + uint16_t num_queues =3D VHOST_USER_BLK_NUM_QUEUES_DEFAULT; =20 vexp->writable =3D opts->writable; vexp->blkcfg.wce =3D 0; @@ -381,16 +385,24 @@ static int vu_blk_exp_create(BlockExport *exp, BlockE= xportOptions *opts, } vexp->blk_size =3D logical_block_size; blk_set_guest_block_size(exp->blk, logical_block_size); + + if (vu_opts->has_num_queues) { + num_queues =3D vu_opts->num_queues; + } + if (num_queues =3D=3D 0) { + error_setg(errp, "num-queues must be greater than 0"); + return -EINVAL; + } + vu_blk_initialize_config(blk_bs(exp->blk), &vexp->blkcfg, - logical_block_size); + logical_block_size, num_queues); =20 blk_set_allow_aio_context_change(exp->blk, true); blk_add_aio_context_notifier(exp->blk, blk_aio_attached, blk_aio_detac= h, vexp); =20 if (!vhost_user_server_start(&vexp->vu_server, vu_opts->addr, exp->ctx, - VHOST_USER_BLK_MAX_QUEUES, &vu_blk_iface, - errp)) { + num_queues, &vu_blk_iface, errp)) { blk_remove_aio_context_notifier(exp->blk, blk_aio_attached, blk_aio_detach, vexp); return -EADDRNOTAVAIL; --=20 2.26.2 From nobody Sat Feb 7 09:14:51 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601566219; cv=none; d=zohomail.com; s=zohoarc; b=MSoMkC1KyjFpLZYZ8zw0oaDXSXuO2uR/9QYT1gFUsAO9UrJ8Ife2V4dhRE8PVBpmEw3/D0RSsC0ct9kNLwdwLAc9gBDyuQImW/VHB+6USRqHw2LjMeK3S+wl7OizybatoeWeTmCyOz1aaRKDFvicfx/s4WwK1Uwlwrd9bwHSsEk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601566219; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3x/nbakShkzgwIP/VVafX/Z5rKUQkqjP+26ILyWoe1o=; b=DOKUSG/ITzygcoVbnkRf4GcrPxruF0tBOqAmqgvgBgSjGjTUrP0gKUMmRzr7SHEwhm23vjtgg8PSqBNZWfn/794EYlive34iTprYlhur3lfCsEmp1Ejvz0MJIWWICNk41htTMT/b6dT9lHoR+HVjsnmeeIY5Uc4Fj6vgC44TQGI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601566219115108.58717089720244; Thu, 1 Oct 2020 08:30:19 -0700 (PDT) Received: from localhost ([::1]:36494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kNzvh-0008Mf-Un for importer@patchew.org; Thu, 01 Oct 2020 10:51:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kNzqf-0003cK-57 for qemu-devel@nongnu.org; Thu, 01 Oct 2020 10:46:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:36550) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kNzqa-0002na-VM for qemu-devel@nongnu.org; Thu, 01 Oct 2020 10:46:20 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-160-0GWizxhMNk2rF2jKUiXg0w-1; Thu, 01 Oct 2020 10:46:14 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B24FB108E1C7; Thu, 1 Oct 2020 14:46:11 +0000 (UTC) Received: from localhost (ovpn-115-144.ams2.redhat.com [10.36.115.144]) by smtp.corp.redhat.com (Postfix) with ESMTP id 44E9D19C78; Thu, 1 Oct 2020 14:46:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601563576; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3x/nbakShkzgwIP/VVafX/Z5rKUQkqjP+26ILyWoe1o=; b=QvXh18+gTkKN1G//tGmxzYQW0zJurQRNEaviGjmipqTjTLZDAYlUHKaVbQ5eAuADK2lapr Cbjob7kAlfDkJjEw134+8EWei2paiasBOniNC3lADp5EI/RwAW+AKj0fmJzhtifa8mRPnf 8vVxjiLkFFQGs5JZG5EBAZmh1Yr5tDI= X-MC-Unique: 0GWizxhMNk2rF2jKUiXg0w-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH 2/2] tests/qtest: add multi-queue test case to vhost-user-blk-test Date: Thu, 1 Oct 2020 15:46:04 +0100 Message-Id: <20201001144604.559733-3-stefanha@redhat.com> In-Reply-To: <20201001144604.559733-1-stefanha@redhat.com> References: <20201001144604.559733-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=stefanha@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/01 02:15:30 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MIME_BASE64_TEXT=1.741, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Laurent Vivier , Thomas Huth , qemu-block@nongnu.org, Markus Armbruster , Coiby Xu , Max Reitz , Stefan Hajnoczi , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Stefan Hajnoczi --- tests/qtest/vhost-user-blk-test.c | 81 +++++++++++++++++++++++++++++-- 1 file changed, 76 insertions(+), 5 deletions(-) diff --git a/tests/qtest/vhost-user-blk-test.c b/tests/qtest/vhost-user-blk= -test.c index 42e4cfde82..b9f35191df 100644 --- a/tests/qtest/vhost-user-blk-test.c +++ b/tests/qtest/vhost-user-blk-test.c @@ -559,6 +559,67 @@ static void pci_hotplug(void *obj, void *data, QGuestA= llocator *t_alloc) qpci_unplug_acpi_device_test(qts, "drv1", PCI_SLOT_HP); } =20 +static void multiqueue(void *obj, void *data, QGuestAllocator *t_alloc) +{ + QVirtioPCIDevice *pdev1 =3D obj; + QVirtioDevice *dev1 =3D &pdev1->vdev; + QVirtioPCIDevice *pdev8; + QVirtioDevice *dev8; + QTestState *qts =3D pdev1->pdev->bus->qts; + uint64_t features; + uint16_t num_queues; + + /* + * The primary device has 1 queue and VIRTIO_BLK_F_MQ is not enabled. = The + * VIRTIO specification allows VIRTIO_BLK_F_MQ to be enabled when ther= e is + * only 1 virtqueue, but --device vhost-user-blk-pci doesn't do this (= which + * is also spec-compliant). + */ + features =3D qvirtio_get_features(dev1); + g_assert_cmpint(features & (1u << VIRTIO_BLK_F_MQ), =3D=3D, 0); + features =3D features & ~(QVIRTIO_F_BAD_FEATURE | + (1u << VIRTIO_RING_F_INDIRECT_DESC) | + (1u << VIRTIO_F_NOTIFY_ON_EMPTY) | + (1u << VIRTIO_BLK_F_SCSI)); + qvirtio_set_features(dev1, features); + + /* Hotplug a secondary device with 8 queues */ + qtest_qmp_device_add(qts, "vhost-user-blk-pci", "drv1", + "{'addr': %s, 'chardev': 'char2', 'num-queues': 8= }", + stringify(PCI_SLOT_HP) ".0"); + + pdev8 =3D virtio_pci_new(pdev1->pdev->bus, + &(QPCIAddress) { + .devfn =3D QPCI_DEVFN(PCI_SLOT_HP, 0) + }); + g_assert_nonnull(pdev8); + g_assert_cmpint(pdev8->vdev.device_type, =3D=3D, VIRTIO_ID_BLOCK); + + qos_object_start_hw(&pdev8->obj); + + dev8 =3D &pdev8->vdev; + features =3D qvirtio_get_features(dev8); + g_assert_cmpint(features & (1u << VIRTIO_BLK_F_MQ), + =3D=3D, + (1u << VIRTIO_BLK_F_MQ)); + features =3D features & ~(QVIRTIO_F_BAD_FEATURE | + (1u << VIRTIO_RING_F_INDIRECT_DESC) | + (1u << VIRTIO_F_NOTIFY_ON_EMPTY) | + (1u << VIRTIO_BLK_F_SCSI) | + (1u << VIRTIO_BLK_F_MQ)); + qvirtio_set_features(dev8, features); + + num_queues =3D qvirtio_config_readw(dev8, + offsetof(struct virtio_blk_config, num_queues)); + g_assert_cmpint(num_queues, =3D=3D, 8); + + qvirtio_pci_device_disable(pdev8); + qos_object_destroy(&pdev8->obj); + + /* unplug secondary disk */ + qpci_unplug_acpi_device_test(qts, "drv1", PCI_SLOT_HP); +} + /* * Check that setting the vring addr on a non-existent virtqueue does * not crash. @@ -643,7 +704,8 @@ static void quit_storage_daemon(void *qmp_test_state) g_free(qmp_test_state); } =20 -static char *start_vhost_user_blk(GString *cmd_line, int vus_instances) +static char *start_vhost_user_blk(GString *cmd_line, int vus_instances, + int num_queues) { const char *vhost_user_blk_bin =3D qtest_qemu_storage_daemon_binary(); int fd, qmp_fd, i; @@ -675,8 +737,8 @@ static char *start_vhost_user_blk(GString *cmd_line, in= t vus_instances) g_string_append_printf(storage_daemon_command, "--blockdev driver=3Dfile,node-name=3Ddisk%d,filename=3D%s " "--export type=3Dvhost-user-blk,id=3Ddisk%d,addr.type=3Dunix,a= ddr.path=3D%s," - "node-name=3Ddisk%i,writable=3Don ", - i, img_path, i, sock_path, i); + "node-name=3Ddisk%i,writable=3Don,num-queues=3D%d ", + i, img_path, i, sock_path, i, num_queues); =20 g_string_append_printf(cmd_line, "-chardev socket,id=3Dchar%d,path= =3D%s ", i + 1, sock_path); @@ -705,7 +767,7 @@ static char *start_vhost_user_blk(GString *cmd_line, in= t vus_instances) =20 static void *vhost_user_blk_test_setup(GString *cmd_line, void *arg) { - start_vhost_user_blk(cmd_line, 1); + start_vhost_user_blk(cmd_line, 1, 1); return arg; } =20 @@ -719,7 +781,13 @@ static void *vhost_user_blk_test_setup(GString *cmd_li= ne, void *arg) static void *vhost_user_blk_hotplug_test_setup(GString *cmd_line, void *ar= g) { /* "-chardev socket,id=3Dchar2" is used for pci_hotplug*/ - start_vhost_user_blk(cmd_line, 2); + start_vhost_user_blk(cmd_line, 2, 1); + return arg; +} + +static void *vhost_user_blk_multiqueue_test_setup(GString *cmd_line, void = *arg) +{ + start_vhost_user_blk(cmd_line, 2, 8); return arg; } =20 @@ -746,6 +814,9 @@ static void register_vhost_user_blk_test(void) =20 opts.before =3D vhost_user_blk_hotplug_test_setup; qos_add_test("hotplug", "vhost-user-blk-pci", pci_hotplug, &opts); + + opts.before =3D vhost_user_blk_multiqueue_test_setup; + qos_add_test("multiqueue", "vhost-user-blk-pci", multiqueue, &opts); } =20 libqos_init(register_vhost_user_blk_test); --=20 2.26.2