From nobody Sat Feb 7 08:06:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654606455; cv=none; d=zohomail.com; s=zohoarc; b=GottJXPgmSkNzCzAUNnf5tYvNH+zZuJG+/7c7WeUSJYtOqtz2O3CpJQrLj5rcbu7/62tIImwnD99v59TIDRNdv0qat+OmfiVQnbPV4GAeQNK8ja2/p5+J2/izgNIDHmH+HCyCQfYZOHIpWKb6eSd4ykgquo9vsfMxeKxi0WjsQM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654606455; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=d5vG1bfe3xl1TY9MhwyXfY0o94KD6PwQZKc7mWSd91Q=; b=cWwjLNAh2zbIcrcsD70kKflpCUnjTBEdiy32LfxdZ3zJbE9oN3lxSUHdVIpYvJ6NVUA8G1eUlCeeslKL23glmBh2/wetmcLN3s+AfTMjoQlknoFzI4iEhsiimWTMMniLBYcMFYbOYkGMTdRt0/stOJHFYWquEZkIi6PpgOm1qTY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1654606455602180.07047241496718; Tue, 7 Jun 2022 05:54:15 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-590-PgiyA9QTOCCoOolM7gJiIA-1; Tue, 07 Jun 2022 08:53:11 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 846B2824078; Tue, 7 Jun 2022 12:53:07 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E8674050C41; Tue, 7 Jun 2022 12:53:07 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4D22C19451F0; Tue, 7 Jun 2022 12:53:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 01DDD19451F1 for ; Tue, 7 Jun 2022 12:53:06 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id E84544050C40; Tue, 7 Jun 2022 12:53:05 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.34.246.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C9CD4050C41 for ; Tue, 7 Jun 2022 12:53:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654606454; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=d5vG1bfe3xl1TY9MhwyXfY0o94KD6PwQZKc7mWSd91Q=; b=iHn3LXYt5hQWQpLtdLh7JK/YV6fajO3QIh/zQ1y7XSCc6O1mRpiIGlCxU0V5TVQzNOEef7 xEoBa9JJGWnwxbFR1r5k2AMX3adEJm5MC0S/M8E0zT2AqE09N0I5s2EpaH9G6DkTcpPVXi V6GM896X5KJkMOTZZpC7BLCp9wmlNnU= X-MC-Unique: PgiyA9QTOCCoOolM7gJiIA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 06/15] conf: Introduce pool_min and pool_max attributes to IOThread Date: Tue, 7 Jun 2022 14:52:50 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654606456836100001 Content-Type: text/plain; charset="utf-8"; x-default="true" At least in case of QEMU an IOThread is actually a pool of threads (see iothread_set_aio_context_params() in QEMU's code base). As such, it can have minimal and maximal number of worker threads. Allow setting them in domain XML. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- docs/formatdomain.rst | 5 +- src/conf/domain_conf.c | 34 ++++++++++- src/conf/domain_conf.h | 3 + src/conf/schemas/domaincommon.rng | 10 +++ .../iothreads-ids-pool-sizes.xml | 61 +++++++++++++++++++ ...iothreads-ids-pool-sizes.x86_64-latest.xml | 1 + tests/qemuxml2xmltest.c | 1 + 7 files changed, 111 insertions(+), 4 deletions(-) create mode 100644 tests/qemuxml2argvdata/iothreads-ids-pool-sizes.xml create mode 120000 tests/qemuxml2xmloutdata/iothreads-ids-pool-sizes.x86_6= 4-latest.xml diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 312b605a8b..2aa39b2f63 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -675,7 +675,7 @@ host/guest with many LUNs. :since:`Since 1.2.8 (QEMU on= ly)` - + ... @@ -696,6 +696,9 @@ host/guest with many LUNs. :since:`Since 1.2.8 (QEMU on= ly)` any predefined ``id``. If there are more ``iothreadids`` defined than ``iothreads`` defined for the domain, then the ``iothreads`` value will= be adjusted accordingly. :since:`Since 1.2.15` + The element has two optional attributes ``thread_pool_min`` and + ``hread_pool_max`` which allow setting lower and upper boundary for num= ber + of worker threads for given IOThread. :since:`Since 8.5.0` =20 =20 CPU Tuning diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 8d4b27dbc0..8891289866 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3481,6 +3481,9 @@ virDomainIOThreadIDDefNew(void) { virDomainIOThreadIDDef *def =3D g_new0(virDomainIOThreadIDDef, 1); =20 + def->thread_pool_min =3D -1; + def->thread_pool_max =3D -1; + return def; } =20 @@ -17008,7 +17011,7 @@ virDomainIdmapDefParseXML(xmlXPathContextPtr ctxt, * * 4 * - * + * * * * @@ -17024,6 +17027,16 @@ virDomainIOThreadIDDefParseXML(xmlNodePtr node) &iothrid->iothread_id) < 0) return NULL; =20 + if (virXMLPropInt(node, "thread_pool_min", 10, + VIR_XML_PROP_NONNEGATIVE, + &iothrid->thread_pool_min, -1) < 0) + return NULL; + + if (virXMLPropInt(node, "thread_pool_max", 10, + VIR_XML_PROP_NONNEGATIVE, + &iothrid->thread_pool_max, -1) < 0) + return NULL; + return g_steal_pointer(&iothrid); } =20 @@ -27607,8 +27620,23 @@ virDomainDefIOThreadsFormat(virBuffer *buf, return; =20 for (i =3D 0; i < def->niothreadids; i++) { - virBufferAsprintf(&childrenBuf, "\n", - def->iothreadids[i]->iothread_id); + virDomainIOThreadIDDef *iothread =3D def->iothreadids[i]; + virBuffer attrBuf =3D VIR_BUFFER_INITIALIZER; + + virBufferAsprintf(&attrBuf, " id=3D'%u'", + iothread->iothread_id); + + if (iothread->thread_pool_min >=3D 0) { + virBufferAsprintf(&attrBuf, " thread_pool_min=3D'%d'", + iothread->thread_pool_min); + } + + if (iothread->thread_pool_max >=3D 0) { + virBufferAsprintf(&attrBuf, " thread_pool_max=3D'%d'", + iothread->thread_pool_max); + } + + virXMLFormatElement(&childrenBuf, "iothread", &attrBuf, NULL); } =20 virXMLFormatElement(buf, "iothreadids", NULL, &childrenBuf); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e7e0f24443..2a5001f15c 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2646,6 +2646,9 @@ struct _virDomainIOThreadIDDef { virBitmap *cpumask; =20 virDomainThreadSchedParam sched; + + int thread_pool_min; + int thread_pool_max; }; =20 void virDomainIOThreadIDDefFree(virDomainIOThreadIDDef *def); diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index cc598212a8..7e6310832b 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -829,6 +829,16 @@ + + + + + + + + + + diff --git a/tests/qemuxml2argvdata/iothreads-ids-pool-sizes.xml b/tests/qe= muxml2argvdata/iothreads-ids-pool-sizes.xml new file mode 100644 index 0000000000..0f93d14f12 --- /dev/null +++ b/tests/qemuxml2argvdata/iothreads-ids-pool-sizes.xml @@ -0,0 +1,61 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 6 + 5 + + + + + + + + + hvm + + + + qemu64 + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + +
+ + + + + +
+ + + + +
+ + + + +
+ + +
+ + +
+ + + +