Use freeze/thaw/restore PM events for Guest suspend/resume/checkpoint
Subsystems (2)
PATCH 1/1 Use freeze/thaw/restore PM events for Guest suspend/resume/checkpoint
Use PM_FREEZE, PM_THAW and PM_RESTORE power events for suspend/resume functionality, instead of PM_SUSPEND and PM_RESUME. Use of these pm events also fixes the Xen Guest hangup when taking checkpoints. When a suspend event is cancelled (i.e. while taking checkpoints once/continuously), we use PM_THAW instead of PM_RESUME. PM_RESTORE is used when suspend is not cancelled. See Documentation/power/devices.txt and linux/pm.h for more info about freeze, thaw and restore. The sequence of pm events in a suspend-resume scenario is shown below.
dpm_suspend_start(PMSG_FREEZE);
dpm_suspend_noirq(PMSG_FREEZE);
sysdev_suspend(PMSG_FREEZE);
cancelled = suspend_hypercall()
sysdev_resume();
dpm_resume_noirq(cancelled ? PMSG_THAW : PMSG_RESTORE);
dpm_resume_end(cancelled ? PMSG_THAW : PMSG_RESTORE);--- drivers/net/xen-netfront.c | 2 +- drivers/xen/manage.c | 12 ++++++------ drivers/xen/xenbus/xenbus_probe.c | 11 +++++++++-- drivers/xen/xenbus/xenbus_probe.h | 3 ++- drivers/xen/xenbus/xenbus_probe_frontend.c | 10 ++++++++-- include/xen/xenbus.h | 2 +- 6 files changed, 27 insertions(+), 13 deletions(-)
drivers/net/xen-netfront.c +1 -1
@@ -1293,7 +1293,7 @@ static void xennet_disconnect_backend(struct netfront_info *info) info->rx.sring =NULL ; } -static int netfront_suspend (struct xenbus_device *dev,pm_message_t state) +static int netfront_suspend (struct xenbus_device *dev) {struct netfront_info *info =dev_get_drvdata (&dev->dev);struct hrtimer *timer = &info->smart_poll.timer;
drivers/xen/manage.c +6 -6
@@ -60,7 +60,7 @@ static int xen_suspend(void *data)BUG_ON (!irqs_disabled ()); - err =sysdev_suspend (PMSG_SUSPEND ); + err =sysdev_suspend (PMSG_FREEZE );if (err) {printk (KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n" , err);
@@ -117,16 +117,16 @@ static void do_suspend(void) }#endif - err =dpm_suspend_start (PMSG_SUSPEND ); + err =dpm_suspend_start (PMSG_FREEZE );if (err) {printk (KERN_ERR "xen suspend: dpm_suspend_start %d\n" , err); goto out_thaw; } -printk (KERN_DEBUG "suspending xenstore...\n" ); +/* printk(KERN_DEBUG "suspending xenstore...\n"); */ xs_suspend (); - err =dpm_suspend_noirq (PMSG_SUSPEND ); + err =dpm_suspend_noirq (PMSG_FREEZE );if (err) {printk (KERN_ERR "dpm_suspend_noirq failed: %d\n" , err); goto out_resume;
@@ -137,7 +137,7 @@ static void do_suspend(void)else err =stop_machine (xen_suspend, &cancelled,cpumask_of (0 )); -dpm_resume_noirq (PMSG_RESUME ); +dpm_resume_noirq (cancelled ?PMSG_THAW :PMSG_RESTORE );if (err) {printk (KERN_ERR "failed to start xen_suspend: %d\n" , err);
@@ -151,7 +151,7 @@ out_resume: }else xs_suspend_cancel (); -dpm_resume_end (PMSG_RESUME ); +dpm_resume_end (cancelled ?PMSG_THAW :PMSG_RESTORE );/* Make sure timer events get retriggered on all CPUs */ clock_was_set ();
drivers/xen/xenbus/xenbus_probe.c +9 -2
@@ -575,7 +575,7 @@ void xenbus_dev_changed(const char *node, struct xen_bus_type *bus) }EXPORT_SYMBOL_GPL (xenbus_dev_changed); -int xenbus_dev_suspend (struct device *dev,pm_message_t state) +int xenbus_dev_suspend (struct device *dev) {int err =0 ;struct xenbus_driver *drv;
@@ -587,7 +587,7 @@ int xenbus_dev_suspend(struct device *dev, pm_message_t state)return 0 ; drv =to_xenbus_driver (dev->driver);if (drv->suspend) - err = drv->suspend (xdev, state); + err = drv->suspend (xdev);if (err)printk (KERN_WARNING "xenbus: suspend %s failed: %i\n" ,dev_name (dev), err);
@@ -638,6 +638,13 @@ int xenbus_dev_resume(struct device *dev) }EXPORT_SYMBOL_GPL (xenbus_dev_resume); +int xenbus_dev_cancel (struct device *dev) +{ +/* Do nothing */ +return 0 ; +} +EXPORT_SYMBOL_GPL (xenbus_dev_cancel); +/* A flag to determine if xenstored is 'ready' (i.e. has started) */ int xenstored_ready =0 ;
drivers/xen/xenbus/xenbus_probe.h +2 -1
@@ -62,8 +62,9 @@ extern void xenbus_dev_changed(const char *node, struct xen_bus_type *bus);extern void xenbus_dev_shutdown (struct device *_dev); -extern int xenbus_dev_suspend (struct device *dev,pm_message_t state); +extern int xenbus_dev_suspend (struct device *dev);extern int xenbus_dev_resume (struct device *dev); +extern int xenbus_dev_cancel (struct device *dev); extern void xenbus_otherend_changed(struct xenbus_watch *watch, const char **vec, unsigned int len,
drivers/xen/xenbus/xenbus_probe_frontend.c +8 -2
@@ -82,6 +82,13 @@ static struct device_attribute xenbus_frontend_dev_attrs[] = {__ATTR_NULL }; +static struct dev_pm_ops xenbus_pm_ops = { + .suspend = xenbus_dev_suspend, + .resume = xenbus_dev_resume, + .freeze = xenbus_dev_suspend, + .thaw = xenbus_dev_cancel, + .restore = xenbus_dev_resume, +};static struct xen_bus_type xenbus_frontend = { .root ="device" ,
@@ -98,8 +105,7 @@ static struct xen_bus_type xenbus_frontend = { .shutdown = xenbus_dev_shutdown, .dev_attrs= xenbus_frontend_dev_attrs, - .suspend = xenbus_dev_suspend, - .resume = xenbus_dev_resume, + .pm = &xenbus_pm_ops, }, };
include/xen/xenbus.h +1 -1
@@ -91,7 +91,7 @@ struct xenbus_driver {void (*otherend_changed)(struct xenbus_device *dev,enum xenbus_state backend_state);int (*remove)(struct xenbus_device *dev); -int (*suspend)(struct xenbus_device *dev,pm_message_t state); +int (*suspend)(struct xenbus_device *dev);int (*resume)(struct xenbus_device *dev);int (*uevent)(struct xenbus_device *,struct kobj_uevent_env *);struct device_driver driver;
Quoted 190 lines · Shriram Rajagopalan
Use
PM_FREEZE,PM_THAWandPM_RESTOREpower events for suspend/resume functionality, instead ofPM_SUSPENDandPM_RESUME. Use of these pm events also fixes the Xen Guest hangup when taking checkpoints. When a suspend event is cancelled (i.e. while taking checkpoints once/continuously), we usePM_THAWinstead ofPM_RESUME.PM_RESTOREis used when suspend is not cancelled. SeeDocumentation/power/devices.txtandlinux/pm.hfor more info about freeze, thaw and restore. The sequence of pm events in a suspend-resume scenario is shown below.dpm_suspend_start(PMSG_FREEZE);
dpm_suspend_noirq(PMSG_FREEZE);
sysdev_suspend(PMSG_FREEZE); cancelled =suspend_hypercall()sysdev_resume();
dpm_resume_noirq(cancelled ? PMSG_THAW : PMSG_RESTORE);
dpm_resume_end(cancelled ? PMSG_THAW : PMSG_RESTORE);Signed-off-by Shriram Rajagopalan <[email protected]>---
drivers/net/xen-netfront.c | 2 +-drivers/xen/manage.c| 12 ++++++------drivers/xen/xenbus/xenbus_probe.c| 11 +++++++++--drivers/xen/xenbus/xenbus_probe.h| 3 ++-drivers/xen/xenbus/xenbus_probe_frontend.c| 10 ++++++++--include/xen/xenbus.h| 2 +-6 files changed, 27 insertions(+), 13 deletions(-)drivers/net/xen-netfront.c +1
-1@@ -1293,7 +1293,7 @@ static void xennet_disconnect_backend(struct netfront_info *info) info->rx.sring = NULL; } -static int netfront_suspend (struct xenbus_device *dev,pm_message_t state) +static int netfront_suspend (struct xenbus_device *dev) { struct netfront_info *info = dev_get_drvdata(&dev->dev); struct hrtimer *timer = &info->smart_poll.timer;drivers/xen/manage.c +4
-4@@ -60,7 +60,7 @@ static int xen_suspend(void *data) BUG_ON(!irqs_disabled()); - err = sysdev_suspend(PMSG_SUSPEND); + err = sysdev_suspend(PMSG_FREEZE); if (err) { printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n", err);@@ -117,16 +117,16 @@ static void do_suspend(void) } #endif - err = dpm_suspend_start(PMSG_SUSPEND); + err = dpm_suspend_start(PMSG_FREEZE); if (err) { printk(KERN_ERR "xen suspend: dpm_suspend_start %d\n", err); goto out_thaw; } - printk(KERN_DEBUG "suspending xenstore...\n"); + /* printk(KERN_DEBUG "suspending xenstore...\n"); */ xs_suspend(); - err = dpm_suspend_noirq(PMSG_SUSPEND); + err = dpm_suspend_noirq(PMSG_FREEZE); if (err) { printk(KERN_ERR "dpm_suspend_noirq failed: %d\n", err); goto out_resume;@@ -137,7 +137,7 @@ static void do_suspend(void)else
err =stop_machine(xen_suspend, &cancelled, cpumask_of(0));-
dpm_resume_noirq(PMSG_RESUME);
+dpm_resume_noirq(cancelled ? PMSG_THAW : PMSG_RESTORE);if (err) {
printk(KERN_ERR "failed to startxen_suspend: %d\n", err);drivers/xen/manage.c +1
-1@@ -151,7 +151,7 @@ out_resume: } else xs_suspend_cancel(); - dpm_resume_end(PMSG_RESUME); + dpm_resume_end(cancelled ? PMSG_THAW : PMSG_RESTORE); /* Make sure timer events get retriggered on all CPUs */ clock_was_set();drivers/xen/xenbus/xenbus_probe.c +2
-2@@ -575,7 +575,7 @@ void xenbus_dev_changed(const char *node, struct xen_bus_type *bus) } EXPORT_SYMBOL_GPL(xenbus_dev_changed); -int xenbus_dev_suspend (struct device *dev,pm_message_t state) +int xenbus_dev_suspend (struct device *dev) { int err = 0; struct xenbus_driver *drv;@@ -587,7 +587,7 @@ int xenbus_dev_suspend(struct device *dev, pm_message_t state) return 0; drv = to_xenbus_driver(dev->driver); if (drv->suspend) - err = drv->suspend(xdev, state); + err = drv->suspend(xdev); if (err)printk(KERN_WARNING
"xenbus: suspend %s failed: %i\n",dev_name(dev), err);drivers/xen/xenbus/xenbus_probe.c +7
-0@@ -638,6 +638,13 @@ int xenbus_dev_resume(struct device *dev) } EXPORT_SYMBOL_GPL(xenbus_dev_resume); +int xenbus_dev_cancel (struct device *dev) +{ + /* Do nothing */ + return 0; +} +EXPORT_SYMBOL_GPL (xenbus_dev_cancel); + /* A flag to determine if xenstored is 'ready' (i.e. has started) */ int xenstored_ready = 0;drivers/xen/xenbus/xenbus_probe.h +2
-1@@ -62,8 +62,9 @@ extern void xenbus_dev_changed(const char *node, struct xen_bus_type *bus); extern void xenbus_dev_shutdown(struct device *_dev); -extern int xenbus_dev_suspend (struct device *dev,pm_message_t state); +extern int xenbus_dev_suspend (struct device *dev); extern int xenbus_dev_resume(struct device *dev); +extern int xenbus_dev_cancel (struct device *dev); extern void xenbus_otherend_changed(struct xenbus_watch *watch, const char **vec, unsigned int len,drivers/xen/xenbus/xenbus_probe_frontend.c +0
-0@@ -82,6 +82,13 @@ static struct device_attribute xenbus_frontend_dev_attrs[] = {__ATTR_NULL
};drivers/xen/xenbus/xenbus_probe_frontend.c +7
-0+static struct dev_pm_ops xenbus_pm_ops = { + .suspend = xenbus_dev_suspend, + .resume = xenbus_dev_resume, + .freeze = xenbus_dev_suspend, + .thaw = xenbus_dev_cancel, + .restore = xenbus_dev_resume, +};static struct
xen_bus_typexenbus_frontend= {
.root = "device",drivers/xen/xenbus/xenbus_probe_frontend.c +1
-2@@ -98,8 +105,7 @@ static struct xen_bus_type xenbus_frontend = { .shutdown = xenbus_dev_shutdown, .dev_attrs= xenbus_frontend_dev_attrs, - .suspend = xenbus_dev_suspend, - .resume = xenbus_dev_resume, + .pm = &xenbus_pm_ops, }, };include/xen/xenbus.h +1
-1@@ -91,7 +91,7 @@ struct xenbus_driver { void (*otherend_changed)(struct xenbus_device *dev, enum xenbus_state backend_state); int (*remove)(struct xenbus_device *dev); - int (*suspend)(struct xenbus_device *dev, pm_message_t state); + int (*suspend)(struct xenbus_device *dev); int (*resume)(struct xenbus_device *dev); int (*uevent)(struct xenbus_device *, struct kobj_uevent_env *); struct device_driver driver;
Quoted 5 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
parts of this patch were based on Kazuhiro Suzuki's initial patch to fix the same issue. Refer to
http://lists.xensource.com/archives/html/xen-devel/2011-02/msg00371.html
for further details.
Quoted 10 lines · Shriram Rajagopalan
Use
PM_FREEZE,PM_THAWandPM_RESTOREpower events for suspend/resume functionality, instead ofPM_SUSPENDandPM_RESUME. Use of these pm events also fixes the Xen Guest hangup when taking checkpoints. When a suspend event is cancelled (i.e. while taking checkpoints once/continuously), we usePM_THAWinstead ofPM_RESUME.PM_RESTOREis used when suspend is not cancelled. SeeDocumentation/power/devices.txtandlinux/pm.hfor more info about freeze, thaw and restore. The sequence of pm events in a suspend-resume scenario is shown below.
Quoted 11 lines
dpm_suspend_start(PMSG_FREEZE);
dpm_suspend_noirq(PMSG_FREEZE);
sysdev_suspend(PMSG_FREEZE);
cancelled = suspend_hypercall()
sysdev_resume();
dpm_resume_noirq(cancelled ? PMSG_THAW : PMSG_RESTORE);
dpm_resume_end(cancelled ? PMSG_THAW : PMSG_RESTORE);Thanks.
Which tree/branch is this against?
Can you please at least do the dev_pm_ops as a separate patch to allow bisectability etc. (generally each patch should be a single logical change so if the remaineder can be sensibly split too it is worth doing so).
Did you test regular save/restore as well as cancelled migrations? What about PVHMV guests?
drivers/xen/xenbus/xenbus_probe_frontend.c static struct device_attribute xenbus_frontend_dev_attrs[] = { · line 91
Quoted 7 lines
drivers/xen/xenbus/xenbus_probe_frontend.c +7
-0+static struct dev_pm_ops xenbus_pm_ops = { + .suspend = xenbus_dev_suspend, + .resume = xenbus_dev_resume, + .freeze = xenbus_dev_suspend, + .thaw = xenbus_dev_cancel, + .restore = xenbus_dev_resume, +};
Perhaps xenbus_dev_thaw?
Are suspend/freeze and resume/restore really the same?
Once we've transitioned to the PMSG_FREEZE way of doing things do we still need to keep the other hooks around? If not then the other ones could be renamed as well?
Quoted 4 lines · Shriram Rajagopalan
parts of this patch were based on Kazuhiro Suzuki's initial patch to fix the same issue. Refer to
http://lists.xensource.com/archives/html/xen-devel/2011-02/msg00371.html
for further details.
It's worth mentioning this in the commit message, also please CC Kazuhiro since he has been working on this too, has a repro scenario etc.
Ian.
Quoted 19 lines · Ian Campbell
Quoted 18 lines · Shriram Rajagopalan
Use
PM_FREEZE,PM_THAWandPM_RESTOREpower events for suspend/resume functionality, instead ofPM_SUSPENDandPM_RESUME. Use of these pm events also fixes the Xen Guest hangup when taking checkpoints. When a suspend event is cancelled (i.e. while taking checkpoints once/continuously), we usePM_THAWinstead ofPM_RESUME.PM_RESTOREis used when suspend is not cancelled. SeeDocumentation/power/devices.txtandlinux/pm.hfor more info about freeze, thaw and restore. The sequence of pm events in a suspend-resume scenario is shown below.
dpm_suspend_start(PMSG_FREEZE);
dpm_suspend_noirq(PMSG_FREEZE);sysdev_suspend(PMSG_FREEZE); cancelled =
suspend_hypercall()sysdev_resume();
Quoted 8 lines
Quoted 3 lines
dpm_resume_noirq(cancelled ?
PMSG_THAW:PMSG_RESTORE);dpm_resume_end(cancelled ?
PMSG_THAW:PMSG_RESTORE);Thanks.
Which tree/branch is this against?
Oh I thought that info be present in the git indices "index 5413248..ff32ffb 100644" .
Its against my local git branch (which tracks xen/stable-2.6.32.x and is uptodate).
Sorry, I am still a bit of git newbie.
Quoted 5 lines
Can you please at least do the
dev_pm_opsas a separate patch to allow bisectability etc. (generally each patch should be a single logical change so if the remaineder can be sensibly split too it is worth doing so).
ok
Quoted 13 lines
Did you test regular save/restore as well as cancelled migrations? What about PVHMV guests?
drivers/xen/xenbus/xenbus_probe_frontend.c static struct device_attribute xenbus_frontend_dev_attrs[] = { · line 91
Quoted 7 lines
drivers/xen/xenbus/xenbus_probe_frontend.c +7
-0+static struct dev_pm_ops xenbus_pm_ops = { + .suspend = xenbus_dev_suspend, + .resume = xenbus_dev_resume, + .freeze = xenbus_dev_suspend, + .thaw = xenbus_dev_cancel, + .restore = xenbus_dev_resume, +};Perhaps
xenbus_dev_thaw?
Quoted 2 lines
Are suspend/freeze and resume/restore really the same?
Semantically they are not. From the documentation in pm.h,
suspend/resume events deal with change in sleep states. Devices are quiesced on suspend and might go to lower power mode. (==> xm suspend/resume ?)
freeze/thaw/restore are used for hibernation.
freeze:save state to memory before hibernation, quiesce device but
do not change power state.
thaw: undo changes made by freeze, if hibernation fails.
restore: restore device state from hibernation image (==> xm save/restore/checkpoint)
I looked at xen frontend drivers (blkfront, netfront, etc). They only use the resume handler to teardown and re-establishe contact with backend.
So, in our case, suspend/freeze and resume/restore are basically same. suspend-cancel is a thaw event.
Quoted 4 lines
Once we've transitioned to the
PMSG_FREEZEway of doing things do we still need to keep the other hooks around? If not then the other ones could be renamed as well?
If your question is whether we can change
static struct dev_pm_ops xenbus_pm_ops = {
.suspend = xenbus_dev_suspend,
.resume = xenbus_dev_resume,
.freeze = xenbus_dev_suspend,
.thaw = xenbus_dev_cancel,
.restore = xenbus_dev_resume,
};
to just
static struct dev_pm_ops xenbus_pm_ops = {
.freeze = xenbus_dev_freeze,
.thaw = xenbus_dev_thaw,
.restore = xenbus_dev_restore,
};
then the answer is no, AFAICS, from the code in drivers/base/power/main.c (pm_op function).
Quoted 9 lines · Shriram Rajagopalan
Quoted 4 lines
parts of this patch were based on Kazuhiro Suzuki's initial patch to fix the same issue. Refer to
http://lists.xensource.com/archives/html/xen-devel/2011-02/msg00371.html
for further details.It's worth mentioning this in the commit message, also please CC Kazuhiro since he has been working on this too, has a repro scenario etc.
will do.
Quoted 4 lines
Ian.
shriram
Quoted 22 lines · Shriram Rajagopalan
Quoted 21 lines · Ian Campbell
Quoted 20 lines · Shriram Rajagopalan
Use
PM_FREEZE,PM_THAWandPM_RESTOREpower events for suspend/resume functionality, instead ofPM_SUSPENDandPM_RESUME. Use of these pm events also fixes the Xen Guest hangup when taking checkpoints. When a suspend event is cancelled (i.e. while taking checkpoints once/continuously), we usePM_THAWinstead ofPM_RESUME.PM_RESTOREis used when suspend is not cancelled. SeeDocumentation/power/devices.txtandlinux/pm.hfor more info about freeze, thaw and restore. The sequence of pm events in a suspend-resume scenario is shown below.dpm_suspend_start(PMSG_FREEZE); dpm_suspend_noirq(PMSG_FREEZE); sysdev_suspend(PMSG_FREEZE); cancelled = suspend_hypercall() sysdev_resume(); dpm_resume_noirq(cancelled ? PMSG_THAW : PMSG_RESTORE);
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
dpm_resume_end(cancelled ? PMSG_THAW : PMSG_RESTORE);Thanks.
Which tree/branch is this against?
Oh I thought that info be present in the git indices "index 5413248..ff32ffb 100644" .
I think those are the indices of the actual versions of the file, rather than the tree->commit->branch which contains them. I'm sure you could map up that chain but suspect it'd be a rather brute force affair.
Quoted 2 lines
Its against my local git branch (which tracks xen/stable-2.6.32.x and is uptodate).
In general we'd prefer to get this sort of thing fixed in the mainline kernel (e.g. Linus' tree) first and then consider backports to the stable branch as necessary.
Quoted 1 line
Sorry, I am still a bit of git newbie.
No problem.
Quoted 6 lines
Quoted 4 lines
Can you please at least do the
dev_pm_opsas a separate patch to allow bisectability etc. (generally each patch should be a single logical change so if the remaineder can be sensibly split too it is worth doing so).ok
You can probably take Kazuhiro's first patch verbatim for this bit? If you save the mail to a file you can apply it with "git am < foo.mail" and git will preserve authorship attribution etc and this will persist through "git format-patch" and "git send-email" etc.
Quoted 16 lines
Quoted 13 lines
Did you test regular save/restore as well as cancelled migrations? What about PVHMV guests?
drivers/xen/xenbus/xenbus_probe_frontend.c static struct device_attribute xenbus_frontend_dev_attrs[] = { · line 91
Quoted 7 lines
drivers/xen/xenbus/xenbus_probe_frontend.c +7
-0+static struct dev_pm_ops xenbus_pm_ops = { + .suspend = xenbus_dev_suspend, + .resume = xenbus_dev_resume, + .freeze = xenbus_dev_suspend, + .thaw = xenbus_dev_cancel, + .restore = xenbus_dev_resume, +};Perhaps
xenbus_dev_thaw?Quoted 2 lines
Are suspend/freeze and resume/restore really the same?
Semantically they are not. From the documentation in
pm.h,
[...]
Quoted 2 lines
So, in our case, suspend/freeze and resume/restore are basically same. suspend-cancel is a thaw event.
OK.
Quoted 19 lines
Quoted 4 lines
Once we've transitioned to the
PMSG_FREEZEway of doing things do we still need to keep the other hooks around? If not then the other ones could be renamed as well?If your question is whether we can change
static structdev_pm_opsxenbus_pm_ops= {
.suspend =xenbus_dev_suspend,
.resume =xenbus_dev_resume,
.freeze =xenbus_dev_suspend,
.thaw =xenbus_dev_cancel,
.restore =xenbus_dev_resume,
};
to just
static structdev_pm_opsxenbus_pm_ops= {
.freeze =xenbus_dev_freeze,
.thaw =xenbus_dev_thaw,
.restore =xenbus_dev_restore,
};
Quoted 2 lines
then the answer is no, AFAICS, from the code in
drivers/base/power/main.c(pm_opfunction).
Looking at pm_op it doesn't appear to be an error to not implement one or more hooks. For example we currently don't implement freeze/thaw and that is currently ok because we don't initiate that sort of suspend.
Currently drivers/xen/manage.c hangs the suspend code off CONFIG_PM_SLEEP, I wonder if it shouldn't be CONFIG_SUSPEND already and become CONFIG_HIBERNATE with your change?
I also wonder if shutdown_handler shouldn't check it is actually going to be able to perform the suspend _before_ acknowledging the suspend request, but that is outside the scope of this patch.
Ian.