From owner-svn-src-all@freebsd.org Tue Oct 1 08:21:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E215B130065; Tue, 1 Oct 2019 08:21:41 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46jC0j5g4vz4ZQv; Tue, 1 Oct 2019 08:21:41 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A696F1895F; Tue, 1 Oct 2019 08:21:41 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x918LffI005984; Tue, 1 Oct 2019 08:21:41 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x918LfOg005983; Tue, 1 Oct 2019 08:21:41 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201910010821.x918LfOg005983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Tue, 1 Oct 2019 08:21:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352925 - head/sys/dev/xen/control X-SVN-Group: head X-SVN-Commit-Author: royger X-SVN-Commit-Paths: head/sys/dev/xen/control X-SVN-Commit-Revision: 352925 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Oct 2019 08:21:41 -0000 Author: royger Date: Tue Oct 1 08:21:41 2019 New Revision: 352925 URL: https://svnweb.freebsd.org/changeset/base/352925 Log: xen/ctrl: acknowledge all control requests Currently only suspend requests are acknowledged by writing an empty string back to the xenstore control node, but poweroff or reboot requests are not acknowledged and FreeBSD simply proceeds to perform the desired action. Fix this by acknowledging all requests, and remove the suspend specific ack done in the handler. Sponsored by: Citrix Systems R&D MFC after: 3 days Modified: head/sys/dev/xen/control/control.c Modified: head/sys/dev/xen/control/control.c ============================================================================== --- head/sys/dev/xen/control/control.c Tue Oct 1 03:35:54 2019 (r352924) +++ head/sys/dev/xen/control/control.c Tue Oct 1 08:21:41 2019 (r352925) @@ -221,12 +221,6 @@ xctrl_suspend() KASSERT((PCPU_GET(cpuid) == 0), ("Not running on CPU#0")); /* - * Clear our XenStore node so the toolstack knows we are - * responding to the suspend request. - */ - xs_write(XST_NIL, "control", "shutdown", ""); - - /* * Be sure to hold Giant across DEVICE_SUSPEND/RESUME since non-MPSAFE * drivers need this. */ @@ -368,6 +362,11 @@ xctrl_on_watch_event(struct xs_watch *watch, const cha &result_len, (void **)&result); if (error != 0) return; + + /* Acknowledge the request by writing back an empty string. */ + error = xs_write(XST_NIL, "control", "shutdown", ""); + if (error != 0) + printf("unable to ack shutdown request, proceeding anyway\n"); reason = xctrl_shutdown_reasons; last_reason = reason + nitems(xctrl_shutdown_reasons);