RE: [PATCH] Input: hyperv-keyboard: Add the support of hibernation

From: Dexuan Cui
Date: Tue Nov 05 2019 - 00:43:54 EST


> From: dmitry.torokhov@xxxxxxxxx <dmitry.torokhov@xxxxxxxxx>
> Sent: Thursday, October 3, 2019 10:46 AM
> ...
> Right. I think in practice the current suspend implementation can work
> as freeze() for the HV keyboard, because in suspend you shut off vmbus
> channel, so there should not be wakeup signals anymore. What you do not
> want is to have the current resume to be used in place of thaw(), as
> there you re-enable the vmbus channel and resume sending wakeup requests
> as you are writing out the hibernation image to storage.
>
> I think if vmbus allowed HV keyboard driver to supply empty thaw() and
> poweroff() implementations, while using suspend() as freeze() and
> resume() as restore(), it would solve the issue for you.
>
> Dmitry

BTW, IMO thaw() should not be empty, because drivers/base/power/main.c:
pm_op() uses ops->thaw for both PM_EVENT_THAW and PM_EVENT_RECOVER.

PMSG_RECOVER is the same as PM_EVENT_RECOVER.

If some step in hibernation_snapshot() -> create_image() fails, we call
dpm_resume_start(PMSG_RECOVER) at the end of create_image(), and call
dpm_resume() in hibernation_snapshot(). An empty thaw() can not bring the
device back to normal.

Thanks,
-- Dexuan