summaryrefslogtreecommitdiff
path: root/kexec/kexec-xen.c
diff options
context:
space:
mode:
authorRaphael Ning <raphning@amazon.com>2022-03-23 14:44:18 +0000
committerSimon Horman <horms@verge.net.au>2022-03-23 15:58:27 +0100
commit501646beec2b1c4a2ff4f2909c5ddb5cea8c7f8e (patch)
treeba5bf8bd4a43a65cbc95c688af9cd89dff6558ce /kexec/kexec-xen.c
parent1d7a308bf7349fcf1627e950159029dfccf85891 (diff)
downloadkexec-tools-501646beec2b1c4a2ff4f2909c5ddb5cea8c7f8e.tar.gz
kexec-xen: Allow xen_kexec_exec() to return in case of Live Update
Currently, my_exec() does not expect the Xen KEXEC_CMD_kexec hypercall to return on success, because it assumes that the hypercall always triggers an immediate reboot. However, for Live Update, the hypercall merely schedules the kexec operation and returns; the actual reboot happens asynchronously. [1] Therefore, rework the Xen code path of my_exec() such that it does not treat a successfully processed Live Update request as an error. Also, rephrase the comment above the function to remove ambiguity. [1] https://lists.xen.org/archives/html/xen-devel/2021-05/msg00286.html Signed-off-by: Raphael Ning <raphning@amazon.com> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/kexec-xen.c')
-rw-r--r--kexec/kexec-xen.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/kexec/kexec-xen.c b/kexec/kexec-xen.c
index 47da3da..a7c8933 100644
--- a/kexec/kexec-xen.c
+++ b/kexec/kexec-xen.c
@@ -247,21 +247,24 @@ int xen_kexec_status(uint64_t kexec_flags)
return ret;
}
-void xen_kexec_exec(uint64_t kexec_flags)
+int xen_kexec_exec(uint64_t kexec_flags)
{
xc_interface *xch;
uint8_t type = KEXEC_TYPE_DEFAULT;
+ int ret;
xch = xc_interface_open(NULL, NULL, 0);
if (!xch)
- return;
+ return -1;
if (kexec_flags & KEXEC_LIVE_UPDATE)
type = KEXEC_TYPE_LIVE_UPDATE;
- xc_kexec_exec(xch, type);
+ ret = xc_kexec_exec(xch, type);
xc_interface_close(xch);
+
+ return ret;
}
#else /* ! HAVE_LIBXENCTRL */
@@ -286,8 +289,9 @@ int xen_kexec_status(uint64_t kexec_flags)
return -1;
}
-void xen_kexec_exec(uint64_t kexec_flags)
+int xen_kexec_exec(uint64_t kexec_flags)
{
+ return -1;
}
#endif