From nobody Sun Feb 8 01:49:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1741015893082267.2274756751375; Mon, 3 Mar 2025 07:31:33 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id ED35C148C; Mon, 3 Mar 2025 10:31:31 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id CE0EA13A3; Mon, 3 Mar 2025 10:31:00 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id A40871392; Mon, 3 Mar 2025 10:30:57 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 2271711CB for ; Mon, 3 Mar 2025 10:30:57 -0500 (EST) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-695-kCAfQBctNPeWSabC_Dj5JA-1; Mon, 03 Mar 2025 10:30:55 -0500 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 22B681944EB0 for ; Mon, 3 Mar 2025 15:30:54 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.15]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 043691956094; Mon, 3 Mar 2025 15:30:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741015856; 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=NCbYvcnv63M78AXi1iiXWfaek+GW6kWokJfCYr86rro=; b=T0POs55RuzHm4z5G6BT6OgGf0Es13octQVdMp9qw3t4LnJybJNQiQGARC3RXNg1V8dLXpa bVnUVUTmvVjStEA3ZZzY/JE49zLRXnKelE/qcb9lxpnxusa2DWbS5v2q4an3sdxEN9ZWtF Af1Y6IhmaioknToujafajrQw7LP0/J0= X-MC-Unique: kCAfQBctNPeWSabC_Dj5JA-1 X-Mimecast-MFC-AGG-ID: kCAfQBctNPeWSabC_Dj5JA_1741015854 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v2 01/11] qemu: Use modern header formatting in 'qemu_command.h' Date: Mon, 3 Mar 2025 16:30:39 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 4p33im5mv81gO4ljNbmICK5TRYl5XE70kZXysOyBX9E_1741015854 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: I2AXTQFIZY7I4JIOKK7BDJT5DXQZJNGM X-Message-ID-Hash: I2AXTQFIZY7I4JIOKK7BDJT5DXQZJNGM X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Stefan Hajnoczi X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1741015898211019100 Content-Type: text/plain; charset="utf-8" The file used intermixed style. Convert the last outliers to the new formatting style. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.h | 85 ++++++++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 35 deletions(-) diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 76c514b5f7..7c891a6c98 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -40,31 +40,37 @@ VIR_ENUM_DECL(qemuVideo); VIR_ENUM_DECL(qemuSoundCodec); -virCommand *qemuBuildCommandLine(virDomainObj *vm, - const char *migrateURI, - virDomainMomentObj *snapshot, - virNetDevVPortProfileOp vmop, - size_t *nnicindexes, - int **nicindexes); +virCommand * +qemuBuildCommandLine(virDomainObj *vm, + const char *migrateURI, + virDomainMomentObj *snapshot, + virNetDevVPortProfileOp vmop, + size_t *nnicindexes, + int **nicindexes); /* Generate the object properties for pr-manager */ -virJSONValue *qemuBuildPRManagerInfoProps(virStorageSource *src); -virJSONValue *qemuBuildPRManagedManagerInfoProps(qemuDomainObjPrivate *pri= v); +virJSONValue * +qemuBuildPRManagerInfoProps(virStorageSource *src); +virJSONValue * +qemuBuildPRManagedManagerInfoProps(qemuDomainObjPrivate *priv); -virJSONValue *qemuBuildDBusVMStateInfoProps(virQEMUDriver *driver, - virDomainObj *vm); +virJSONValue * +qemuBuildDBusVMStateInfoProps(virQEMUDriver *driver, + virDomainObj *vm); /* Generate the object properties for a secret */ -int qemuBuildSecretInfoProps(qemuDomainSecretInfo *secinfo, - virJSONValue **propsret); +int +qemuBuildSecretInfoProps(qemuDomainSecretInfo *secinfo, + virJSONValue **propsret); /* Generate the object properties for a tls-creds-x509 */ -int qemuBuildTLSx509BackendProps(const char *tlspath, - bool isListen, - bool verifypeer, - const char *alias, - const char *secalias, - virJSONValue **propsret); +int +qemuBuildTLSx509BackendProps(const char *tlspath, + bool isListen, + bool verifypeer, + const char *alias, + const char *secalias, + virJSONValue **propsret); /* Open a UNIX socket for chardev FD passing */ int @@ -93,7 +99,8 @@ qemuBuildNicDevProps(virDomainDef *def, virDomainNetDef *net, virQEMUCaps *qemuCaps); -bool qemuDiskBusIsSD(int bus); +bool +qemuDiskBusIsSD(int bus); int qemuBuildStorageSourceAttachPrepareCommon(virStorageSource *src, @@ -134,15 +141,16 @@ qemuBuildControllerDevProps(const virDomainDef *domai= nDef, virQEMUCaps *qemuCaps, virJSONValue **devprops); -int qemuBuildMemoryBackendProps(virJSONValue **backendProps, - const char *alias, - virQEMUDriverConfig *cfg, - qemuDomainObjPrivate *priv, - const virDomainDef *def, - const virDomainMemoryDef *mem, - bool force, - bool systemMemory, - virBitmap **nodemaskRet); +int +qemuBuildMemoryBackendProps(virJSONValue **backendProps, + const char *alias, + virQEMUDriverConfig *cfg, + qemuDomainObjPrivate *priv, + const virDomainDef *def, + const virDomainMemoryDef *mem, + bool force, + bool systemMemory, + virBitmap **nodemaskRet); virJSONValue * qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg, @@ -166,8 +174,9 @@ virJSONValue * qemuBuildRNGDevProps(const virDomainDef *def, virDomainRNGDef *dev, virQEMUCaps *qemuCaps); -int qemuBuildRNGBackendProps(virDomainRNGDef *rng, - virJSONValue **props); +int +qemuBuildRNGBackendProps(virDomainRNGDef *rng, + virJSONValue **props); /* Current, best practice */ virJSONValue * @@ -210,10 +219,12 @@ qemuBuildZPCIDevProps(virDomainDeviceInfo *dev); bool qemuDiskConfigBlkdeviotuneEnabled(const virDomainDiskDef *disk); -virJSONValue *qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu) +virJSONValue * +qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu) ATTRIBUTE_NONNULL(1); -virJSONValue *qemuBuildShmemBackendMemProps(virDomainShmemDef *shmem) +virJSONValue * +qemuBuildShmemBackendMemProps(virDomainShmemDef *shmem) ATTRIBUTE_NONNULL(1); bool @@ -254,6 +265,10 @@ qemuBuildTPMOpenBackendFDs(const char *tpmdev, int *cancelfd) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) G_NO_IN= LINE; -const char * qemuAudioDriverTypeToString(virDomainAudioType type); -virDomainAudioType qemuAudioDriverTypeFromString(const char *str); -int qemuVDPAConnect(const char *devicepath) G_NO_INLINE; +const char * +qemuAudioDriverTypeToString(virDomainAudioType type); +virDomainAudioType +qemuAudioDriverTypeFromString(const char *str); + +int +qemuVDPAConnect(const char *devicepath) G_NO_INLINE; --=20 2.48.1 From nobody Sun Feb 8 01:49:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1741016081467245.55897440048875; Mon, 3 Mar 2025 07:34:41 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id D3BDC13A3; Mon, 3 Mar 2025 10:34:40 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 97735146A; Mon, 3 Mar 2025 10:31:36 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 0B806140F; Mon, 3 Mar 2025 10:31:32 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id E3021140F for ; Mon, 3 Mar 2025 10:31:12 -0500 (EST) Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-127-6otzaI2dPduq7xfCfNvxIQ-1; Mon, 03 Mar 2025 10:30:56 -0500 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C636A19540FC for ; Mon, 3 Mar 2025 15:30:55 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.15]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A79AB1956094; Mon, 3 Mar 2025 15:30:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741015872; 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=EstpYF34/X5PvMOTUK4mJjoEARpW5mSmcvLJPcBruxI=; b=gMkVI2H7u1owIXm5AWSJIfo8zo0At/c59TIU2sLQsXM7cXQ7wDFdUo++nyuNLCbJ0bPzLv KJ+4eKNQkE7z1WrgGHYygiQOLlssMnd0M4vklcQ0aCkRasA25W8klsr9nWVPUC0ixIJ4YR rdeGdQKOLpC4+oNGiPxG3U677uBRYQk= X-MC-Unique: 6otzaI2dPduq7xfCfNvxIQ-1 X-Mimecast-MFC-AGG-ID: 6otzaI2dPduq7xfCfNvxIQ_1741015855 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v2 02/11] virXMLNodeGetSubelementList: Document return value semantics Date: Mon, 3 Mar 2025 16:30:40 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: AQs7IiUlbMtNBdKVyT7OoaK8QFMt10ZUBSwr6H6VmEQ_1741015855 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: IZYVDDBZRL4AAT535UYQ4QS775WEE265 X-Message-ID-Hash: IZYVDDBZRL4AAT535UYQ4QS775WEE265 X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Stefan Hajnoczi X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1741016082181019000 Content-Type: text/plain; charset="utf-8" The returned value is always non-NULL. Callers need to check the lenght of the returned array instead. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/virxml.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util/virxml.c b/src/util/virxml.c index 670cace4ab..d5c7ebaf22 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -909,6 +909,8 @@ virXMLNodeGetSubelement(xmlNodePtr node, * Find and return a sub-elements node of @node named @name in a GPtrArray * populated with the xmlNodePtr objects. Caller is responsible for freein= g the * array but not the contained xmlNode objects. + * + * Note: The returned GPtrArray is non-NULL even if @node doesn't contain = such sub-elements */ GPtrArray * virXMLNodeGetSubelementList(xmlNodePtr node, --=20 2.48.1 From nobody Sun Feb 8 01:49:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1741015945527559.3211752522953; Mon, 3 Mar 2025 07:32:25 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id EC0A613BF; Mon, 3 Mar 2025 10:32:24 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 8B97213AF; Mon, 3 Mar 2025 10:31:11 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 16DA7139B; Mon, 3 Mar 2025 10:31:07 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id AB77A1371 for ; Mon, 3 Mar 2025 10:31:00 -0500 (EST) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-53-wkl2iPLIPtSPoCBoYxyZUg-1; Mon, 03 Mar 2025 10:30:59 -0500 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7AFC81801A20 for ; Mon, 3 Mar 2025 15:30:57 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.15]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5F72B1956094; Mon, 3 Mar 2025 15:30:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741015860; 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=pTgc/diqAieXscLClQwYl0+UXOCDB8zxSRMwmjAgbHs=; b=LkRY3Mrh/g8ks3Ft9/OlU8hMpja5HKZsKhHujh100oOfr3768/C+x2qVZ0KhXPxiCfOoPL vqa5OFcOhTbIo+bNo8TTclkvCSE2xY990ZisDEZVztz7RcWXdlOgSzuvhrDEFZxUN25eYL IoUOg0nywrnbyRidDpG30jbTr+jhs2E= X-MC-Unique: wkl2iPLIPtSPoCBoYxyZUg-1 X-Mimecast-MFC-AGG-ID: wkl2iPLIPtSPoCBoYxyZUg_1741015857 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v2 03/11] virDomainIothreadMappingDefParse: Fix usage of virXMLNodeGetSubelementList Date: Mon, 3 Mar 2025 16:30:41 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: CQhFey89E8C-AZ5VCo0ZFidQSpM5zIpzLxSbOLZnAeM_1741015857 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: EOT2XWC3C6XXTVILE2IA46LHYIJKV6O7 X-Message-ID-Hash: EOT2XWC3C6XXTVILE2IA46LHYIJKV6O7 X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Stefan Hajnoczi X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1741015947830019000 Content-Type: text/plain; charset="utf-8" virXMLNodeGetSubelementList always returns a non-NULL pointers thus we should check the lenght instead. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5630a469be..2b9955a1a0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7950,19 +7950,21 @@ virDomainIothreadMappingDefParse(xmlNodePtr driverN= ode, if (!(iothreadsNode =3D virXMLNodeGetSubelement(driverNode, "iothreads= "))) return 0; - if (!(iothreadNodes =3D virXMLNodeGetSubelementList(iothreadsNode, "io= thread"))) + iothreadNodes =3D virXMLNodeGetSubelementList(iothreadsNode, "iothread= "); + + if (iothreadNodes->len =3D=3D 0) return 0; for (i =3D 0; i < iothreadNodes->len; i++) { xmlNodePtr iothNode =3D g_ptr_array_index(iothreadNodes, i); g_autoptr(virDomainIothreadMappingDef) iothdef =3D g_new0(virDomai= nIothreadMappingDef, 1); - g_autoptr(GPtrArray) queueNodes =3D NULL; + g_autoptr(GPtrArray) queueNodes =3D virXMLNodeGetSubelementList(io= thNode, "queue"); if (virXMLPropUInt(iothNode, "id", 10, VIR_XML_PROP_REQUIRED, &iothdef->id) < 0) return -1; - if ((queueNodes =3D virXMLNodeGetSubelementList(iothNode, "queue")= )) { + if (queueNodes->len > 0) { size_t q; iothdef->queues =3D g_new0(unsigned int, queueNodes->len); --=20 2.48.1 From nobody Sun Feb 8 01:49:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1741015968211625.5498818884674; Mon, 3 Mar 2025 07:32:48 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 341D21443; Mon, 3 Mar 2025 10:32:47 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 2FD701482; Mon, 3 Mar 2025 10:31:16 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 83B1213EB; Mon, 3 Mar 2025 10:31:12 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 7EE4F13E3 for ; Mon, 3 Mar 2025 10:31:01 -0500 (EST) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-523-mTO3NnNtPQKD1d_b3JZbGw-1; Mon, 03 Mar 2025 10:30:59 -0500 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1897A1801A31 for ; Mon, 3 Mar 2025 15:30:59 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.15]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0562D1956094; Mon, 3 Mar 2025 15:30:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741015861; 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=McfH4DOVKE44iWgUx7dwLSAhz7Zf2rhHMJ+oum4YNjo=; b=VeDsmOZ0Pezqi1rlITyKmJJy/mIA9gYE6E98MAZvqC+FtR2PnNT+IAL3SoTTWCeIjl8+cO IWRjspERIcF3fpE0KogkxP9XY4j2oyp3pZ29sxlGraePkoJ0CwC9J6JH9uwNte3K9EIaA0 xJZeryze+S1Y7HokF4DEcORxtd66OFQ= X-MC-Unique: mTO3NnNtPQKD1d_b3JZbGw-1 X-Mimecast-MFC-AGG-ID: mTO3NnNtPQKD1d_b3JZbGw_1741015859 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v2 04/11] docs: formatdomain: Clarify configuration of iothread <-> virtqueue mapping Date: Mon, 3 Mar 2025 16:30:42 +0100 Message-ID: <1a38bb8219788265b1295a04056689184e651f93.1741015346.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: HMRBEvExHmRPq1Xueissvop5jammsMxZdZxCKCivk2Y_1741015859 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: BIIHCP4IYAZ2HMNLWN36EYJHIIRYZGY4 X-Message-ID-Hash: BIIHCP4IYAZ2HMNLWN36EYJHIIRYZGY4 X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Stefan Hajnoczi X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1741015969806019100 Content-Type: text/plain; charset="utf-8" Add an example for the automatic/round-robin mapping of iothreads which users should preferrably use. Until now the example contained even the full mapping which could push users to use that instead. Mention that the queues are then automatically distributed among the iothreads. Also clarify the need to set 'queues' when mapping threads explicitly and how the queues are identified. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- docs/formatdomain.rst | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index cbe378e61d..29f3c84780 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -3442,10 +3442,27 @@ paravirtualized driver is specified via the ``disk`= ` element. *Note:* ``iothread`` is mutually exclusive with ``iothreads``. - The optional ``iothreads`` sub-element allows specifying multiple IO= Threads via the ``iothread`` sub-element with attribute ``id`` the disk wil= l use - for I/O operations. Optionally the ``iothread`` element can have mul= tiple - ``queue`` subelements specifying that given iothread should be used = to - handle given queues. :since:`Since 10.0.0 (QEMU 9.0, virtio disks on= ly)`. - Example:: + for I/O operations. The virt queues (see ``queues`` attribute below)= are + automatically distributed among the configured iothreads. + + Optionally the ``iothread`` element can have multiple ``queue`` + subelements with mandatory ``id`` atribute specifying that the iothr= ead + should be used to handle given virt queue. If queue mapping is prese= nt + the ``queues`` attribute of ``driver`` (see below) must be configur= ed + and all configured virt queues must be included in the mapping. The + ``virtio-blk`` device exposes request virt queues ``0`` to ``N-1`` + where N is the number of queues configured for the device. + + :since:`Since 10.0.0 (QEMU 9.0, virtio disks only)`. + + Examples:: + + + + + + + --=20 2.48.1 From nobody Sun Feb 8 01:49:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1741016150853201.83196438671712; Mon, 3 Mar 2025 07:35:50 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 49C631435; Mon, 3 Mar 2025 10:35:50 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id B596514C2; Mon, 3 Mar 2025 10:31:44 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id AB08B145B; Mon, 3 Mar 2025 10:31:37 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id E37011488 for ; Mon, 3 Mar 2025 10:31:17 -0500 (EST) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-587-Hdhkrfb0OFW22sgOIK39TA-1; Mon, 03 Mar 2025 10:31:01 -0500 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C9D0C1800374 for ; Mon, 3 Mar 2025 15:31:00 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.15]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 939591956094; Mon, 3 Mar 2025 15:30:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741015877; 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=Enys1d723jyiGZw050bFgac5TSK4bm/fKXIgpK7/SYY=; b=XcF8hG7v5oLu8o+66KR5wOvaxCuXGWuS8RZBMeEkB+Okz6MvnwbFxIczqLrlY/41bPw0WP GL14BschUVYnYF6XvLprYjFsjd5aLdnWBX86lr3zyBaJ7YvykuLg3VeIepwcfRDD6fjtT5 LYZW3zYsHQURartaaggkh+cBqYFkjp8= X-MC-Unique: Hdhkrfb0OFW22sgOIK39TA-1 X-Mimecast-MFC-AGG-ID: Hdhkrfb0OFW22sgOIK39TA_1741015860 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v2 05/11] qemucapabilitiestest: Update 'caps_10.0.0_x86_64' to XXXXXX Date: Mon, 3 Mar 2025 16:30:43 +0100 Message-ID: <81455cc9527b1172e80f9ff9779c1bd4bdf85a5a.1741015346.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: NvAnP6XCtoquvTI71E9jaJ1bdGqc4SoYRzK0Y8l0BwY_1741015860 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 4N2RWDJ5XZ6MEXKXDCUY5MWMLC6HKPVV X-Message-ID-Hash: 4N2RWDJ5XZ6MEXKXDCUY5MWMLC6HKPVV X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Stefan Hajnoczi X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1741016152732019000 Content-Type: text/plain; charset="utf-8" Notable changes: - 'virtio-scsi' supports 'iothread-vq-mapping' - 'nbd-server-start' command supports 'handshake-max-seconds' argument --- tests/qemucapabilitiesdata/caps_10.0.0_x86_64.replies | 7 ++++++- tests/qemucapabilitiesdata/caps_10.0.0_x86_64.xml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/qemucapabilitiesdata/caps_10.0.0_x86_64.replies b/tests/= qemucapabilitiesdata/caps_10.0.0_x86_64.replies index 4ac65390b4..264516201e 100644 --- a/tests/qemucapabilitiesdata/caps_10.0.0_x86_64.replies +++ b/tests/qemucapabilitiesdata/caps_10.0.0_x86_64.replies @@ -20,7 +20,7 @@ "minor": 2, "major": 9 }, - "package": "v9.2.0-1967-gb69801dd6b" + "package": "v9.2.0-1979-gfdb6913c23" }, "id": "libvirt-2" } @@ -28064,6 +28064,11 @@ "description": "on/off", "type": "bool" }, + { + "name": "iothread-vq-mapping", + "description": "IOThread virtqueue mapping list [{\"iothread\":\"\", \"vqs\":[1,2,3,...]},...]", + "type": "IOThreadVirtQueueMappingList" + }, { "default-value": 4294967295, "name": "num_queues", diff --git a/tests/qemucapabilitiesdata/caps_10.0.0_x86_64.xml b/tests/qemu= capabilitiesdata/caps_10.0.0_x86_64.xml index 358e06b803..6694d7562f 100644 --- a/tests/qemucapabilitiesdata/caps_10.0.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_10.0.0_x86_64.xml @@ -214,7 +214,7 @@ 9002050 43100285 - v9.2.0-1967-gb69801dd6b + v9.2.0-1979-gfdb6913c23 x86_64 --=20 2.48.1 From nobody Sun Feb 8 01:49:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1741015989340488.240466122837; Mon, 3 Mar 2025 07:33:09 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 4F99C1496; Mon, 3 Mar 2025 10:33:08 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 3A6F7144A; Mon, 3 Mar 2025 10:31:24 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 449FE139A; Mon, 3 Mar 2025 10:31:19 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id C29FE1442 for ; Mon, 3 Mar 2025 10:31:04 -0500 (EST) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-376-HC1DI8QdOPy2nLZ2gckTEg-1; Mon, 03 Mar 2025 10:31:03 -0500 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6D18E1944D33 for ; Mon, 3 Mar 2025 15:31:02 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.15]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2E4371956094; Mon, 3 Mar 2025 15:31:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741015864; 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=SyaxmSJH0eQHXMYXq07ZGyNcpKVEPqjhT8CRb6V4wJ4=; b=SwMq//P/g9o3x2QLJWNnF5lUD+l1CNMFU3ZnANNJvYmvubG1w2v9cXImQAWg8Y1JRbHX06 LtAjSS8eC6p3wC5RT4cQdAYO3xJ6FY9zgwBTPFiB8+pzufzOxMKiN+hE2C57QWRgkROCP5 pd2tuzWB4RaC9m0sPWSuOjVq+A0IA6s= X-MC-Unique: HC1DI8QdOPy2nLZ2gckTEg-1 X-Mimecast-MFC-AGG-ID: HC1DI8QdOPy2nLZ2gckTEg_1741015862 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v2 06/11] qemu: capabilities: Introduce QEMU_CAPS_VIRTIO_SCSI_IOTHREAD_MAPPING Date: Mon, 3 Mar 2025 16:30:44 +0100 Message-ID: <77e89401e4b7b18bddf59afd8ecd5b64d241c3b3.1741015346.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: VT0sb7ikQEARs-JBPMUspvj-v7uMyGMHBTfuFxFkCs8_1741015862 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: R3NL3LH5QYG67JQ2TTQCGNJXZW7PKOTK X-Message-ID-Hash: R3NL3LH5QYG67JQ2TTQCGNJXZW7PKOTK X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Stefan Hajnoczi X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1741015991827019100 Content-Type: text/plain; charset="utf-8" The 'virtio-scsi' controller now supports iothread<->virtqueue mapping configuration. Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_10.0.0_x86_64.xml | 1 + 3 files changed, 4 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 23b466c36e..19511e2333 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -728,6 +728,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "machine.virt.aia", /* QEMU_CAPS_MACHINE_VIRT_AIA */ "virtio-mem-ccw", /* QEMU_CAPS_DEVICE_VIRTIO_MEM_CCW */ "blockdev-set-active", /* QEMU_CAPS_BLOCKDEV_SET_ACTIVE */ + "virtio-scsi.iothread-mapping", /* QEMU_CAPS_VIRTIO_SCSI_IOT= HREAD_MAPPING */ ); @@ -1478,6 +1479,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCaps= DevicePropsSpaprPCIHostBrid static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioSCSI= [] =3D { { "acpi-index", QEMU_CAPS_ACPI_INDEX, NULL }, + { "iothread-vq-mapping", QEMU_CAPS_VIRTIO_SCSI_IOTHREAD_MAPPING, NULL = }, }; static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVfioPCI[] = =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index ee71331a09..feca9bd185 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -707,6 +707,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ QEMU_CAPS_MACHINE_VIRT_AIA, /* -machine virt,aia=3D(none|aplic|aplic-i= msic), RISC-V only */ QEMU_CAPS_DEVICE_VIRTIO_MEM_CCW, /* -device virtio-mem-ccw */ QEMU_CAPS_BLOCKDEV_SET_ACTIVE, /* blockdev-set-active QMP command supp= orted */ + QEMU_CAPS_VIRTIO_SCSI_IOTHREAD_MAPPING, /* virtio-scsi supports per-vi= rtqueue iothread mapping */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_10.0.0_x86_64.xml b/tests/qemu= capabilitiesdata/caps_10.0.0_x86_64.xml index 6694d7562f..2ce6c5e62d 100644 --- a/tests/qemucapabilitiesdata/caps_10.0.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_10.0.0_x86_64.xml @@ -212,6 +212,7 @@ + 9002050 43100285 v9.2.0-1979-gfdb6913c23 --=20 2.48.1 From nobody Sun Feb 8 01:49:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1741016025329285.2381561980684; Mon, 3 Mar 2025 07:33:45 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 91DB31450; Mon, 3 Mar 2025 10:33:44 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id E19811353; Mon, 3 Mar 2025 10:31:25 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 7DDF8126A; Mon, 3 Mar 2025 10:31:22 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 6947C1392 for ; Mon, 3 Mar 2025 10:31:06 -0500 (EST) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-318-WfrRYwkYMVSkazg7oKFX3Q-1; Mon, 03 Mar 2025 10:31:04 -0500 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0B2FF1801BC4 for ; Mon, 3 Mar 2025 15:31:04 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.15]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EAE811956094; Mon, 3 Mar 2025 15:31:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741015866; 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=0J/HHVMyOpuaqCFzcg4IXpyOZe9GtaPipoQQPu6ZdMQ=; b=dQYaNHGLANMIf+l3v5QHOjN7XFwGd1h+CMOU9jmgVno354TSqn/VI4N8r8sWpZ7TVpSjKe s1I6JW4LFiSiGplE1UCUv/ywH6ujzoLoK77n23wj3RoQ+h6JxD0UkRcVgjNMxPiVM+6nZ3 02dR0yPNavCs2ik0SS3AFfprTo/Tflw= X-MC-Unique: WfrRYwkYMVSkazg7oKFX3Q-1 X-Mimecast-MFC-AGG-ID: WfrRYwkYMVSkazg7oKFX3Q_1741015864 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v2 07/11] virDomainIothreadMapping: Add support for naming certain virt queues Date: Mon, 3 Mar 2025 16:30:45 +0100 Message-ID: <2801695af62a309c5219dfcb9581bd6e6c3ce9bf.1741015346.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: IKJ9Y1QIy7TQX-KYzb0rnHC1wJEIsxDELwosF0jPIFI_1741015864 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: KOE6FMD4RAWTM6LG3V26ANVJIB5EVM4U X-Message-ID-Hash: KOE6FMD4RAWTM6LG3V26ANVJIB5EVM4U X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Stefan Hajnoczi X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1741016026120019000 Content-Type: text/plain; charset="utf-8" The 'virtio-scsi' device has two extra queues 'ctrl' and 'event'. Convert the existing code to treat the 'id' virtqueue attribute as a string so that we can use the names of the queues instead of making the user refer to them via magic numbers. This patch converts the code to store the strings instead and modifies the qemu code to pass a mapping hash table to lookup the numbers that qemu understands. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 14 ++++---- src/conf/domain_conf.h | 3 +- src/qemu/qemu_command.c | 64 +++++++++++++++++++++++++++++++----- src/qemu/qemu_command.h | 8 +++++ src/qemu/qemu_domain.c | 10 +++--- src/qemu/qemu_validate.c | 71 +++++++++++++++++++++++----------------- 6 files changed, 116 insertions(+), 54 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2b9955a1a0..bb82264758 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2373,7 +2373,7 @@ virDomainIothreadMappingDefFree(virDomainIothreadMapp= ingDef *def) if (!def) return; - g_free(def->queues); + g_strfreev(def->queues); g_free(def); } @@ -7967,14 +7967,12 @@ virDomainIothreadMappingDefParse(xmlNodePtr driverN= ode, if (queueNodes->len > 0) { size_t q; - iothdef->queues =3D g_new0(unsigned int, queueNodes->len); - iothdef->nqueues =3D queueNodes->len; + iothdef->queues =3D g_new0(char *, queueNodes->len + 1); for (q =3D 0; q < queueNodes->len; q++) { xmlNodePtr queueNode =3D g_ptr_array_index(queueNodes, q); - if (virXMLPropUInt(queueNode, "id", 10, VIR_XML_PROP_REQUI= RED, - &(iothdef->queues[q])) < 0) + if (!(iothdef->queues[q] =3D virXMLPropStringRequired(queu= eNode, "id"))) return -1; } } @@ -23182,10 +23180,10 @@ virDomainIothreadMappingDefFormat(virBuffer *buf, virBufferAsprintf(&iothreadAttrBuf, " id=3D'%u'", iothDef->id); if (iothDef->queues) { - size_t q; + char **q; - for (q =3D 0; q < iothDef->nqueues; q++) - virBufferAsprintf(&iothreadChildBuf, "\n= ", iothDef->queues[q]); + for (q =3D iothDef->queues; *q; q++) + virBufferEscapeString(&iothreadChildBuf, "\n", *q); } virXMLFormatElement(&iothreadsChildBuf, "iothread", &iothreadAttrB= uf, &iothreadChildBuf); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index d4fa79cb84..d56a5a22e0 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -511,8 +511,7 @@ struct _virDomainIothreadMappingDef { unsigned int id; /* optional list of virtqueues the iothread should handle */ - unsigned int *queues; - size_t nqueues; + char **queues; }; typedef struct _virDomainIothreadMappingDef virDomainIothreadMappingDef; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 0ad73af335..14d62b98e4 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1574,7 +1574,8 @@ qemuBuildDriveStr(virDomainDiskDef *disk) static virJSONValue * -qemuBuildIothreadMappingProps(GSList *iothreads) +qemuBuildIothreadMappingProps(GSList *iothreads, + GHashTable *queuemap) { g_autoptr(virJSONValue) ret =3D virJSONValueNewArray(); GSList *n; @@ -1584,13 +1585,20 @@ qemuBuildIothreadMappingProps(GSList *iothreads) g_autoptr(virJSONValue) props =3D NULL; g_autoptr(virJSONValue) queues =3D NULL; g_autofree char *alias =3D g_strdup_printf("iothread%u", ioth->id); - size_t i; - if (ioth->nqueues > 0) { + if (ioth->queues) { + char **q; queues =3D virJSONValueNewArray(); - for (i =3D 0; i < ioth->nqueues; i++) { - g_autoptr(virJSONValue) vq =3D virJSONValueNewNumberUint(i= oth->queues[i]); + for (q =3D ioth->queues; *q; q++) { + g_autoptr(virJSONValue) vq =3D NULL; + struct qemuVirtioIothreadMap *mapent; + + if (!(mapent =3D g_hash_table_lookup(queuemap, *q))) { + return NULL; + } + + vq =3D virJSONValueNewNumberUint(mapent->id); if (virJSONValueArrayAppend(queues, &vq)) return NULL; @@ -1612,6 +1620,43 @@ qemuBuildIothreadMappingProps(GSList *iothreads) } +static GHashTable * +qemuCommandGetVirtioIothreadMap(size_t nqueues, + const char **internal_queues) +{ + g_autoptr(GHashTable) ret =3D virHashNew(g_free); + size_t qid =3D 0; + const char **q; + size_t i; + + for (q =3D internal_queues; q && *q; q++) { + struct qemuVirtioIothreadMap *ent =3D g_new0(struct qemuVirtioIoth= readMap, 1); + + ent->id =3D qid++; + + g_hash_table_insert(ret, g_strdup(*q), ent); + } + + + for (i =3D 0; i < nqueues; i++) { + struct qemuVirtioIothreadMap *ent =3D g_new0(struct qemuVirtioIoth= readMap, 1); + + ent->id =3D qid++; + + g_hash_table_insert(ret, g_strdup_printf("%zu", i), ent); + } + + return g_steal_pointer(&ret); +} + + +GHashTable * +qemuCommandGetVirtioIothreadMapVirtioBlk(const virDomainDiskDef *disk) +{ + return qemuCommandGetVirtioIothreadMap(disk->queues, NULL); +} + + virJSONValue * qemuBuildDiskDeviceProps(const virDomainDef *def, virDomainDiskDef *disk, @@ -1686,9 +1731,12 @@ qemuBuildDiskDeviceProps(const virDomainDef *def, if (disk->iothread > 0) iothread =3D g_strdup_printf("iothread%u", disk->iothread); - if (disk->iothreads && - !(iothreadMapping =3D qemuBuildIothreadMappingProps(disk->ioth= reads))) - return NULL; + if (disk->iothreads) { + g_autoptr(GHashTable) queuemap =3D qemuCommandGetVirtioIothrea= dMapVirtioBlk(disk); + + if (!(iothreadMapping =3D qemuBuildIothreadMappingProps(disk->= iothreads, queuemap))) + return NULL; + } if (virStorageSourceGetActualType(disk->src) !=3D VIR_STORAGE_TYPE= _VHOST_USER && virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_SCSI)) { diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 7c891a6c98..636c2571d4 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -272,3 +272,11 @@ qemuAudioDriverTypeFromString(const char *str); int qemuVDPAConnect(const char *devicepath) G_NO_INLINE; + +struct qemuVirtioIothreadMap { + unsigned int id; + bool seen; +}; + +GHashTable * +qemuCommandGetVirtioIothreadMapVirtioBlk(const virDomainDiskDef *disk); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 8be2181156..d16429b6a2 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6646,7 +6646,6 @@ qemuDomainDiskChangeSupportedIothreads(virDomainDiskD= ef *disk, while (true) { virDomainIothreadMappingDef *old_def; virDomainIothreadMappingDef *new_def; - size_t i; /* match - both empty or both at the end */ if (!old && !new) @@ -6660,13 +6659,12 @@ qemuDomainDiskChangeSupportedIothreads(virDomainDis= kDef *disk, new_def =3D new->data; if (old_def->id !=3D new_def->id || - old_def->nqueues !=3D new_def->nqueues) + !!old_def->queues !=3D !!new_def->queues) goto fail; - for (i =3D 0; i < old_def->nqueues; i++) { - if (old_def->queues[i] !=3D new_def->queues[i]) - goto fail; - } + if (old_def->queues && + !g_strv_equal((const char **) old_def->queues, (const char **)= new_def->queues)) + goto fail; new =3D new->next; old =3D old->next; diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index f3ef1be660..f8586a7dff 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -2796,12 +2796,10 @@ qemuValidateDomainDeviceDefDiskSerial(const char *v= alue) static int qemuDomainValidateIothreadMapping(const virDomainDef *def, GSList *iothreads, - size_t queues) + GHashTable *queueMap) { virDomainIothreadMappingDef *first_ioth; - g_autoptr(virBitmap) queueMap =3D NULL; g_autoptr(GHashTable) iothreadMap =3D virHashNew(NULL); - ssize_t unused; GSList *n; if (!iothreads) @@ -2810,13 +2808,11 @@ qemuDomainValidateIothreadMapping(const virDomainDe= f *def, first_ioth =3D iothreads->data; if (first_ioth->queues) { - if (queues =3D=3D 0) { + if (!queueMap) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("'queue' count must be configured for explici= t iothread to queue mapping")); return -1; } - - queueMap =3D virBitmapNew(queues); } /* we are validating that: @@ -2831,7 +2827,6 @@ qemuDomainValidateIothreadMapping(const virDomainDef = *def, for (n =3D iothreads; n; n =3D n->next) { virDomainIothreadMappingDef *ioth =3D n->data; g_autofree char *alias =3D g_strdup_printf("iothread%u", ioth->id); - size_t i; if (g_hash_table_contains(iothreadMap, alias)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -2848,40 +2843,51 @@ qemuDomainValidateIothreadMapping(const virDomainDe= f *def, return -1; } - if (!!queueMap !=3D !!ioth->queues) { + if (!!first_ioth->queues !=3D !!ioth->queues) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("iothread to queue mapping must be provided f= or all iothreads or for none")); return -1; } - for (i =3D 0; i < ioth->nqueues; i++) { - bool hasMapping; + if (ioth->queues) { + char **q; - if (virBitmapGetBit(queueMap, ioth->queues[i], &hasMapping) < = 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("iothread queue '%1$u' mapping out of ran= ge"), - ioth->queues[i]); - return -1; - } + for (q =3D ioth->queues; *q; q++) { + struct qemuVirtioIothreadMap *mapent; - if (hasMapping) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("iothread queue '%1$u' is already assigne= d"), - ioth->queues[i]); - return -1; - } + if (!(mapent =3D g_hash_table_lookup(queueMap, *q))) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("iothread queue '%1$s' not available"= ), + *q); + return -1; + } - ignore_value(virBitmapSetBit(queueMap, ioth->queues[i])); + if (mapent->seen) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("iothread queue '%1$s' is already ass= igned"), + *q); + return -1; + } + mapent->seen =3D true; + } } } - if (queueMap) { - if ((unused =3D virBitmapNextClearBit(queueMap, -1)) >=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("missing iothread mapping for queue '%1$zd'"), - unused); - return -1; + if (queueMap && first_ioth->queues) { + GHashTableIter htitr; + char *name; + struct qemuVirtioIothreadMap *mapent; + + g_hash_table_iter_init(&htitr, queueMap); + + while (g_hash_table_iter_next(&htitr, (void **) &name, (void **) = &mapent)) { + if (!mapent->seen) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("missing iothread mapping for queue '%1$s= '"), + name); + return -1; + } } } @@ -2894,6 +2900,8 @@ qemuValidateDomainDeviceDefDiskIOThreads(const virDom= ainDef *def, const virDomainDiskDef *disk, virQEMUCaps *qemuCaps) { + g_autoptr(GHashTable) queueMap =3D NULL; + if (disk->iothread =3D=3D 0 && !disk->iothreads) return 0; @@ -2925,7 +2933,10 @@ qemuValidateDomainDeviceDefDiskIOThreads(const virDo= mainDef *def, return -1; } - if (qemuDomainValidateIothreadMapping(def, disk->iothreads, disk->queu= es) < 0) + if (disk->queues > 0) + queueMap =3D qemuCommandGetVirtioIothreadMapVirtioBlk(disk); + + if (qemuDomainValidateIothreadMapping(def, disk->iothreads, queueMap) = < 0) return -1; if (disk->iothread !=3D 0 && --=20 2.48.1 From nobody Sun Feb 8 01:49:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1741016056625391.65825857675554; Mon, 3 Mar 2025 07:34:16 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 7049E81F; Mon, 3 Mar 2025 10:34:15 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id AFBCE1499; Mon, 3 Mar 2025 10:31:28 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id B73FE1352; Mon, 3 Mar 2025 10:31:24 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 599631225 for ; Mon, 3 Mar 2025 10:31:08 -0500 (EST) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-401-ucmJYag3MVG83U_lKj2hQQ-1; Mon, 03 Mar 2025 10:31:06 -0500 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C042C180056F for ; Mon, 3 Mar 2025 15:31:05 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.15]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 861451956094; Mon, 3 Mar 2025 15:31:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741015868; 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=0501Y7QFxVxL/Fc9oT5nmzOmSNn0r7DNvInS+9NvBfM=; b=ds8wzosdvQclO4M+oviQHj0BTCsR9QtbeCVL2UGDzwBrqrQUx9vjlvRq3Yt1osP4UjcTi+ DqyDYFIb4YzsL7TEELyHpKZT8EAWFlvYcFpvYz2zCRlxdk3wKcATJrw2dvyrfMaWdIdRmw fZXCpoMSXjX82Yeq04FRqDzjBMjK6M8= X-MC-Unique: ucmJYag3MVG83U_lKj2hQQ-1 X-Mimecast-MFC-AGG-ID: ucmJYag3MVG83U_lKj2hQQ_1741015865 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v2 08/11] conf: Add support for iothread to queue mapping config for 'virtio-scsi' Date: Mon, 3 Mar 2025 16:30:46 +0100 Message-ID: <2ca3d4c5f3e0e5c40fc7eaece79d7552415d62e1.1741015346.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: sSNCO_tVfXLkxTPoQQswstb6CPRC101wGQH5UQeHMQY_1741015865 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: BJOWX7TRHX6CQGRWJHDLVRJ2RRAB3BCJ X-Message-ID-Hash: BJOWX7TRHX6CQGRWJHDLVRJ2RRAB3BCJ X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Stefan Hajnoczi X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1741016058245019100 Content-Type: text/plain; charset="utf-8" Upcoming qemu release will support configuring mapping iothreads to virtio queues for 'virtio-scsi' controllers in order to improve performance. Reuse the infrastructure we have from the same configuration for 'virti-blk' to implement the conf support for this feature. Signed-off-by: Peter Krempa --- docs/formatdomain.rst | 41 +++++++++++++++++++++++++++++++ src/conf/domain_conf.c | 10 +++++++- src/conf/domain_conf.h | 1 + src/conf/domain_validate.c | 10 +++++++- src/conf/schemas/domaincommon.rng | 9 ++++++- src/hypervisor/domain_driver.c | 3 ++- 6 files changed, 70 insertions(+), 4 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 29f3c84780..d049f28a65 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -4146,6 +4146,47 @@ An optional sub-element ``driver`` can specify the d= river specific options: If a specific IOThread is desired for a specific SCSI ``disk``, then mu= ltiple controllers must be defined each having a specific ``iothread`` value. = The ``iothread`` value must be within the range 1 to the domain iothreads v= alue. +``iothreads`` + Supported for ``virtio-scsi`` controllers using ``address`` types ``pci= `` and + ``ccw``. :since:`since 11.2.0 (QEMU 10.0).` Mutually exclusive with ``i= othread``. + + The optional ``iothreads`` sub-element allows specifying multiple IOThr= eads + via the ``iothread`` sub-element with attribute ``id`` the ``virtio-sc= si`` + controller will use for I/O operations. The virt queues (see ``queues`` + attribute of ``driver``) are automatically distributed among the config= ured + iothreads. + + Optionally the ``iothread`` element can have multiple ``queue`` subelem= ents + with mandatory ``id`` atribute specifying that the iothread should be u= sed + to handle given virt queue. If queue mapping is present the ``queues`` + attribute of ``driver`` must be configured and all configured virt queu= es + must be included in the mapping. The ``virtio-scsi`` controller exposes= two + special queues named ``ctrl`` and ``event`` and request virt queues ``0= `` to + ``N-1`` where N is the number of queues configured for the device. + + Example:: + + + + + + + + + + + + + + + + + + + + + + virtio options For virtio controllers, `Virtio-related options`_ can also be set. ( :since:`Since 3.5.0` ) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index bb82264758..def2ef7ae7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2557,6 +2557,8 @@ void virDomainControllerDefFree(virDomainControllerDe= f *def) if (!def) return; + g_slist_free_full(def->iothreads, (GDestroyNotify) virDomainIothreadMa= ppingDefFree); + virDomainDeviceInfoClear(&def->info); g_free(def->virtio); @@ -8618,6 +8620,9 @@ virDomainControllerDefParseXML(virDomainXMLOption *xm= lopt, &def->iothread) < 0) return NULL; + if (virDomainIothreadMappingDefParse(driver, &def->iothreads) < 0) + return NULL; + if (virDomainVirtioOptionsParseXML(driver, &def->virtio) < 0) return NULL; } @@ -23505,6 +23510,7 @@ virDomainControllerDriverFormat(virBuffer *buf, virDomainControllerDef *def) { g_auto(virBuffer) driverBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) driverChildBuf =3D VIR_BUFFER_INIT_CHILD(buf); if (def->queues) virBufferAsprintf(&driverBuf, " queues=3D'%u'", def->queues); @@ -23523,9 +23529,11 @@ virDomainControllerDriverFormat(virBuffer *buf, if (def->iothread) virBufferAsprintf(&driverBuf, " iothread=3D'%u'", def->iothread); + virDomainIothreadMappingDefFormat(&driverChildBuf, def->iothreads); + virDomainVirtioOptionsFormat(&driverBuf, def->virtio); - virXMLFormatElement(buf, "driver", &driverBuf, NULL); + virXMLFormatElement(buf, "driver", &driverBuf, &driverChildBuf); } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index d56a5a22e0..20cb058473 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -763,6 +763,7 @@ struct _virDomainControllerDef { unsigned int max_sectors; virTristateSwitch ioeventfd; unsigned int iothread; /* unused =3D 0, > 0 specific thread # */ + GSList *iothreads; /* List of virDomainIothreadMappingDef */ union { virDomainVirtioSerialOpts vioserial; virDomainPCIControllerOpts pciopts; diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index ad3d17f0fd..f95316918d 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -1260,7 +1260,7 @@ virDomainControllerDefValidate(const virDomainControl= lerDef *controller) } } - if (controller->iothread !=3D 0) { + if (controller->iothread !=3D 0 || controller->iothreads) { if (controller->type !=3D VIR_DOMAIN_CONTROLLER_TYPE_SCSI || !(controller->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VI= RTIO_SCSI || controller->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VI= RTIO_TRANSITIONAL || @@ -1269,6 +1269,14 @@ virDomainControllerDefValidate(const virDomainContro= llerDef *controller) _("iothreads are supported only by 'virtio-scsi= ' controllers")); return -1; } + + /* configuring both and it's s= ub-element + * isn't supported */ + if (controller->iothread && controller->iothreads) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("controller driver 'iothread' attribute can't= be used together with 'iothreads' subelement")); + return -1; + } } return 0; diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index 824da9d066..7dea0f1b0c 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -2605,7 +2605,11 @@ - + + ctrl + event + + @@ -3059,6 +3063,9 @@ + + + diff --git a/src/hypervisor/domain_driver.c b/src/hypervisor/domain_driver.c index b7499a376f..29ba358477 100644 --- a/src/hypervisor/domain_driver.c +++ b/src/hypervisor/domain_driver.c @@ -585,7 +585,8 @@ virDomainDriverDelIOThreadCheck(virDomainDef *def, } for (i =3D 0; i < def->ncontrollers; i++) { - if (def->controllers[i]->iothread =3D=3D iothread_id) { + if (virDomainIothreadMappingDefHasIothread(def->controllers[i]->io= threads, iothread_id) || + def->controllers[i]->iothread =3D=3D iothread_id) { virReportError(VIR_ERR_INVALID_ARG, _("cannot remove IOThread '%1$u' since it is be= ing used by controller"), iothread_id); --=20 2.48.1 From nobody Sun Feb 8 01:49:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1741016104750652.7546499332402; Mon, 3 Mar 2025 07:35:04 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 28067149F; Mon, 3 Mar 2025 10:35:04 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 53FBF14B2; Mon, 3 Mar 2025 10:31:39 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id ECE57A60; Mon, 3 Mar 2025 10:31:33 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id C3F1C134F for ; Mon, 3 Mar 2025 10:31:14 -0500 (EST) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-153-IMb3S_yIMWWneDpxWVVBLA-1; Mon, 03 Mar 2025 10:31:08 -0500 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 585631800998 for ; Mon, 3 Mar 2025 15:31:07 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.15]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4A2691956094; Mon, 3 Mar 2025 15:31:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741015874; 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=gFVS/MR/CNlY4/lccSieiv7e8bQiLaW1pcyP7+VXKWQ=; b=W6bONRcXFvSF6xCmQnGuyuQazsnTg9UkV+PfOXdPFf955kQi/ZkLMkwz3D1TbTGivaT/mm ztoTSKSDFVUDRnyn7w/Hda0ynye/x0RdPGVUVIpTOqBeJnAl1YKq9WA086V8q66eI8mDhZ +ttsjK0h2YpLOHLs7mEkvjUYhfd739U= X-MC-Unique: IMb3S_yIMWWneDpxWVVBLA-1 X-Mimecast-MFC-AGG-ID: IMb3S_yIMWWneDpxWVVBLA_1741015867 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v2 09/11] qemu: Implement support for iothread <-> virtqueue mapping for 'virtio-scsi' controllers Date: Mon, 3 Mar 2025 16:30:47 +0100 Message-ID: <3f884f1fbe167eab665d611cb42d384fa8dbd081.1741015346.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: yvA33dar7-ZPXjEV4bn9Utc8VzH_9qwJ1oeBtSOKPpM_1741015867 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 24BOANRDSGBIOFD4CKZJ267TQSHBWBQU X-Message-ID-Hash: 24BOANRDSGBIOFD4CKZJ267TQSHBWBQU X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Stefan Hajnoczi X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1741016106509019000 Content-Type: text/plain; charset="utf-8" Similarly to 'virtio-blk' users can map multiple iothreads and pin them appropriately for 'virtio-scsi' controllers to ensure the best performance. Implement the validation and command line generation based on the helpers we have for 'virtio-blk'. Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 22 ++++++++++++++++++++++ src/qemu/qemu_command.h | 2 ++ src/qemu/qemu_validate.c | 34 +++++++++++++++++++++++++++------- 3 files changed, 51 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 14d62b98e4..fc0712f836 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1657,6 +1657,15 @@ qemuCommandGetVirtioIothreadMapVirtioBlk(const virDo= mainDiskDef *disk) } +GHashTable * +qemuCommandGetVirtioIothreadMapVirtioSCSI(const virDomainControllerDef *de= f) +{ + const char *internal_queues[] =3D { "ctrl", "event", NULL }; + + return qemuCommandGetVirtioIothreadMap(def->queues, internal_queues); +} + + virJSONValue * qemuBuildDiskDeviceProps(const virDomainDef *def, virDomainDiskDef *disk, @@ -2558,6 +2567,7 @@ qemuBuildControllerSCSIDevProps(virDomainControllerDe= f *def, virQEMUCaps *qemuCaps) { g_autoptr(virJSONValue) props =3D NULL; + g_autoptr(virJSONValue) iothreadsMapping =3D NULL; g_autofree char *iothread =3D NULL; const char *driver =3D NULL; @@ -2569,6 +2579,17 @@ qemuBuildControllerSCSIDevProps(virDomainControllerD= ef *def, qemuCaps))) return NULL; + if (def->iothreads) { + g_autoptr(GHashTable) queueMap =3D NULL; + + if (def->queues > 0) + queueMap =3D qemuCommandGetVirtioIothreadMapVirtioSCSI(def= ); + + if (!(iothreadsMapping =3D qemuBuildIothreadMappingProps(def->= iothreads, + queueMa= p))) + return NULL; + } + if (def->iothread > 0) iothread =3D g_strdup_printf("iothread%u", def->iothread); @@ -2576,6 +2597,7 @@ qemuBuildControllerSCSIDevProps(virDomainControllerDe= f *def, "S:iothread", iothread, "s:id", def->info.alias, "p:num_queues", def->queues, + "A:iothread-vq-mapping", &iothreadsMappi= ng, "p:cmd_per_lun", def->cmd_per_lun, "p:max_sectors", def->max_sectors, "T:ioeventfd", def->ioeventfd, diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 636c2571d4..d69fd793c4 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -280,3 +280,5 @@ struct qemuVirtioIothreadMap { GHashTable * qemuCommandGetVirtioIothreadMapVirtioBlk(const virDomainDiskDef *disk); +GHashTable * +qemuCommandGetVirtioIothreadMapVirtioSCSI(const virDomainControllerDef *de= f); diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index f8586a7dff..364bc59cba 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3641,9 +3641,10 @@ qemuValidateDomainDeviceDefControllerIDE(const virDo= mainControllerDef *controlle */ static int qemuValidateCheckSCSIControllerIOThreads(const virDomainControllerDef *con= troller, - const virDomainDef *def) + const virDomainDef *def, + virQEMUCaps *qemuCaps) { - if (!controller->iothread) + if (controller->iothread =3D=3D 0 && !controller->iothreads) return 0; if (controller->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && @@ -3654,8 +3655,24 @@ qemuValidateCheckSCSIControllerIOThreads(const virDo= mainControllerDef *controlle return -1; } - /* Can we find the controller iothread in the iothreadid list? */ - if (!virDomainIOThreadIDFind(def, controller->iothread)) { + if (controller->iothreads) { + g_autoptr(GHashTable) queueMap =3D NULL; + + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI_IOTHREAD_MAPPI= NG)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("IOThread mapping for virtio-scsi controllers= is not available with this QEMU binary")); + return -1; + } + + if (controller->queues > 0) + queueMap =3D qemuCommandGetVirtioIothreadMapVirtioSCSI(control= ler); + + if (qemuDomainValidateIothreadMapping(def, controller->iothreads, = queueMap) < 0) + return -1; + } + + if (controller->iothread > 0 && + !virDomainIOThreadIDFind(def, controller->iothread)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("controller iothread '%1$u' not defined in iothre= adid"), controller->iothread); @@ -3668,13 +3685,15 @@ qemuValidateCheckSCSIControllerIOThreads(const virD= omainControllerDef *controlle static int qemuValidateDomainDeviceDefControllerSCSI(const virDomainControllerDef *co= ntroller, - const virDomainDef *def) + const virDomainDef *def, + virQEMUCaps *qemuCaps) { switch ((virDomainControllerModelSCSI) controller->model) { case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL: - if (qemuValidateCheckSCSIControllerIOThreads(controller, def) = < 0) + if (qemuValidateCheckSCSIControllerIOThreads(controller, def, + qemuCaps) < 0) return -1; break; @@ -4348,7 +4367,8 @@ qemuValidateDomainDeviceDefController(const virDomain= ControllerDef *controller, break; case VIR_DOMAIN_CONTROLLER_TYPE_SCSI: - ret =3D qemuValidateDomainDeviceDefControllerSCSI(controller, def); + ret =3D qemuValidateDomainDeviceDefControllerSCSI(controller, def, + qemuCaps); break; case VIR_DOMAIN_CONTROLLER_TYPE_PCI: --=20 2.48.1 From nobody Sun Feb 8 01:49:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1741016132541796.6682323545868; Mon, 3 Mar 2025 07:35:32 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id EC5E61353; Mon, 3 Mar 2025 10:35:31 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id DB1441497; Mon, 3 Mar 2025 10:31:41 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 995F21270; Mon, 3 Mar 2025 10:31:36 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id E96991489 for ; Mon, 3 Mar 2025 10:31:16 -0500 (EST) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-224-tnq-xqjIPw2b7AZrowTx6g-1; Mon, 03 Mar 2025 10:31:10 -0500 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4995219783B7 for ; Mon, 3 Mar 2025 15:31:09 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.15]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D4C881956094; Mon, 3 Mar 2025 15:31:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741015876; 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=Yt/EFfCFMpaWlyQPsverSPkn9lqm+3snZlLobd6eXBg=; b=LmTVcHM4F7ZCFPqEqy5J3bW89vkmK5dXNUMGIWsOsrHf7eHeUok7T/lgavBWg7X0/WC3nG ajOu1LBfzkk3r6Ape6/LJr8hV9kLjOL8jOgY8CF56Oaz/hKZejAZyZY0cSwIm1ULJ3ak8K nP6LN1LpcoVnxZnS3F2DqE6u30NZ/yM= X-MC-Unique: tnq-xqjIPw2b7AZrowTx6g-1 X-Mimecast-MFC-AGG-ID: tnq-xqjIPw2b7AZrowTx6g_1741015869 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v2 10/11] qemuxmlconftest: Add 'iothreads-virtio-scsi-mapping' case Date: Mon, 3 Mar 2025 16:30:48 +0100 Message-ID: <610be50159c32a44ba06b0940066913f2f4e9ad3.1741015346.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: EFkUblpcpQVWoEDHACYAHgoJMNX_IR2eHwkVmv4dCVg_1741015869 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: RY2PQ3X37CV6U55GW64TPTNV5LNVYZ45 X-Message-ID-Hash: RY2PQ3X37CV6U55GW64TPTNV5LNVYZ45 X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Stefan Hajnoczi X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1741016134716019000 Content-Type: text/plain; charset="utf-8" Test the XML and commandline for iothread<->virtqueue mapping for 'virtio-scsi' controllers. Signed-off-by: Peter Krempa --- ...ads-virtio-scsi-mapping.x86_64-latest.args | 40 ++++++++++++ ...eads-virtio-scsi-mapping.x86_64-latest.xml | 65 +++++++++++++++++++ .../iothreads-virtio-scsi-mapping.xml | 57 ++++++++++++++++ tests/qemuxmlconftest.c | 1 + 4 files changed, 163 insertions(+) create mode 100644 tests/qemuxmlconfdata/iothreads-virtio-scsi-mapping.x86= _64-latest.args create mode 100644 tests/qemuxmlconfdata/iothreads-virtio-scsi-mapping.x86= _64-latest.xml create mode 100644 tests/qemuxmlconfdata/iothreads-virtio-scsi-mapping.xml diff --git a/tests/qemuxmlconfdata/iothreads-virtio-scsi-mapping.x86_64-lat= est.args b/tests/qemuxmlconfdata/iothreads-virtio-scsi-mapping.x86_64-lates= t.args new file mode 100644 index 0000000000..adcc6f4e03 --- /dev/null +++ b/tests/qemuxmlconfdata/iothreads-virtio-scsi-mapping.x86_64-latest.args @@ -0,0 +1,40 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/va= r/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pc,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc.ram,acpi= =3Doff \ +-accel tcg \ +-cpu qemu64 \ +-m size=3D219136k \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}'= \ +-overcommit mem-lock=3Doff \ +-smp 2,sockets=3D2,cores=3D1,threads=3D1 \ +-object '{"qom-type":"iothread","id":"iothread1"}' \ +-object '{"qom-type":"iothread","id":"iothread2"}' \ +-object '{"qom-type":"iothread","id":"iothread3"}' \ +-object '{"qom-type":"iothread","id":"iothread4"}' \ +-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 \ +-boot strict=3Don \ +-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ +-device '{"driver":"virtio-scsi-pci","id":"scsi0","num_queues":3,"iothread= -vq-mapping":[{"iothread":"iothread2"},{"iothread":"iothread3"}],"bus":"pci= .0","addr":"0xb"}' \ +-device '{"driver":"virtio-scsi-pci","id":"scsi1","num_queues":2,"iothread= -vq-mapping":[{"iothread":"iothread1","vqs":[0,1]},{"iothread":"iothread4",= "vqs":[2]},{"iothread":"iothread2","vqs":[3]}],"bus":"pci.0","addr":"0xc"}'= \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/iothrtest2= .img","node-name":"libvirt-1-storage","read-only":false}' \ +-device '{"driver":"scsi-hd","bus":"scsi0.0","channel":0,"scsi-id":0,"lun"= :3,"device_id":"drive-scsi0-0-0-3","drive":"libvirt-1-storage","id":"scsi0-= 0-0-3","bootindex":1}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxmlconfdata/iothreads-virtio-scsi-mapping.x86_64-lat= est.xml b/tests/qemuxmlconfdata/iothreads-virtio-scsi-mapping.x86_64-latest= .xml new file mode 100644 index 0000000000..bc6f9e5552 --- /dev/null +++ b/tests/qemuxmlconfdata/iothreads-virtio-scsi-mapping.x86_64-latest.xml @@ -0,0 +1,65 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 2 + 4 + + hvm + + + + qemu64 + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + +
+ + +
+ + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + +