From nobody Fri Apr 19 08:47:59 2024 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 1540863223020901.8126362311654; Mon, 29 Oct 2018 18:33:43 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 25E2089AC6; Tue, 30 Oct 2018 01:33:39 +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 0130C5D759; Tue, 30 Oct 2018 01:33:38 +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 7F9C24BB74; Tue, 30 Oct 2018 01:33:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9U1QTtO012987 for ; Mon, 29 Oct 2018 21:26:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id C7585106223E; Tue, 30 Oct 2018 01:26:29 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BF2AC105707F for ; Tue, 30 Oct 2018 01:26:27 +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 CD0CA308624A for ; Tue, 30 Oct 2018 01:26:25 +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); Mon, 29 Oct 2018 19:26:20 -0600 From: Jim Fehlig To: libvir-list@redhat.com Date: Mon, 29 Oct 2018 19:26:00 -0600 Message-Id: <20181030012600.31585-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.49]); Tue, 30 Oct 2018 01:26:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 30 Oct 2018 01:26:26 +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.49 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 30 Oct 2018 01:33:40 +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 --- src/libxl/libxl_domain.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 0032b9dd11..295ec04a85 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -447,8 +447,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) { @@ -532,6 +534,33 @@ libxlDomainShutdownThread(void *opaque) * after calling libxl_domain_suspend() are handled by it's caller= s. */ goto endjob; + } else if (xl_reason =3D=3D LIBXL_SHUTDOWN_REASON_SOFT_RESET) { + libxlDomainObjPrivatePtr priv =3D vm->privateData; + int res; + + 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); + goto destroy; + } + + if (priv->deathW) { + libxl_evdisable_domain_death(cfg->ctx, priv->deathW); + priv->deathW =3D NULL; + } + + res =3D libxl_domain_soft_reset(cfg->ctx, &d_config, vm->def->id, + NULL, NULL); + if (res !=3D 0) { + VIR_ERROR(_("Failed to soft reset VM '%s'. Destroying VM"), + vm->def->name); + goto destroy; + } + libxl_evenable_domain_death(cfg->ctx, vm->def->id, 0, &priv->death= W); + libxl_domain_unpause(cfg->ctx, vm->def->id); + goto endjob; } else { VIR_INFO("Unhandled shutdown_reason %d", xl_reason); goto endjob; @@ -565,6 +594,7 @@ libxlDomainShutdownThread(void *opaque) virObjectEventStateQueue(driver->domainEventState, dom_event); libxl_event_free(cfg->ctx, ev); VIR_FREE(shutdown_info); + libxl_domain_config_dispose(&d_config); virObjectUnref(cfg); } =20 --=20 2.18.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list