From nobody Mon Feb 9 06:27:10 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=1654154305; cv=none; d=zohomail.com; s=zohoarc; b=cLIYSYdjKpeUxgo4BZ5wf+kThC2536r+CbOXHZEajNMz11MFU34UwSINNTKPejIgELYvCCwSLHkTNyOqn8CH3WSa18howPDmkcXtdaJFRZScNegs3rKK7hzOSc0SJ8Yb1SWUzVV58EL9cV7L1qM6m8ujffzTZQsRnNPGoMeWxx8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654154305; 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=uBXAaR75LIv76/UDBHhZgSnkMgYdbe8IwSeZ36b1hyw=; b=efbxR3IRJIeuC1Ry3pL/dvcSjbnZt+ePefgVQWeSX0VNoeitAvJVmkBnPBn1QypPJ3nab/wte6OK0UNEJUX28X0+Wts/FYYt+WKL2JvK5YcDu/2QHztWOKBa9Uyc6JOJPN+fR6j4ezYiXL4EtWbj4ZccaeAfFTlMhXqZDl+4LGw= 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 165415430545094.01534517542473; Thu, 2 Jun 2022 00:18:25 -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-470-X-sZK21fNVCcAUtsjOe69g-1; Thu, 02 Jun 2022 03:18:21 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B9B668041B3; Thu, 2 Jun 2022 07:18:17 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A179D2166B2F; Thu, 2 Jun 2022 07:18:17 +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 3A2B41954F60; Thu, 2 Jun 2022 07:18:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 329FF1949759 for ; Thu, 2 Jun 2022 07:18:16 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 26FFF2166B2F; Thu, 2 Jun 2022 07:18:16 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id C0DAB2166B26 for ; Thu, 2 Jun 2022 07:18:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654154304; 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=uBXAaR75LIv76/UDBHhZgSnkMgYdbe8IwSeZ36b1hyw=; b=ZcrKR2mEF1kJm0Nii/kvqYOedwsZ1pLADZW/d9XqxO7kWCaC1McdRKYnbageJMbjbKFy1X dLvc4N/7XKZk0gOUZKzRNYFFPcWKqvy/6nP84MbX0AdEwikJ6+J+pBqF36yCUFworzuZZg ZJYX+RPSmhWNQRZoUmNWeuw1nzgnlTM= X-MC-Unique: X-sZK21fNVCcAUtsjOe69g-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 07/16] conf: Introduce pool_min and pool_max attributes to IOThread Date: Thu, 2 Jun 2022 09:17:57 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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.78 on 10.11.54.6 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: 1654154305828100001 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 | 6 +- src/conf/domain_conf.c | 32 +++++++++- 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, 110 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..de085f616a 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,10 @@ host/guest with many LUNs. :since:`Since 1.2.8 (QEMU o= nly)` 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 ``pool_min`` and ``pool_max`` w= hich + allow setting lower and upper boundary for number of worker threads for + given IOThread. :since:`Since 8.4.0` + =20 =20 CPU Tuning diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 8d4b27dbc0..7572e62db1 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->pool_min =3D -1; + def->pool_max =3D -1; + return def; } =20 @@ -17008,7 +17011,7 @@ virDomainIdmapDefParseXML(xmlXPathContextPtr ctxt, * * 4 * - * + * * * * @@ -17024,6 +17027,14 @@ virDomainIOThreadIDDefParseXML(xmlNodePtr node) &iothrid->iothread_id) < 0) return NULL; =20 + if (virXMLPropLongLong(node, "pool_min", 10, + VIR_XML_PROP_NONNEGATIVE, &iothrid->pool_min, -= 1) < 0) + return NULL; + + if (virXMLPropLongLong(node, "pool_max", 10, + VIR_XML_PROP_NONNEGATIVE, &iothrid->pool_max, -= 1) < 0) + return NULL; + return g_steal_pointer(&iothrid); } =20 @@ -27607,8 +27618,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->pool_min >=3D 0) { + virBufferAsprintf(&attrBuf, " pool_min=3D'%lld'", + iothread->pool_min); + } + + if (iothread->pool_max >=3D 0) { + virBufferAsprintf(&attrBuf, " pool_max=3D'%lld'", + iothread->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..c502100d45 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2646,6 +2646,9 @@ struct _virDomainIOThreadIDDef { virBitmap *cpumask; =20 virDomainThreadSchedParam sched; + + long long pool_min; + long long pool_max; }; =20 void virDomainIOThreadIDDefFree(virDomainIOThreadIDDef *def); diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index cc598212a8..94035c38e7 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..5ff3b4b18e --- /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 + + + + +
+ + + + + +
+ + + + +
+ + + + +
+ + +
+ + +
+ + + +