From nobody Tue Feb 10 06:07:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1631158563972756.1812507846786; Wed, 8 Sep 2021 20:36:03 -0700 (PDT) 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-595-Fcs5jiu-PXO7Ju7qPyDD6Q-1; Wed, 08 Sep 2021 23:36:00 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DED1B18414A1; Thu, 9 Sep 2021 03:35:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C00586B55D; Thu, 9 Sep 2021 03:35:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8FF6A4EA39; Thu, 9 Sep 2021 03:35:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1893ZVLg004012 for ; Wed, 8 Sep 2021 23:35:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 85E2E10145F9; Thu, 9 Sep 2021 03:35:31 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 80C6D1011011 for ; Thu, 9 Sep 2021 03:35:28 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BB991811E76 for ; Thu, 9 Sep 2021 03:35:28 +0000 (UTC) Received: from corp-ob07.yahoo-corp.jp (corp-ob07.yahoo-corp.jp [183.79.94.94]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-45-edaPJklXOl2kPt0GA7-nBg-1; Wed, 08 Sep 2021 23:35:26 -0400 Received: from JPN01-TY1-obe.outbound.protection.outlook.com (mail-ty1jpn01lp2059.outbound.protection.outlook.com [104.47.93.59]) by corp-ob07.yahoo-corp.jp (Postfix) with ESMTPS id 64EB719FB183 for ; Thu, 9 Sep 2021 12:35:23 +0900 (JST) Received: from TY2PR01MB2010.jpnprd01.prod.outlook.com (2603:1096:404:10::15) by TYAPR01MB6283.jpnprd01.prod.outlook.com (2603:1096:400:84::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.20; Thu, 9 Sep 2021 03:35:22 +0000 Received: from TY2PR01MB2010.jpnprd01.prod.outlook.com ([fe80::cce2:1d9a:207c:c06c]) by TY2PR01MB2010.jpnprd01.prod.outlook.com ([fe80::cce2:1d9a:207c:c06c%5]) with mapi id 15.20.4478.025; Thu, 9 Sep 2021 03:35:22 +0000 Received: from R-SUR-LBA-2603.yahoo.co.jp (211.14.29.147) by TYCPR01CA0024.jpnprd01.prod.outlook.com (2603:1096:405::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Thu, 9 Sep 2021 03:35:22 +0000 X-MC-Unique: Fcs5jiu-PXO7Ju7qPyDD6Q-1 X-MC-Unique: edaPJklXOl2kPt0GA7-nBg-1 From: Hiroki Narukawa To: libvir-list@redhat.com Subject: [PATCH 5/5] qemu: add virtio-blk queue-size option Date: Thu, 9 Sep 2021 12:34:48 +0900 Message-Id: <20210909033448.7018-6-hnarukaw@yahoo-corp.jp> In-Reply-To: <20210909033448.7018-1-hnarukaw@yahoo-corp.jp> References: <20210909033448.7018-1-hnarukaw@yahoo-corp.jp> X-ClientProxiedBy: TYCPR01CA0024.jpnprd01.prod.outlook.com (2603:1096:405::36) To TY2PR01MB2010.jpnprd01.prod.outlook.com (2603:1096:404:10::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0d076d6c-13b6-45e7-8d05-08d97342daba X-MS-TrafficTypeDiagnostic: TYAPR01MB6283: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:23 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: oIGA+StSmDW0IgLfE1K7KpRjuw/MCy/GtA574mJTGCEISZbpkLEbpyq6c9bGXzG/DpMBHpMqZpmSUvpjYw3XyQiNK1m0Ri2Hgt2BKciaU4VyHswxdsYHp7NXERVxO4HjQFLlXSeveEsL7B3xiRhA+O1olRLZqsgfK32Glltgjoe2vw5oqBClwYdWlF3CVo04xeo133PdnPXw3lUNZIAtGYQ/s0qs6nOM9Za+PO8aIA+bDmb3zjTze7/qaCarzgC9He2Hb8sZWKGuGbkFv1gMORTi+tbT/yn+zQxFOrXTlT1Zsal83+TMjhbYbGFfnNxD4Usxi7cEUFh5gqqcMLHvQ2Y6TPnoK8QZrV4O1vzJqUswrhxfuwpZGWyzDHfT+fjTI/xEAX5KtdzOmErrtqzz4hpeOU2OmO2CFXbdHNVLwNin9icHqiWfg33Iw7RIjC5GHl6S8dBYY3VCKty90lSakcvhZw7UvYeOK76Zts3V1UsRzez0+ZoazSV/iMEcKSFr36d/AoJMUPXw5OE8Iw3L9UDRcP/QKVqj6jFPATGIPGGX+MhrOlO/REnvd6jufi/QKl2Wc/6QjGiFXI6Cy7A6wcGRHnpqcMMeeiFVuF1I1a2zSSCm721dabeOTBbsUWl+15qC9DbICAM/DVkvtulg9zu6cdmexYHvHcruWhi/4PL8OBbiUj/im74Shkex5gkxpzAq+tDyCrf85+ldDvAD/w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TY2PR01MB2010.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(376002)(346002)(39860400002)(396003)(366004)(6666004)(6506007)(2906002)(6916009)(4326008)(86362001)(26005)(36756003)(6512007)(2616005)(186003)(5660300002)(66946007)(8936002)(30864003)(956004)(316002)(38100700002)(66556008)(38350700002)(66476007)(52116002)(6486002)(107886003)(83380400001)(478600001)(1076003)(8676002); DIR:OUT; SFP:1102 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?uT8/yz05ZYKFzeqi/oVTvVjvjP8WZuhWaMqIHE9E2oTH/W7lmHKH0+w4RD04?= =?us-ascii?Q?nXDEI4kRaXw3LyjeHYuE9dNFBKdCtIcpi/nVxhDXXOZ5omj+7SMOrF+0XQaa?= =?us-ascii?Q?f8wvLWzGg4nxm7vTX2AKtyFaR6BuX1kW5owtA445hgRMkW8ZCFjqHsvZ7X/0?= =?us-ascii?Q?3ZGW8e7gZpruU71HMGDG7cz3CkbgEKvcfUwncmGYvZ/lqs+qep85/eGYhDZ2?= =?us-ascii?Q?f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5GQxru8EoYH4g8Gn?= =?us-ascii?Q?xTkD3FvK+vFo8/gDt2yeh+9eRJuXN2O0kHvulq5jo2UMqLKvO1jL/RF8sYoX?= =?us-ascii?Q?y3OaXnehZRk13aSGfGdgEvtG61wLN/2AZ5NOekM+OnWrRhqrJozqlSdqnhDe?= =?us-ascii?Q?ruFwlCJrHjwZYb425xJsJRZNbgKpebmx29qZXVBESqgoWigd72MNAC/pUAFQ?= =?us-ascii?Q?TeBMLmpISx1vrmgf1VfxzRu8?= X-OriginatorOrg: yahoo-corp.jp X-MS-Exchange-CrossTenant-Network-Message-Id: 0d076d6c-13b6-45e7-8d05-08d97342daba X-MS-Exchange-CrossTenant-AuthSource: TY2PR01MB2010.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2021 03:35:22.6039 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a208d369-cd4e-4f87-b119-98eaf31df2c3 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WFn1dWViaxOEZ+41fjTFv8OYA8UE25vanuFdoiUsxEtbqaeSINwA+kfv1DtKywtNKr6YYF+QLrGGY+hxhq+sJw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYAPR01MB6283 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: aoiwa@yahoo-corp.jp, Hiroki Narukawa X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-ZM-MESSAGEID: 1631158565122100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The option "queue-size" in virtio-blk was added in qemu-2.12.0, and default= value increased from qemu-5.0.0. However, increasing this value may lead to drop of random access performanc= e. This is configurable value, so we want to use it via libvirt. Signed-off-by: Hiroki Narukawa Reviewed-by: Peter Krempa --- src/qemu/qemu_command.c | 3 ++ src/qemu/qemu_validate.c | 7 ++++ .../disk-virtio-queue-size.args | 35 +++++++++++++++++ .../disk-virtio-queue-size.x86_64-latest.args | 35 +++++++++++++++++ .../disk-virtio-queue-size.xml | 38 +++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + .../disk-virtio-queue-size.x86_64-latest.xml | 38 +++++++++++++++++++ .../disk-virtio-queue-size.xml | 35 +++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 9 files changed, 193 insertions(+) create mode 100644 tests/qemuxml2argvdata/disk-virtio-queue-size.args create mode 100644 tests/qemuxml2argvdata/disk-virtio-queue-size.x86_64-la= test.args create mode 100644 tests/qemuxml2argvdata/disk-virtio-queue-size.xml create mode 100644 tests/qemuxml2xmloutdata/disk-virtio-queue-size.x86_64-= latest.xml create mode 100644 tests/qemuxml2xmloutdata/disk-virtio-queue-size.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index b230314f7f..f0319d2234 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1738,6 +1738,9 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, if (disk->queues) { virBufferAsprintf(&opt, ",num-queues=3D%u", disk->queues); } + if (disk->queue_size > 0) { + virBufferAsprintf(&opt, ",queue-size=3D%u", disk->queue_size); + } =20 qemuBuildVirtioOptionsStr(&opt, disk->virtio); =20 diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 1a470f1ff5..16ccf2e76d 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -2823,6 +2823,13 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDom= ainDiskDef *disk, "QEMU binary")); return -1; } + if (disk->queue_size && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_NUM_QUEUES)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("queue-size property isn't supported by this " + "QEMU binary")); + return -1; + } break; =20 case VIR_DOMAIN_DISK_BUS_USB: diff --git a/tests/qemuxml2argvdata/disk-virtio-queue-size.args b/tests/qem= uxml2argvdata/disk-virtio-queue-size.args new file mode 100644 index 0000000000..2985e1726c --- /dev/null +++ b/tests/qemuxml2argvdata/disk-virtio-queue-size.args @@ -0,0 +1,35 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-i386 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dp= c.ram \ +-cpu qemu64 \ +-m 214 \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}'= \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ +-blockdev '{"driver":"file","filename":"/tmp/data.img","node-name":"libvir= t-1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw= ","file":"libvirt-1-storage"}' \ +-device virtio-blk-pci,queue-size=3D4,bus=3Dpci.0,addr=3D0x3,drive=3Dlibvi= rt-1-format,id=3Dvirtio-disk0,bootindex=3D1 \ +-audiodev id=3Daudio1,driver=3Dnone \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/disk-virtio-queue-size.x86_64-latest.ar= gs b/tests/qemuxml2argvdata/disk-virtio-queue-size.x86_64-latest.args new file mode 100644 index 0000000000..2985e1726c --- /dev/null +++ b/tests/qemuxml2argvdata/disk-virtio-queue-size.x86_64-latest.args @@ -0,0 +1,35 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-i386 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dp= c.ram \ +-cpu qemu64 \ +-m 214 \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}'= \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ +-blockdev '{"driver":"file","filename":"/tmp/data.img","node-name":"libvir= t-1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw= ","file":"libvirt-1-storage"}' \ +-device virtio-blk-pci,queue-size=3D4,bus=3Dpci.0,addr=3D0x3,drive=3Dlibvi= rt-1-format,id=3Dvirtio-disk0,bootindex=3D1 \ +-audiodev id=3Daudio1,driver=3Dnone \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/disk-virtio-queue-size.xml b/tests/qemu= xml2argvdata/disk-virtio-queue-size.xml new file mode 100644 index 0000000000..1cd3f830e5 --- /dev/null +++ b/tests/qemuxml2argvdata/disk-virtio-queue-size.xml @@ -0,0 +1,38 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + qemu64 + + + destroy + restart + destroy + + /usr/bin/qemu-system-i386 + + + + +
+ + +
+ + +
+ + + + +