From nobody Sat Feb 7 15:26:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1568235953; cv=none; d=zoho.com; s=zohoarc; b=Elc9Tiu49n9nE5LnWu6PCs2VBvvIK+ai4/POtlgIg+ihb2Sfopn7Kaf+xwULA9nXBMxY8ySnu7wJRIuFYEBqE9RtvvF4I5RbiiUUKNKfpU9hJb2Qriewx8aQHlC1NhQDKqrIQk+T5rIdKQbOyDysJjcOIUX6ip/KHwtINZNeNA8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568235953; h=Content-Type:Content-Transfer-Encoding:Cc: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:ARC-Authentication-Results; bh=ic2oDn1CNkoDfJrG0RfoCyp8AXHFNuTG3X2/WiDMb+0=; b=gl8HWGmBVqqMLoshYWO3trg6ike+w2+wGGUW5HqJFf2wqiPoQvy9/dlO7MTfS5CwQ65RxvQF5KGq6ii5EeSQL8KVaBzfWLSMIEACxRvPW9n9z8285Hem1xgBP52G9VvYhSdNGaDvt35XQKOmfkZS45Dx3O4gDN7o4719YiPYGO8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1568235953168911.8762525955351; Wed, 11 Sep 2019 14:05:53 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E7E8C3082E90; Wed, 11 Sep 2019 21:05:50 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9FF201001B0B; Wed, 11 Sep 2019 21:05:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E7313180BA9A; Wed, 11 Sep 2019 21:05:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8BL5kfM027160 for ; Wed, 11 Sep 2019 17:05:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id F28F85D704; Wed, 11 Sep 2019 21:05:45 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ED6985D6D0 for ; Wed, 11 Sep 2019 21:05:43 +0000 (UTC) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 293A63DE04 for ; Wed, 11 Sep 2019 21:05:42 +0000 (UTC) Received: by mail-qt1-f194.google.com with SMTP id r15so27056544qtn.12 for ; Wed, 11 Sep 2019 14:05:42 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c6:2859:7136:a26f:ae4f:69fe]) by smtp.gmail.com with ESMTPSA id r55sm13927141qtj.86.2019.09.11.14.05.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2019 14:05:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Op3z2h/5llhZTQiSVBvXO5Vf1RemeVRFbneMYhtTr5Q=; b=qliwgVNJrb53yMrCpcnlZhSPRWPtVPFIWxAeg2rMpoT0XY4xMkOq4iH20LPcSP+eoy 3d9BlCBlsqPIPiNTX/cEVUbmflyNonemZic0OysYB9U8hReRnB+cvEx9Dj1IG54y86Sb B09WtsQnRcdAe7XOiErwpgATaCH8WnZRicVxmwWVVN1M5ePY0qdh8oP+RWLJQFQD0zRc fgffXgVndTBJaXeEmYJJIjaTZNrLhpoWAf14UCo44v+4JP747x+hO8ghPfuINEriavQA 5UV1S46LeDNIF+8iWQ8spXjh47UhCqlArrNr2D5UxSaNBWhHX+1wYol/agvUya+8KBLg Aplw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Op3z2h/5llhZTQiSVBvXO5Vf1RemeVRFbneMYhtTr5Q=; b=TST/zMpAO0soI4/pxTGxGXDfPjuJTwSmsUPxrzd5GtOPayHq9MM70VqefxAL4KSecJ ax2p207HPLn9AGqYocvnOJPnzmerJzMMHMR4U3krPAhgFJk1GD8DvufzZuRElsuRPJPk LGhnG6nOI1FN4buGHwh2+/W8xNzFIBG1ot19dG7qTgaQa3vDkegt2GSOgubDfhfe8RlS GICBm9nB+LsUwmF+2Z1JU6uHzLT0oOTZpEECj0+uR2BYWi6fpNM6KghKl+kY8KqavipV Icsr9zM/4EvLL6SreLjA/bGvxPqSP6rKjXioOB4TtLJOD+17BVteZbtY3F9jHG4vREOr ZSDg== X-Gm-Message-State: APjAAAU32iQ5irwI3VhVdfD4e+7Uf/ah0H2YMsyvkbN7MLfhaAkIWMCf bnpUqVVmtBQ7lqiJeYRy4CG0tnkE X-Google-Smtp-Source: APXvYqwCVzWGNA5F/QERCE95gwUVCFl0NRd7RfTMB71P2c9OvF397p8c5xYkI3s9UWcr1HNg52Z0Rw== X-Received: by 2002:ac8:460d:: with SMTP id p13mr37818457qtn.378.1568235941306; Wed, 11 Sep 2019 14:05:41 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Wed, 11 Sep 2019 18:05:27 -0300 Message-Id: <20190911210529.11766-2-danielhb413@gmail.com> In-Reply-To: <20190911210529.11766-1-danielhb413@gmail.com> References: <20190911210529.11766-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 11 Sep 2019 21:05:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 11 Sep 2019 21:05:42 +0000 (UTC) for IP:'209.85.160.194' DOMAIN:'mail-qt1-f194.google.com' HELO:'mail-qt1-f194.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.153 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS) 209.85.160.194 mail-qt1-f194.google.com 209.85.160.194 mail-qt1-f194.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza Subject: [libvirt] [PATCH v2 1/3] qemu: use a bigger unplug timeout for PPC64 guests 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 11 Sep 2019 21:05:51 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" For some architectures and setups, device removal can take longer than the default 5 seconds. This results in commands such as 'virsh setvcpus' to fire timeout messages even if the operation were successful in the guest, confusing the user. This patch sets a new 10 seconds unplug timeout for PPC64 guests. All other archs will keep the default 5 seconds timeout. Instead of putting 'if PPC64' conditionals inside qemu_hotplug.c to set the new timeout value, a new QEMU driver attribute 'unplugTimeout' was added. The timeout value is set during qemuStateInitialize only once. All qemu_hotplug.c functions that uses the timeout have easy access to a qemu_driver object, thus the change to use unplugTimeout is straightforward. The now unused 'qemuDomainRemoveDeviceWaitTime' global can't be simply erased from qemu_hotplug.c though. Next patch will remove it properly. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_conf.h | 3 +++ src/qemu/qemu_driver.c | 11 +++++++++++ src/qemu/qemu_hotplug.c | 11 ++++++----- tests/qemuhotplugtest.c | 2 +- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 8473d6d4ca..edda1421d0 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -296,6 +296,9 @@ struct _virQEMUDriver { =20 /* Immutable pointer, self-locking APIs */ virHashAtomicPtr migrationErrors; + + /* Immutable value */ + unsigned int unplugTimeout; }; =20 virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1e041a8bac..2ebe22ee79 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -134,6 +134,13 @@ VIR_LOG_INIT("qemu.qemu_driver"); =20 #define QEMU_NB_BANDWIDTH_PARAM 7 =20 +/* Timeout in miliseconds for device removal. PPC64 domains + * can experience a bigger delay in unplug operations during + * heavy guest activity (vcpu being the most notable case), thus + * the timeout for PPC64 is also bigger. */ +#define QEMU_UNPLUG_TIMEOUT 5000 +#define QEMU_UNPLUG_TIMEOUT_PPC64 10000 + static void qemuProcessEventHandler(void *data, void *opaque); =20 static int qemuStateCleanup(void); @@ -1095,6 +1102,10 @@ qemuStateInitialize(bool privileged, if (!qemu_driver->workerPool) goto error; =20 + qemu_driver->unplugTimeout =3D QEMU_UNPLUG_TIMEOUT; + if (ARCH_IS_PPC64(qemu_driver->caps->host.arch)) + qemu_driver->unplugTimeout =3D QEMU_UNPLUG_TIMEOUT_PPC64; + qemuProcessReconnectAll(qemu_driver); =20 qemuAutostartDomains(qemu_driver); diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index bd8868b0f7..4088cc5e8e 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -5237,7 +5237,8 @@ qemuDomainResetDeviceRemoval(virDomainObjPtr vm) * - we failed to reliably wait for the event and thus use fallback b= ehavior */ static int -qemuDomainWaitForDeviceRemoval(virDomainObjPtr vm) +qemuDomainWaitForDeviceRemoval(virQEMUDriverPtr driver, + virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv =3D vm->privateData; unsigned long long until; @@ -5245,7 +5246,7 @@ qemuDomainWaitForDeviceRemoval(virDomainObjPtr vm) =20 if (virTimeMillisNow(&until) < 0) return 1; - until +=3D qemuDomainRemoveDeviceWaitTime; + until +=3D driver->unplugTimeout; =20 while (priv->unplug.alias) { if ((rc =3D virDomainObjWaitUntil(vm, until)) =3D=3D 1) @@ -5701,7 +5702,7 @@ qemuDomainDetachDeviceChr(virQEMUDriverPtr driver, } else if (async) { ret =3D 0; } else { - if ((ret =3D qemuDomainWaitForDeviceRemoval(vm)) =3D=3D 1) + if ((ret =3D qemuDomainWaitForDeviceRemoval(driver, vm)) =3D=3D 1) ret =3D qemuDomainRemoveChrDevice(driver, vm, tmpChr, true); } =20 @@ -6001,7 +6002,7 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm, if (async) { ret =3D 0; } else { - if ((ret =3D qemuDomainWaitForDeviceRemoval(vm)) =3D=3D 1) + if ((ret =3D qemuDomainWaitForDeviceRemoval(driver, vm)) =3D=3D 1) ret =3D qemuDomainRemoveDevice(driver, vm, &detach); } =20 @@ -6107,7 +6108,7 @@ qemuDomainHotplugDelVcpu(virQEMUDriverPtr driver, goto cleanup; } =20 - if ((rc =3D qemuDomainWaitForDeviceRemoval(vm)) <=3D 0) { + if ((rc =3D qemuDomainWaitForDeviceRemoval(driver, vm)) <=3D 0) { if (rc =3D=3D 0) virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("vcpu unplug request timed out")); diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 3c177c6622..da6258991d 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -645,7 +645,7 @@ mymain(void) driver.hostdevMgr =3D virHostdevManagerGetDefault(); =20 /* wait only 100ms for DEVICE_DELETED event */ - qemuDomainRemoveDeviceWaitTime =3D 100; + driver.unplugTimeout =3D 100; =20 #define DO_TEST(file, ACTION, dev, fial, kep, ...) \ do { \ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list