xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/11] Fix PM hibernation in Xen guests
@ 2020-07-02 18:21 Anchal Agarwal
  2020-07-02 18:21 ` [PATCH v2 01/11] xen/manage: keep track of the on-going suspend mode Anchal Agarwal
                   ` (11 more replies)
  0 siblings, 12 replies; 43+ messages in thread
From: Anchal Agarwal @ 2020-07-02 18:21 UTC (permalink / raw)
  To: tglx, mingo, bp, hpa, x86, boris.ostrovsky, jgross, linux-pm,
	linux-mm, kamatam, sstabellini, konrad.wilk, roger.pau, axboe,
	davem, rjw, len.brown, pavel, peterz, eduval, sblbir, anchalag,
	xen-devel, vkuznets, netdev, linux-kernel, dwmw, benh

Hello,
This series fixes PM hibernation for hvm guests running on xen hypervisor.
The running guest could now be hibernated and resumed successfully at a
later time. The fixes for PM hibernation are added to block and
network device drivers i.e xen-blkfront and xen-netfront. Any other driver
that needs to add S4 support if not already, can follow same method of
introducing freeze/thaw/restore callbacks.
The patches had been tested against upstream kernel and xen4.11. Large
scale testing is also done on Xen based Amazon EC2 instances. All this testing
involved running memory exhausting workload in the background.

Doing guest hibernation does not involve any support from hypervisor and
this way guest has complete control over its state. Infrastructure
restrictions for saving up guest state can be overcome by guest initiated
hibernation.

These patches were send out as RFC before and all the feedback had been
incorporated in the patches. The last v1 could be found here:

[v1]: https://lkml.org/lkml/2020/5/19/1312
All comments and feedback from v1 had been incorporated in v2 series.
Any comments/suggestions are welcome

Known issues:
1.KASLR causes intermittent hibernation failures. VM fails to resumes and
has to be restarted. I will investigate this issue separately and shouldn't
be a blocker for this patch series.
2. During hibernation, I observed sometimes that freezing of tasks fails due
to busy XFS workqueuei[xfs-cil/xfs-sync]. This is also intermittent may be 1
out of 200 runs and hibernation is aborted in this case. Re-trying hibernation
may work. Also, this is a known issue with hibernation and some
filesystems like XFS has been discussed by the community for years with not an
effectve resolution at this point.

Testing How to:
---------------
1. Setup xen hypervisor on a physical machine[ I used Ubuntu 16.04 +upstream
xen-4.11]
2. Bring up a HVM guest w/t kernel compiled with hibernation patches
[I used ubuntu18.04 netboot bionic images and also Amazon Linux on-prem images].
3. Create a swap file size=RAM size
4. Update grub parameters and reboot
5. Trigger pm-hibernation from within the VM

Example:
Set up a file-backed swap space. Swap file size>=Total memory on the system
sudo dd if=/dev/zero of=/swap bs=$(( 1024 * 1024 )) count=4096 # 4096MiB
sudo chmod 600 /swap
sudo mkswap /swap
sudo swapon /swap

Update resume device/resume offset in grub if using swap file:
resume=/dev/xvda1 resume_offset=200704 no_console_suspend=1

Execute:
--------
sudo pm-hibernate
OR
echo disk > /sys/power/state && echo reboot > /sys/power/disk

Compute resume offset code:
"
#!/usr/bin/env python
import sys
import array
import fcntl

#swap file
f = open(sys.argv[1], 'r')
buf = array.array('L', [0])

#FIBMAP
ret = fcntl.ioctl(f.fileno(), 0x01, buf)
print buf[0]
"


Aleksei Besogonov (1):
  PM / hibernate: update the resume offset on SNAPSHOT_SET_SWAP_AREA

Anchal Agarwal (4):
  x86/xen: Introduce new function to map HYPERVISOR_shared_info on
    Resume
  x86/xen: save and restore steal clock during PM hibernation
  xen: Introduce wrapper for save/restore sched clock offset
  xen: Update sched clock offset to avoid system instability in
    hibernation

Munehisa Kamata (5):
  xen/manage: keep track of the on-going suspend mode
  xenbus: add freeze/thaw/restore callbacks support
  x86/xen: add system core suspend and resume callbacks
  xen-blkfront: add callbacks for PM suspend and hibernation
  xen-netfront: add callbacks for PM suspend and hibernation

Thomas Gleixner (1):
  genirq: Shutdown irq chips in suspend/resume during hibernation

 arch/x86/xen/enlighten_hvm.c      |   7 ++
 arch/x86/xen/suspend.c            |  53 +++++++++++++
 arch/x86/xen/time.c               |  15 +++-
 arch/x86/xen/xen-ops.h            |   3 +
 drivers/block/xen-blkfront.c      | 122 +++++++++++++++++++++++++++++-
 drivers/net/xen-netfront.c        |  98 +++++++++++++++++++++++-
 drivers/xen/events/events_base.c  |   1 +
 drivers/xen/manage.c              |  60 +++++++++++++++
 drivers/xen/xenbus/xenbus_probe.c |  96 +++++++++++++++++++----
 include/linux/irq.h               |   2 +
 include/xen/xen-ops.h             |   3 +
 include/xen/xenbus.h              |   3 +
 kernel/irq/chip.c                 |   2 +-
 kernel/irq/internals.h            |   1 +
 kernel/irq/pm.c                   |  31 +++++---
 kernel/power/user.c               |   6 +-
 16 files changed, 470 insertions(+), 33 deletions(-)

-- 
2.20.1



^ permalink raw reply	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2020-08-05 17:43 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-02 18:21 [PATCH v2 00/11] Fix PM hibernation in Xen guests Anchal Agarwal
2020-07-02 18:21 ` [PATCH v2 01/11] xen/manage: keep track of the on-going suspend mode Anchal Agarwal
2020-07-13 15:52   ` Boris Ostrovsky
2020-07-15 20:49     ` Anchal Agarwal
2020-07-15 21:18       ` Boris Ostrovsky
2020-07-17 19:10         ` Anchal Agarwal
2020-07-19  1:47           ` Boris Ostrovsky
2020-07-20  9:37             ` Roger Pau Monné
2020-07-21  0:17               ` Anchal Agarwal
2020-07-21  8:30                 ` Roger Pau Monné
2020-07-21 19:55                   ` Anchal Agarwal
2020-07-22  8:27                     ` Roger Pau Monné
2020-07-21  0:03             ` Anchal Agarwal
2020-07-21 21:48               ` Boris Ostrovsky
2020-07-22  0:18                 ` Stefano Stabellini
2020-07-22 18:02                   ` Anchal Agarwal
2020-07-22 22:45                     ` Boris Ostrovsky
2020-07-22 23:49                     ` Stefano Stabellini
2020-07-23 22:57                       ` Anchal Agarwal
2020-07-24 23:01                         ` Stefano Stabellini
2020-07-27 22:08                           ` Boris Ostrovsky
2020-07-30 23:06                             ` Anchal Agarwal
2020-07-31 14:13                               ` Boris Ostrovsky
2020-07-31 14:25                                 ` Rafael J. Wysocki
2020-08-04 23:42                                 ` Anchal Agarwal
2020-08-05 13:31                                   ` Boris Ostrovsky
2020-08-05 17:42                                     ` Anchal Agarwal
2020-07-02 18:21 ` [PATCH v2 03/11] x86/xen: Introduce new function to map HYPERVISOR_shared_info on Resume Anchal Agarwal
2020-07-02 18:22 ` [PATCH v2 04/11] x86/xen: add system core suspend and resume callbacks Anchal Agarwal
2020-07-22  9:08   ` Julien Grall
2020-07-02 18:22 ` [PATCH v2 05/11] genirq: Shutdown irq chips in suspend/resume during hibernation Anchal Agarwal
2020-07-02 18:22 ` [PATCH v2 06/11] xen-blkfront: add callbacks for PM suspend and hibernation Anchal Agarwal
2020-07-02 18:22 ` [PATCH v2 07/11] xen-netfront: " Anchal Agarwal
2020-07-02 18:22 ` [PATCH v2 08/11] x86/xen: save and restore steal clock during PM hibernation Anchal Agarwal
2020-07-02 18:23 ` [PATCH v2 09/11] xen: Introduce wrapper for save/restore sched clock offset Anchal Agarwal
2020-07-02 18:23 ` [PATCH v2 10/11] xen: Update sched clock offset to avoid system instability in hibernation Anchal Agarwal
2020-07-02 18:23 ` [PATCH v2 11/11] PM / hibernate: update the resume offset on SNAPSHOT_SET_SWAP_AREA Anchal Agarwal
2020-07-02 18:25 ` [PATCH v2 02/11] xenbus: add freeze/thaw/restore callbacks support Anchal Agarwal
2020-07-10 18:17 ` [PATCH v2 00/11] Fix PM hibernation in Xen guests Agarwal, Anchal
2020-07-13 19:43   ` Boris Ostrovsky
2020-07-15 19:49     ` Anchal Agarwal
2020-07-15 20:49       ` Boris Ostrovsky
2020-07-16 23:28         ` Anchal Agarwal

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).