From nobody Mon Feb 9 08:30:49 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=1677767931; cv=none; d=zohomail.com; s=zohoarc; b=bCwywv+BlyW4A4dBPLziigzxyP06PwzVtBkKNuimtImrId8UNnZIie2DTlNtLx8DB8KHsht47Sue6VSn0H+3GV3DW1mHbBASz8SylLWnUR08ddqRPoaZl+ktvTa1+NPY+8eU3rAUWLnHJBWllXNoy0l0LJFOzOryItgOKA4t08A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677767931; 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=QNJCVQLt8yazxCCFPPM26sprYA9cfVufXHsUucDdO20=; b=V1Cmo025XcA4ZQIMkMsuz+OZ8JOeFdwcgmhrO6QwY96JHYVt9aazcaukGjTZ2gwi8uJ4iQ9ay6eTFDiHSVZ/ukCosue97kXhU1iUb+hKxytoI+rkyunqq97fUunhPJEH9mtCWBkV/xamHoGire8OL8LxuYa8cIlV23x5RmW1Jzo= 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 1677767931491207.20704889195974; Thu, 2 Mar 2023 06:38:51 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-624-85xXanLMNp6Q-zIVSJJi9Q-1; Thu, 02 Mar 2023 09:38:45 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0BF5338012E7; Thu, 2 Mar 2023 14:38:23 +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 EC5F8C16027; Thu, 2 Mar 2023 14:38:22 +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 DCE7119452D2; Thu, 2 Mar 2023 14:38:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1956519452D0 for ; Thu, 2 Mar 2023 14:38:22 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 0DBCB1400070; Thu, 2 Mar 2023 14:38:22 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65C8F140EBF6 for ; Thu, 2 Mar 2023 14:38:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677767930; 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=QNJCVQLt8yazxCCFPPM26sprYA9cfVufXHsUucDdO20=; b=T+f/t2F59TXI7fS/eGMVj87L2j4vLkVpWBkoPR7iTRjr8ll+NJ9PgnnZC5InBVLUZb8t0A 041FSgS+rqYDtHAomI5jW74kvFD1eqOwL2GEIqtu1fZ8lhskUk1/liQI7fko+gsAEbALmM WGbPossNdRUF6LxlobLA+ZyMG6Z/RnU= X-MC-Unique: 85xXanLMNp6Q-zIVSJJi9Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 14/21] conf: Store the iothread 'poll' settings in the XML Date: Thu, 2 Mar 2023 15:37:56 +0100 Message-Id: <2785fd3485921bcbd6555133b9ac7e848af783cb.1677767499.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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 3.1 on 10.11.54.8 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: 1677767933451100001 Content-Type: text/plain; charset="utf-8" Currently we allow configuring the 'poll-max-ns', 'poll-grow', and 'poll-shrink' parameters of qemu iothreads only during runtime and they are not persisted. Add XML machinery to persist them. Signed-off-by: Peter Krempa --- docs/formatdomain.rst | 11 ++++- src/conf/domain_conf.c | 41 ++++++++++++++++++- src/conf/domain_conf.h | 7 ++++ src/conf/schemas/domaincommon.rng | 19 +++++++++ .../iothreads-ids-pool-sizes.xml | 12 ++++-- 5 files changed, 85 insertions(+), 5 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 638768c18d..eff17c1532 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -730,7 +730,9 @@ host/guest with many LUNs. :since:`Since 1.2.8 (QEMU on= ly)` - + + + ... @@ -756,6 +758,13 @@ host/guest with many LUNs. :since:`Since 1.2.8 (QEMU o= nly)` ``thread_pool_max`` which allow setting lower and upper boundary for nu= mber of worker threads for given IOThread. While the former can be value of = zero, the latter can't. :since:`Since 8.5.0` + :since:`Since 9.1.0` an optional sub-element ``poll`` with can be used = to + override the hypervisor-default interval of polling for the iothread be= fore + it switches back to events. The optional attribute ``max`` sets the max= imum + time polling should be used in nanoseconds. Setting ``max`` to ``0`` di= sables + polling. Attributes ``grow`` and ``shrink`` override (or disable when s= et to + ``0`` the default steps for increasing/decreasing the polling interval = if + the set interval is deemed insufficient or extensive. ``defaultiothread`` This element represents the default event loop within hypervisor, where= I/O requests from devices not assigned to a specific IOThread are processed. diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ad2b44b610..9426d55f8d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15779,6 +15779,7 @@ static virDomainIOThreadIDDef * virDomainIOThreadIDDefParseXML(xmlNodePtr node) { g_autoptr(virDomainIOThreadIDDef) iothrid =3D virDomainIOThreadIDDefNe= w(); + xmlNodePtr pollNode; if (virXMLPropUInt(node, "id", 10, VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO, @@ -15795,6 +15796,28 @@ virDomainIOThreadIDDefParseXML(xmlNodePtr node) &iothrid->thread_pool_max, -1) < 0) return NULL; + if ((pollNode =3D virXMLNodeGetSubelement(node, "poll"))) { + int rc; + + if ((rc =3D virXMLPropULongLong(pollNode, "max", 10, VIR_XML_PROP_= NONE, + &iothrid->poll_max_ns)) < 0) + return NULL; + + iothrid->set_poll_max_ns =3D rc =3D=3D 1; + + if ((rc =3D virXMLPropUInt(pollNode, "grow", 10, VIR_XML_PROP_NONE, + &iothrid->poll_grow)) < 0) + return NULL; + + iothrid->set_poll_grow =3D rc =3D=3D 1; + + if ((rc =3D virXMLPropUInt(pollNode, "shrink", 10, VIR_XML_PROP_NO= NE, + &iothrid->poll_shrink)) < 0) + return NULL; + + iothrid->set_poll_shrink =3D rc =3D=3D 1; + } + return g_steal_pointer(&iothrid); } @@ -26655,6 +26678,9 @@ virDomainDefIothreadShouldFormat(const virDomainDef= *def) for (i =3D 0; i < def->niothreadids; i++) { if (!def->iothreadids[i]->autofill || + def->iothreadids[i]->set_poll_max_ns || + def->iothreadids[i]->set_poll_grow || + def->iothreadids[i]->set_poll_shrink || def->iothreadids[i]->thread_pool_min >=3D 0 || def->iothreadids[i]->thread_pool_max >=3D 0) return true; @@ -26703,6 +26729,8 @@ virDomainDefIOThreadsFormat(virBuffer *buf, for (i =3D 0; i < def->niothreadids; i++) { virDomainIOThreadIDDef *iothread =3D def->iothreadids[i]; g_auto(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) iothreadChildBuf =3D VIR_BUFFER_INIT_CHILD(&= childrenBuf); + g_auto(virBuffer) pollAttrBuf =3D VIR_BUFFER_INITIALIZER; virBufferAsprintf(&attrBuf, " id=3D'%u'", iothread->iothread_id); @@ -26717,7 +26745,18 @@ virDomainDefIOThreadsFormat(virBuffer *buf, iothread->thread_pool_max); } - virXMLFormatElement(&childrenBuf, "iothread", &attrBuf, NULL); + if (iothread->set_poll_max_ns) + virBufferAsprintf(&pollAttrBuf, " max=3D'%llu'", iothread-= >poll_max_ns); + + if (iothread->set_poll_grow) + virBufferAsprintf(&pollAttrBuf, " grow=3D'%u'", iothread->= poll_grow); + + if (iothread->set_poll_shrink) + virBufferAsprintf(&pollAttrBuf, " shrink=3D'%u'", iothread= ->poll_shrink); + + virXMLFormatElement(&iothreadChildBuf, "poll", &pollAttrBuf, N= ULL); + + virXMLFormatElement(&childrenBuf, "iothread", &attrBuf, &iothr= eadChildBuf); } virXMLFormatElement(buf, "iothreadids", NULL, &childrenBuf); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 2a8ad17f44..f6dade62fc 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2710,6 +2710,13 @@ struct _virDomainIOThreadIDDef { virDomainThreadSchedParam sched; + unsigned long long poll_max_ns; + bool set_poll_max_ns; + unsigned int poll_grow; + bool set_poll_grow; + unsigned int poll_shrink; + bool set_poll_shrink; + int thread_pool_min; int thread_pool_max; }; diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index ab4886b783..5a1d79672f 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -879,6 +879,25 @@ + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemuxml2argvdata/iothreads-ids-pool-sizes.xml b/tests/qe= muxml2argvdata/iothreads-ids-pool-sizes.xml index df4b291a7a..63fb4a52f6 100644 --- a/tests/qemuxml2argvdata/iothreads-ids-pool-sizes.xml +++ b/tests/qemuxml2argvdata/iothreads-ids-pool-sizes.xml @@ -7,9 +7,15 @@ 5 - - - + + + + + + + + + --=20 2.39.2