From: Dexuan Cui <decui@microsoft.com>
To: KY Srinivasan <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Stephen Hemminger <sthemmin@microsoft.com>,
"sashal@kernel.org" <sashal@kernel.org>,
"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Michael Kelley <mikelley@microsoft.com>
Cc: Dexuan Cui <decui@microsoft.com>
Subject: [PATCH 3/3] hv_utils: Support host-initiated restart request
Date: Wed, 11 Sep 2019 23:39:00 +0000 [thread overview]
Message-ID: <1568245130-70712-4-git-send-email-decui@microsoft.com> (raw)
In-Reply-To: <1568245130-70712-1-git-send-email-decui@microsoft.com>
To test the code, we should run this command on the host:
Restart-VM $vm -Type Reboot
Signed-off-by: Dexuan Cui <decui@microsoft.com>
---
drivers/hv/hv_util.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
index 9e98c5d..6d642f5 100644
--- a/drivers/hv/hv_util.c
+++ b/drivers/hv/hv_util.c
@@ -24,7 +24,9 @@
#define SD_MAJOR 3
#define SD_MINOR 0
+#define SD_MINOR_1 1
#define SD_MINOR_2 2
+#define SD_VERSION_3_1 (SD_MAJOR << 16 | SD_MINOR_1)
#define SD_VERSION_3_2 (SD_MAJOR << 16 | SD_MINOR_2)
#define SD_VERSION (SD_MAJOR << 16 | SD_MINOR)
@@ -52,9 +54,10 @@
static int ts_srv_version;
static int hb_srv_version;
-#define SD_VER_COUNT 3
+#define SD_VER_COUNT 4
static const int sd_versions[] = {
SD_VERSION_3_2,
+ SD_VERSION_3_1,
SD_VERSION,
SD_VERSION_1
};
@@ -147,6 +150,11 @@ static void perform_shutdown(struct work_struct *dummy)
orderly_poweroff(true);
}
+static void perform_restart(struct work_struct *dummy)
+{
+ orderly_reboot();
+}
+
static void perform_hibernation(struct work_struct *dummy)
{
/*
@@ -175,6 +183,11 @@ static void perform_hibernation(struct work_struct *dummy)
static DECLARE_WORK(shutdown_work, perform_shutdown);
/*
+ * Perform the restart operation in a thread context.
+ */
+static DECLARE_WORK(restart_work, perform_restart);
+
+/*
* Perform the hibernation operation in a thread context.
*/
static DECLARE_WORK(hibernate_work, perform_hibernation);
@@ -222,6 +235,14 @@ static void shutdown_onchannelcallback(void *context)
pr_info("Shutdown request received -"
" graceful shutdown initiated\n");
break;
+ case 2:
+ case 3:
+ pr_info("Restart request received -"
+ " graceful restart initiated\n");
+ icmsghdrp->status = HV_S_OK;
+
+ schedule_work(&restart_work);
+ break;
case 4:
case 5:
pr_info("Hibernation request received -"
--
1.8.3.1
prev parent reply other threads:[~2019-09-11 23:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-11 23:38 [PATCH 0/3] Enhance hv_utils to support hibernation Dexuan Cui
2019-09-11 23:38 ` [PATCH 1/3] hv_utils: Add the support of hibernation Dexuan Cui
2019-09-12 16:36 ` Vitaly Kuznetsov
2019-09-13 19:15 ` Dexuan Cui
2019-09-16 8:45 ` Vitaly Kuznetsov
2019-09-19 6:34 ` Dexuan Cui
2019-09-19 10:27 ` Vitaly Kuznetsov
2019-09-21 7:26 ` Dexuan Cui
2019-09-11 23:38 ` [PATCH 2/3] hv_utils: Support host-initiated hibernation request Dexuan Cui
2019-09-12 16:26 ` Vitaly Kuznetsov
2019-09-13 16:42 ` Dexuan Cui
2019-09-11 23:39 ` Dexuan Cui [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1568245130-70712-4-git-send-email-decui@microsoft.com \
--to=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mikelley@microsoft.com \
--cc=sashal@kernel.org \
--cc=sthemmin@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).