From nobody Tue Sep 22 01:42:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; 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 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=reject dis=none) header.from=linux.ibm.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1784746692156392.1202216873704; Wed, 22 Jul 2026 11:58:12 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id F002341B81; Wed, 22 Jul 2026 14:58:10 -0400 (EDT) Received: from [172.19.199.10] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id B606742417; Wed, 22 Jul 2026 14:52:54 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 3CF2741B8E; Wed, 22 Jul 2026 14:52:26 -0400 (EDT) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 1351D41B7E for ; Wed, 22 Jul 2026 14:52:25 -0400 (EDT) Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIC11f606665 for ; Wed, 22 Jul 2026 18:52:24 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg78gbaq2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 22 Jul 2026 18:52:24 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MInkWe025681 for ; Wed, 22 Jul 2026 18:52:23 GMT Received: from smtprelay07.dal12v.mail.ibm.com ([172.16.1.9]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fgmtk0qda-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 22 Jul 2026 18:52:23 +0000 (GMT) Received: from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com [10.39.53.229]) by smtprelay07.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66MIqMXo11469358 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 22 Jul 2026 18:52:22 GMT Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E9AD95805F; Wed, 22 Jul 2026 18:52:21 +0000 (GMT) Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8923D58067; Wed, 22 Jul 2026 18:52:21 +0000 (GMT) Received: from IBM-GLTZVH3.atx-us.ibm.com (unknown [9.16.36.179]) by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTP; Wed, 22 Jul 2026 18:52:21 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=TIT69k0BCjkVuFXCo np5yuD+c1+hKvs6IZ2wI0ocxJ8=; b=lCR0cIuKvwcGsno8DGWrm39C5EvuevFPw 1M7z68abHDceCee4Qa0xqVgDmhpLXQtjitzPPyRf77lXuzOJLCARBgb+gBlLRO1I vSXZfkNsZhYR1YNmvmoiKJvj/0PW8xPRWaCYErr975T4Dmz8Z24cmtFbCtkO6w6j iOPIhrxmbeup4oPkdnn1AXwthV5DzBw7HkcKj1UQRGYPIFibc20aVSW63j4q5qxk lM22f9fHOBFuSlDzca+3ac1kBHjIxxc9N8Ja1cbGHeEidqovrMiB13BJX/HyGzFh WKIP1hIyok2/Ji8EEvmszw7uSbYyS1dqgktiMnj2ulxGyclWh8Pew== From: Jaehoon Kim To: devel@lists.libvirt.org Subject: [PATCH 4/6] virsh: add support for iothread poll-weight Date: Wed, 22 Jul 2026 13:52:13 -0500 Message-ID: <20260722185215.743245-5-jhkim@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260722185215.743245-1-jhkim@linux.ibm.com> References: <20260722185215.743245-1-jhkim@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDE4NCBTYWx0ZWRfXw7xiRBL2aK6X K77lJeuwOvrSzZV6qnM4LM46CW6TBXa44Yr87BtZgUAfdi5Dpe2x5Q13DipDZwf84/FqcWq5mQ/ RV2/Eqn7A8k7IEe0V4wOKmF8ZXYFqOTSO3X+D1AXWqdFlKOhUZoCYCDXal723umFFFk9HWF5m9p c+729f2HBChOX6I/vzs8nQw26CrRugSyxohYj+flAukeQe7w72LiCdBb2nPdyUJvuZStlu7Z+Pb vbwIqZLuRJxEDSaj19wcgGeH02dkL8+VmdHt14Di+RPAFedHXbU+HfD7IvqPGcHhn1rJudV2Eln v6JK0wvnYGk4CxMlzZMbALUhV5PIk7+8Yt+Y1M9vBAOUkcxEneQf9Dj574Q7EqtUeSS/jXJlHAY rFkejgCqVOZDOUK5p6OebmgjBj/s7/eLUbpinAJrgNyOtNOyGr+FkafQGfJ/kk23ZSnqmLbM8dS seZTa5+rmqmZN17uZPQ== X-Proofpoint-GUID: 96qmxdn3o5dEe_Mvoy0eh3du4RT2ZumX X-Authority-Analysis: v=2.4 cv=MelcfZ/f c=1 sm=1 tr=0 ts=6a611168 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=GGVyCG5GAvZhxVwtAJMA:9 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDE4NCBTYWx0ZWRfX6sjV0oUFR+me 8WloS/EAPUtkLpON1tLH0o85pimIi6pN4pYvXz60tXKyV9Rjg8YMfjJr29hTBH4CrDNj+PIeAHU 7qAkIcCN6Jt5E+0PO08njMJWQZ4bbOQ= X-Proofpoint-ORIG-GUID: 96qmxdn3o5dEe_Mvoy0eh3du4RT2ZumX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 spamscore=0 clxscore=1015 malwarescore=0 phishscore=0 adultscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220184 Message-ID-Hash: XSDLQBZUMF56U4MCXV64I23ADOZZU5M3 X-Message-ID-Hash: XSDLQBZUMF56U4MCXV64I23ADOZZU5M3 X-MailFrom: jhkim@linux.ibm.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: fiuczy@linux.ibm.com, shalini@linux.ibm.com, Jaehoon Kim X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1784746692728158500 Content-Type: text/plain; charset="utf-8" Add virsh support for configuring and reporting iothread poll-weight. Document poll-weight in the virsh manpage and extend iothreadset so that poll-weight can be configured from the command line. Also add poll-weight support to the test driver and extend virshtest accordingly. Signed-off-by: Jaehoon Kim --- docs/manpages/virsh.rst | 18 ++++++++++++------ src/test/test_driver.c | 12 ++++++++++++ tests/virshtestdata/iothreads.in | 2 ++ tests/virshtestdata/iothreads.out | 18 ++++++++++++++++++ tools/virsh-domain.c | 18 ++++++++++++++++++ 5 files changed, 62 insertions(+), 6 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index a10d29e0ea..24052d0cdb 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -2905,6 +2905,8 @@ not available for statistical purposes. growth is managed by the hypervisor. * ``iothread..poll-shrink`` - polling time shrink value. A value of (zero) indicates shrink is managed by hypervisor. +* ``iothread..poll-weight`` - polling weight shift value. A value of 0 + (zero) indicates the hypervisor's default weight is used. =20 *--memory* returns: =20 @@ -3498,8 +3500,8 @@ iothreadset :: =20 iothreadset domain iothread_id [[--poll-max-ns ns] [--poll-grow factor] - [--poll-shrink divisor] [--thread-pool-min value] - [--thread-pool-max value]] + [--poll-shrink divisor] [--poll-weight factor] + [--thread-pool-min value] [--thread-pool-max value]] [[--config] [--live] | [--current]] =20 Modifies an existing iothread of the domain using the specified @@ -3511,10 +3513,14 @@ reach the maximum polling time. If a 0 (zero) is pr= ovided, then the default factor will be used. The *--poll-shrink* is the quotient by which the current polling time will be reduced in order to get below the maximum polling interval. If a 0 (zero) is provided, then -the default quotient will be used. The polling values are purely dynamic -for a running guest. Saving, destroying, stopping, etc. the guest will -result in the polling values returning to hypervisor defaults at the -next start, restore, etc. +the default quotient will be used. The *--poll-weight* sets the weight +shift value for adaptive polling, determining how much the most recent +event interval affects the next polling duration calculation. Larger +values reduce the weight of recent events. Valid range is [0, 63]. +If omitted or set to 0, the hypervisor selects a default. +The polling values are purely dynamic for a running guest. Saving, +destroying, stopping, etc. the guest will result in the polling values +returning to hypervisor defaults at the next start, restore, etc. =20 The *--thread-pool-min* and *--thread-pool-max* options then set lower and upper bound, respectively of number of threads in worker pool of given diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 536e291861..8546c3e251 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -189,6 +189,7 @@ struct _testIOThreadInfo { unsigned long long poll_max_ns; unsigned int poll_grow; unsigned int poll_shrink; + unsigned int poll_weight; }; =20 static void @@ -749,6 +750,7 @@ testDomainGenerateIOThreadInfos(virDomainObj *obj) iothread.poll_max_ns =3D 32768; iothread.poll_grow =3D 0; iothread.poll_shrink =3D 0; + iothread.poll_weight =3D 0; g_array_append_val(priv->iothreads, iothread); } } @@ -9681,6 +9683,7 @@ testDomainAddIOThread(virDomainPtr dom, iothread.poll_max_ns =3D 32768; iothread.poll_grow =3D 0; iothread.poll_shrink =3D 0; + iothread.poll_weight =3D 0; =20 g_array_append_val(priv->iothreads, iothread); =20 @@ -9795,6 +9798,8 @@ testDomainIOThreadParseParams(virTypedParameterPtr pa= rams, VIR_TYPED_PARAM_UINT, VIR_DOMAIN_IOTHREAD_POLL_SHRINK, VIR_TYPED_PARAM_UINT, + VIR_DOMAIN_IOTHREAD_POLL_WEIGHT, + VIR_TYPED_PARAM_UINT, NULL) < 0) return -1; =20 @@ -9813,6 +9818,11 @@ testDomainIOThreadParseParams(virTypedParameterPtr p= arams, &iothread->poll_shrink) < 0) return -1; =20 + if (virTypedParamsGetUInt(params, nparams, + VIR_DOMAIN_IOTHREAD_POLL_WEIGHT, + &iothread->poll_weight) < 0) + return -1; + return 0; } =20 @@ -9899,6 +9909,8 @@ testDomainGetStatsIOThread(virDomainObj *dom, "iothread.%u.poll-grow", iothread.iothrea= d_id); virTypedParamListAddUInt(params, iothread.poll_shrink, "iothread.%u.poll-shrink", iothread.iothr= ead_id); + virTypedParamListAddUInt(params, iothread.poll_weight, + "iothread.%u.poll-weight", iothread.iothr= ead_id); } =20 return 0; diff --git a/tests/virshtestdata/iothreads.in b/tests/virshtestdata/iothrea= ds.in index 25ebcb5cda..b5aed83bba 100644 --- a/tests/virshtestdata/iothreads.in +++ b/tests/virshtestdata/iothreads.in @@ -7,6 +7,8 @@ iothreadinfo --domain fc4 domstats --domain fc4 iothreadset --domain fc4 --id 6 --poll-max-ns 100 --poll-shrink 10 --poll-= grow 10 domstats --domain fc4 +iothreadset --domain fc4 --id 6 --poll-weight 3 +domstats --domain fc4 =20 iothreadadd --domain fc5 --id 2 iothreadinfo --domain fc5 diff --git a/tests/virshtestdata/iothreads.out b/tests/virshtestdata/iothre= ads.out index 1e38733bcf..a51593d765 100644 --- a/tests/virshtestdata/iothreads.out +++ b/tests/virshtestdata/iothreads.out @@ -23,9 +23,11 @@ Domain: 'fc4' iothread.4.poll-max-ns=3D32768 iothread.4.poll-grow=3D0 iothread.4.poll-shrink=3D0 + iothread.4.poll-weight=3D0 iothread.6.poll-max-ns=3D32768 iothread.6.poll-grow=3D0 iothread.6.poll-shrink=3D0 + iothread.6.poll-weight=3D0 =20 =20 Domain: 'fc4' @@ -35,9 +37,25 @@ Domain: 'fc4' iothread.4.poll-max-ns=3D32768 iothread.4.poll-grow=3D0 iothread.4.poll-shrink=3D0 + iothread.4.poll-weight=3D0 iothread.6.poll-max-ns=3D100 iothread.6.poll-grow=3D10 iothread.6.poll-shrink=3D10 + iothread.6.poll-weight=3D0 + + +Domain: 'fc4' + state.state=3D1 + state.reason=3D0 + iothread.count=3D2 + iothread.4.poll-max-ns=3D32768 + iothread.4.poll-grow=3D0 + iothread.4.poll-shrink=3D0 + iothread.4.poll-weight=3D0 + iothread.6.poll-max-ns=3D100 + iothread.6.poll-grow=3D10 + iothread.6.poll-shrink=3D10 + iothread.6.poll-weight=3D3 =20 =20 IOThread ID CPU Affinity diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index aa4f2a7a48..2e4923283b 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -8270,6 +8270,11 @@ static const vshCmdOptDef opts_iothreadset[] =3D { .unwanted_positional =3D true, .help =3D N_("set the value for reduction of the IOThread polling tim= e") }, + {.name =3D "poll-weight", + .type =3D VSH_OT_INT, + .unwanted_positional =3D true, + .help =3D N_("set the adaptive polling weight factor") + }, {.name =3D "thread-pool-min", .type =3D VSH_OT_INT, .unwanted_positional =3D true, @@ -8299,6 +8304,7 @@ cmdIOThreadSet(vshControl *ctl, const vshCmd *cmd) virTypedParameterPtr par; size_t npar =3D 0; unsigned long long poll_val; + unsigned int poll_weight; int thread_val; int rc; =20 @@ -8335,6 +8341,18 @@ cmdIOThreadSet(vshControl *ctl, const vshCmd *cmd) if (rc > 0) virTypedParamListAddUnsigned(params, poll_val, VIR_DOMAIN_IOTHREAD= _POLL_SHRINK); =20 + if ((rc =3D vshCommandOptUInt(ctl, cmd, "poll-weight", &poll_weight)) = < 0) + return false; + if (rc > 0) { + if (poll_weight > 63) { + vshError(ctl, _("poll-weight value %1$u is out of range [0, 63= ]"), + poll_weight); + return false; + } + + virTypedParamListAddUInt(params, poll_weight, VIR_DOMAIN_IOTHREAD_= POLL_WEIGHT); + } + if ((rc =3D vshCommandOptInt(ctl, cmd, "thread-pool-min", &thread_val)= ) < 0) return false; if (rc > 0) --=20 2.54.0