From nobody Sun Feb 8 13:53:31 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; envelope-from=libvir-list-bounces@redhat.com; helo=mx4-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mx.zohomail.com with SMTPS id 1487679563381147.91808661033292; Tue, 21 Feb 2017 04:19:23 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1LCFpfv011556; Tue, 21 Feb 2017 07:15:51 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1LCFEaM022569 for ; Tue, 21 Feb 2017 07:15:14 -0500 Received: from antique-work.brq.redhat.com (dhcp129-175.brq.redhat.com [10.34.129.175]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LCF9hH031008 for ; Tue, 21 Feb 2017 07:15:13 -0500 From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 21 Feb 2017 13:15:00 +0100 Message-Id: <13e45140afdb7f395a4b29b099cc476817ee2949.1487678590.git.phrdina@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/12] virsh: extend iothreadadd to support virDomainAddIOThreadParams X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina --- tools/virsh-domain.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++= ++-- tools/virsh.pod | 10 ++++++++ 2 files changed, 73 insertions(+), 2 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 023ec8a8b3..dddb336a57 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -7191,6 +7191,24 @@ static const vshCmdOptDef opts_iothreadadd[] =3D { .flags =3D VSH_OFLAG_REQ, .help =3D N_("iothread for the new IOThread") }, + {.name =3D "poll-disabled", + .type =3D VSH_OT_BOOL, + .help =3D N_("disable polling for the new IOThread") + }, + {.name =3D "poll-max-ns", + .type =3D VSH_OT_INT, + .help =3D N_("set max polling time in ns for the new IOThread") + }, + {.name =3D "poll-grow", + .type =3D VSH_OT_INT, + .help =3D N_("set how much ns should be used to grow current polling " + "time for the new IOThread") + }, + {.name =3D "poll-shrink", + .type =3D VSH_OT_INT, + .help =3D N_("set how much ns should be used to shrink current pollin= g " + "time for the new IOThread") + }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, VIRSH_COMMON_OPT_DOMAIN_CURRENT, @@ -7206,10 +7224,21 @@ cmdIOThreadAdd(vshControl *ctl, const vshCmd *cmd) bool config =3D vshCommandOptBool(cmd, "config"); bool live =3D vshCommandOptBool(cmd, "live"); bool current =3D vshCommandOptBool(cmd, "current"); + bool poll_disabled =3D vshCommandOptBool(cmd, "poll-disabled"); unsigned int flags =3D VIR_DOMAIN_AFFECT_CURRENT; + virTypedParameterPtr params =3D NULL; + int nparams =3D 0; + int maxparams =3D 0; + unsigned int poll_val; + int rc; =20 VSH_EXCLUSIVE_OPTIONS_VAR(current, live); VSH_EXCLUSIVE_OPTIONS_VAR(current, config); + VSH_EXCLUSIVE_OPTIONS("poll-disabled", "poll-max-ns"); + VSH_EXCLUSIVE_OPTIONS("poll-disabled", "poll-grow"); + VSH_EXCLUSIVE_OPTIONS("poll-disabled", "poll-shrink"); + VSH_REQUIRE_OPTION("poll-grow", "poll-max-ns"); + VSH_REQUIRE_OPTION("poll-shrink", "poll-max-ns"); =20 if (config) flags |=3D VIR_DOMAIN_AFFECT_CONFIG; @@ -7226,14 +7255,46 @@ cmdIOThreadAdd(vshControl *ctl, const vshCmd *cmd) goto cleanup; } =20 - if (virDomainAddIOThread(dom, iothread_id, flags) < 0) - goto cleanup; + if (poll_disabled) { + if (virTypedParamsAddBoolean(¶ms, &nparams, &maxparams, + VIR_DOMAIN_IOTHREAD_POLL_ENABLED, 0) = < 0) + goto save_error; + } else { +#define VSH_IOTHREAD_SET_PARAMS(opt, param) = \ + poll_val =3D 0; = \ + if ((rc =3D vshCommandOptUInt(ctl, cmd, opt, &poll_val)) < 0) = \ + goto cleanup; = \ + if (rc > 0 && = \ + virTypedParamsAddUInt(¶ms, &nparams, &maxparams, = \ + param, poll_val) < 0) = \ + goto save_error; + + VSH_IOTHREAD_SET_PARAMS("poll-max-ns", VIR_DOMAIN_IOTHREAD_POLL_MA= X_NS) + VSH_IOTHREAD_SET_PARAMS("poll-grow", VIR_DOMAIN_IOTHREAD_POLL_GROW) + VSH_IOTHREAD_SET_PARAMS("poll-shrink", VIR_DOMAIN_IOTHREAD_POLL_SH= RINK) + +#undef VSH_IOTHREAD_SET_PARAMS + } + + if (nparams) { + if (virDomainAddIOThreadParams(dom, iothread_id, + params, nparams, flags) < 0) + goto cleanup; + } else { + if (virDomainAddIOThread(dom, iothread_id, flags) < 0) + goto cleanup; + } =20 ret =3D true; =20 cleanup: + virTypedParamsFree(params, nparams); virDomainFree(dom); return ret; + + save_error: + vshSaveLibvirtError(); + goto cleanup; } =20 /* diff --git a/tools/virsh.pod b/tools/virsh.pod index 90f4b5a1f7..12fa650f03 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1520,12 +1520,22 @@ B: The expression is sequentially evaluated, = so "0-15,^8" is identical to "9-14,0-7,15" but not identical to "^8,0-15". =20 =3Ditem B I I +[[I<--poll-disable>] | [I<--poll-max-ns> B] [I<--poll-grow> B] +[I<--poll-shring> B]] [[I<--config>] [I<--live>] | [I<--current>]] =20 Add a new IOThread to the domain using the specified I. If the I already exists, the command will fail. The I must be greater than zero. =20 +It is possible to configure polling for the new added IOThread using +I<--poll-*> options. If no polling option is not specified hypervisor +will use its default configuration. To disable polling use I<--poll-disab= le>. +To enable polling you need to at least provide I<--poll-max-ns> which sets +the maximum polling time that can be used by polling algorithm. +I<--poll-grow> and I<--poll-shring> is used to configure how the polling +algorithm will adapt the current polling time to different workloads. + If I<--live> is specified, affect a running guest. If the guest is not running an error is returned. If I<--config> is specified, affect the next boot of a persistent guest. --=20 2.11.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list