From nobody Tue Feb 10 17:15:32 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; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1541015596567382.8149096608456; Wed, 31 Oct 2018 12:53:16 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7AEFA7F6B2; Wed, 31 Oct 2018 19:53:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E60A9600C0; Wed, 31 Oct 2018 19:53:13 +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 8F1714CA94; Wed, 31 Oct 2018 19:53:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9VJpgKR014796 for ; Wed, 31 Oct 2018 15:51:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0FCC067C67; Wed, 31 Oct 2018 19:51:42 +0000 (UTC) Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0975D61B60 for ; Wed, 31 Oct 2018 19:51:40 +0000 (UTC) Received: from smtp2.provo.novell.com (smtp2.provo.novell.com [137.65.250.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AEC51308213D for ; Wed, 31 Oct 2018 19:51:38 +0000 (UTC) Received: from linux-tbji.provo.novell.com (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (NOT encrypted); Wed, 31 Oct 2018 13:51:37 -0600 From: Jim Fehlig To: libvir-list@redhat.com Date: Wed, 31 Oct 2018 13:51:27 -0600 Message-Id: <20181031195127.4880-4-jfehlig@suse.com> In-Reply-To: <20181031195127.4880-1-jfehlig@suse.com> References: <20181031195127.4880-1-jfehlig@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 31 Oct 2018 19:51:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 31 Oct 2018 19:51:39 +0000 (UTC) for IP:'137.65.250.81' DOMAIN:'smtp2.provo.novell.com' HELO:'smtp2.provo.novell.com' FROM:'jfehlig@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.81 smtp2.provo.novell.com 137.65.250.81 smtp2.provo.novell.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.42 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH V2 3/3] libxl: add support for soft reset 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-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 31 Oct 2018 19:53:15 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The pvops Linux kernel implements machine_ops.crash_shutdown as static void xen_hvm_crash_shutdown(struct pt_regs *regs) { native_machine_crash_shutdown(regs); xen_reboot(SHUTDOWN_soft_reset); } but currently the libxl driver does not handle the soft reset shutdown event. As a result, the guest domain never proceeds past xen_reboot(), making it impossible for HVM domains to save a crash dump using kexec. This patch adds support for handling the soft reset event by calling libxl_domain_soft_reset() and re-enabling domain death events, which is similar to the xl tool handling of soft reset shutdown event. Signed-off-by: Jim Fehlig --- V2: Check for availability of soft reset with LIBXL_HAVE_SOFT_RESET src/libxl/libxl_domain.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 4cdaee0e51..47c1f49538 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -471,8 +471,10 @@ libxlDomainShutdownThread(void *opaque) virObjectEventPtr dom_event =3D NULL; libxl_shutdown_reason xl_reason =3D ev->u.domain_shutdown.shutdown_rea= son; libxlDriverConfigPtr cfg; + libxl_domain_config d_config; =20 cfg =3D libxlDriverConfigGet(driver); + libxl_domain_config_init(&d_config); =20 vm =3D virDomainObjListFindByID(driver->domains, ev->domid); if (!vm) { @@ -563,6 +565,33 @@ libxlDomainShutdownThread(void *opaque) * Similar to the xl implementation, ignore SUSPEND. Any actions = needed * after calling libxl_domain_suspend() are handled by it's caller= s. */ +#ifdef LIBXL_HAVE_SOFT_RESET + } else if (xl_reason =3D=3D LIBXL_SHUTDOWN_REASON_SOFT_RESET) { + libxlDomainObjPrivatePtr priv =3D vm->privateData; + if (libxl_retrieve_domain_configuration(cfg->ctx, vm->def->id, + &d_config) !=3D 0) { + VIR_ERROR(_("Failed to retrieve config for VM '%s'. " + "Unable to perform soft reset. Destroying VM"), + vm->def->name); + libxlDomainShutdownHandleDestroy(driver, vm); + goto endjob; + } + + if (priv->deathW) { + libxl_evdisable_domain_death(cfg->ctx, priv->deathW); + priv->deathW =3D NULL; + } + + if (libxl_domain_soft_reset(cfg->ctx, &d_config, vm->def->id, + NULL, NULL) !=3D 0) { + VIR_ERROR(_("Failed to soft reset VM '%s'. Destroying VM"), + vm->def->name); + libxlDomainShutdownHandleDestroy(driver, vm); + goto endjob; + } + libxl_evenable_domain_death(cfg->ctx, vm->def->id, 0, &priv->death= W); + libxl_domain_unpause(cfg->ctx, vm->def->id); +#endif } else { VIR_INFO("Unhandled shutdown_reason %d", xl_reason); } --=20 2.18.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list