[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] xenbus: Use .freeze/.thaw to handle xenbus devices


  • To: Yann Sionneau <yann.sionneau@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Mon, 1 Dec 2025 12:15:17 -0500
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vates.tech smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=n0TMjo/MIt1o8DBY2AnzLgOWBc7wgV/u13yRi2eKAYQ=; b=SDV2+H3oZ+0A+Z1pRbIQ4hkkBd79ZZyR5ec4K2xWKoDnFnOzm3t8NgoA4szWosDRKc82Wb9azcVZM10tqXVWNfz4+Qj8FZZ5IOpzGmRZQeq/+4XFnedGZpacvZ2f7YHV26WOgkuVNTRz9f+uSVYdKv2KnhjgWaQYcgAjjIF2p2ZFDf+lkD2VM5oQtenWNkqNucR6+WmXPm25bZWpCI8B6/0oIZjMyIaOB3wgJwXtFmVMbYrNjcUsx4m8U25d+lBSUPI3t7wqJaFMSCN6W9IKKD76b3q7ptt4UWU4hrDG4Mg+/kkTdkCOMI1tM8HPZfAre/q7B0WNEjQZFctxybSg0w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UVATkSpBsh+5A6Kew6paDwPbC3D1Xmb2tMW9R0XYvn4ZyCsprjF4GBmZN0/gztACBKk60/BJda8HTdP0WWtmRUm6IJr1iTJjtEOgDHvpYYk26MjSrvo9ssgpTt2XdCjmvzph0vuWIWNqZLU6A32fVIS31lxv/6Q41q8SqHgTUmjmOo0zUVdmsFvFhSHmn0bM5FITG5qs3Nu0bheBp5uB+0K2Yx9NZ0zlvw2lmgP+ske4a9PVFmFxLvTen4HjtHN04yhwjFh6hWA1o5fMH7OHrw/VT7Z9a7zSnephsAsVfhQJfF2dkfkSk1SvDkZxfkLRMHZVBlgJ1JxwZ5NcbCeB5A==
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 01 Dec 2025 17:15:46 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2025-11-26 10:00, Yann Sionneau wrote:
Hi Jason,

On 11/19/25 23:46, Jason Andryuk wrote:
The goal is to fix s2idle and S3 for Xen PV devices.  A domain resuming
from s3 or s2idle disconnects its PV devices during resume.  The
backends are not expecting this and do not reconnect.

b3e96c0c7562 ("xen: use freeze/restore/thaw PM events for suspend/
resume/chkpt") changed xen_suspend()/do_suspend() from
PMSG_SUSPEND/PMSG_RESUME to PMSG_FREEZE/PMSG_THAW/PMSG_RESTORE, but the
suspend/resume callbacks remained.

.freeze/restore are used with hiberation where Linux restarts in a new
place in the future.  .suspend/resume are useful for runtime power
management for the duration of a boot.

The current behavior of the callbacks works for an xl save/restore or
live migration where the domain is restored/migrated to a new location
and connecting to a not-already-connected backend.

Change xenbus_pm_ops to use .freeze/thaw/restore and drop the
.suspend/resume hook.  This matches the use in drivers/xen/manage.c for
save/restore and live migration.  With .suspend/resume empty, PV devices
are left connected during s2idle and s3, so PV devices are not changed
and work after resume.

Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
   drivers/xen/xenbus/xenbus_probe_frontend.c | 4 +---
   1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c 
b/drivers/xen/xenbus/xenbus_probe_frontend.c
index 6d1819269cbe..199917b6f77c 100644
--- a/drivers/xen/xenbus/xenbus_probe_frontend.c
+++ b/drivers/xen/xenbus/xenbus_probe_frontend.c
@@ -148,11 +148,9 @@ static void xenbus_frontend_dev_shutdown(struct device 
*_dev)
   }
static const struct dev_pm_ops xenbus_pm_ops = {
-       .suspend        = xenbus_dev_suspend,
-       .resume         = xenbus_frontend_dev_resume,
        .freeze         = xenbus_dev_suspend,
        .thaw           = xenbus_dev_cancel,
-       .restore        = xenbus_dev_resume,
+       .restore        = xenbus_frontend_dev_resume,
   };
static struct xen_bus_type xenbus_frontend = {

I've tried putting Debian 13 to sleep with your patch (echo freeze >
/sys/power/state) and could not wake up the guest.
Isn't it also mandatory to apply this patch
https://github.com/QubesOS/qubes-linux-kernel/blob/main/xen-events-Add-wakeup-support-to-xen-pirq.patch
?

With both patches applied, I get the wake up to work.

I did not need the additional patch. I thought it was necessary for dom0 s0ix wakeup which uses xen-pirq for hardware interrupts. I did not think it was necessary for a domU. I'm only looking at the domU case here, and this code is for frontend PV devices.

In my setup, I use `xl trigger $dom sleep` to enter (and exit) s2idle for a PVH domain, which has the ACPI buttons exposed with X86_EMU_PM. This is a non-standard configuration.

I've additionally tested with `echo mem > /sys/power/state` to enter s2idle. Again waking with `xl trigger $dom sleep`.

xl console remains connected, but typing there does not wake.

What kind of guest are you testing with? How do you wake it? If it's HVM in S3, another way to attempt wake up may be `xl qemu-monitor-command $dom system_wakeup`.

Regards,
Jason



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.