Swsusp on VF2

Hi, dear community,

as I knew it before, at some point a CONFIG_PM was finally enabled and both Hibernation and Suspend features are available. I’m more interested in Hibernation rather than Suspend (store to RAM and maintain), because that’s what my working pattern with personal general purpose computers I own.

I tried to hibernate an SSH only controlled board by issuing command from serial. For some unknown reason, I was asked to put MAJOR:MINOR numbers of swap partition instead of it’s name at boot up otherwise it will spit Invalid argument from initrd.xz and betray saved image by booting as usual. Debugging sleeps inserted between mdev -s and writing devname I have swsusp image on to /sys/power/resume did not work. But MAJ:MIN device numbers did! Bruh.

Anyway, everything worked fine but my Ethernet gone. It does not see link anymore, lights are off, and in brought up logs from dmesg I see something like:

starfive-eth-plat 16030000.ethernet: Failed to reset the dma
starfive-eth-plat 16030000.ethernet eth0: stmmac_hw_setup: DMA engine initialization fa
iled

Board ends up without connectivity, but possible change of ports can temporary solve the issue till next hibernation.

This is minimal, server like computer and I don’t much care about graphics output for now. I just want to “save” it building a large package and then “restore” it to continue interrupted work. With connectivity only by ttyS0 it will be quite a boring adventure.

Any thoughts?

it’s need to build a swap partition 5 (at least 8G), and modify the configuration file of /boot/extlinux/extlinux.conf. After the word of ‘append’ in the configuration file, add ‘‘no_console_suspend resume=/dev/mmcblk1p5’’ and save.
Use the following command to enter hibernation:
~# echo disk > sudo tee /sys/power/state

2 Likes

Hi, thank you for reply,
I have 16G swap partition on my 8G RAM VF2. I added no_console_suspend and still no luck, ethernet led is ON when pre-hibernated kernel runs but goes OFF and does not react at all when I do ip link set eth0 down and ip link set eth0 up. I guess my next attempt will be to rebuild kernel with stmmac driver as module and try rmmod / modprobe to see if that works.

My current suspend sequence is:

echo shutdown >/sys/power/disk
echo disk >/sys/power/state

Which served me well for nearly 10yrs on three desktops in my life.

At least other critical for operation devices like NVMe seem to be working after resume. USB also works, so does microSD slot. Probably just stmmac is misbehaving.

just an idea for something to try: unload the eth driver module before suspend und load it again after resume - if it is not a module yet, then it would have to be built as such … this strategy usually works ok for not well behaved wifi drivers in some situations - here is an example for how to handle this automatically via systemd (other system and other driver in this case): imagebuilder/mrvl-reload at main · hexdump0815/imagebuilder · GitHub

good luck and best wishes - hexdump

Nah, it didn’t work out lol. I get kernel BUG and no-go system condition when trying to unload dwmac_starfive_plat with all NICs are brought deaf down…
So no swsusp for now. Without networking its not fun.

root@serval:~# rmmod dwmac_starfive_plat
[  293.655299] Kernel BUG [#1]
[  293.658133] Modules linked in: wireguard ip6_udp_tunnel udp_tunnel dwmac_starfive_plat(-) stmmac_platform stmmac phylink bpfilter pl2303 usbserial starfive_mailbox_test starfive_mailbox uio_pdrv_genirq uio
[  293.677074] CPU: 1 PID: 1196 Comm: rmmod Not tainted 5.15.0_serval #2
[  293.683562] Hardware name: StarFive VisionFive V2 (DT)
[  293.688739] epc : .Ltmp275+0x0/0xe
[  293.692153]  ra : .LBB226_24+0x6c/0xbc
[  293.695907] epc : ffffffff80a753b2 ra : ffffffff80a75346 sp : ffffffd004b63d40
[  293.703138]  gp : ffffffff81b929c8 tp : ffffffe0c4c18000 t0 : 0000000000000002
[  293.710369]  t1 : 0000000000000006 t2 : 0000000000000002 s0 : ffffffff816ec947
[  293.717599]  s1 : ffffffe0d7928050 a0 : 0000000000000001 a1 : 0000000000000003
[  293.724828]  a2 : ffffffffdead5000 a3 : 0000000000000005 a4 : 0000000000000009
[  293.732057]  a5 : 0000000000000000 a6 : 0000000000000090 a7 : 0000000000000080
[  293.739287]  s2 : ffffffe0d7928000 s3 : ffffffe0d7928050 s4 : 0000000000002ac9
[  293.746516]  s5 : ffffffff81b96098 s6 : ffffffd004b63d80 s7 : ffffffe0bff04810
[  293.753745]  s8 : 0000003ff3381562 s9 : 0000000000000000 s10: 000000001dc3e6f0
[  293.760974]  s11: 0000003ff3380fc0 t3 : 0000000000000010 t4 : 00000000000000f3
[  293.768203]  t5 : 0000000000000001 t6 : ffffffe0bfe0c6c8
[  293.773514] status: 0000000200000120 badaddr: 0000000000000000 cause: 0000000000000003
[  293.781440] [<ffffffff80a753b2>] .Ltmp275+0x0/0xe

Entering kdb (current=0xffffffe0c4c18000, pid 1196) on processor 1 Oops: (null)
due to oops @ 0xffffffff80a753b2
CPU: 1 PID: 1196 Comm: rmmod Not tainted 5.15.0_serval #2
Hardware name: StarFive VisionFive V2 (DT)
epc : .Ltmp275+0x0/0xe
 ra : .LBB226_24+0x6c/0xbc
epc : ffffffff80a753b2 ra : ffffffff80a75346 sp : ffffffd004b63d40
 gp : ffffffff81b929c8 tp : ffffffe0c4c18000 t0 : 0000000000000002
 t1 : 0000000000000006 t2 : 0000000000000002 s0 : ffffffff816ec947
 s1 : ffffffe0d7928050 a0 : 0000000000000001 a1 : 0000000000000003
 a2 : ffffffffdead5000 a3 : 0000000000000005 a4 : 0000000000000009
 a5 : 0000000000000000 a6 : 0000000000000090 a7 : 0000000000000080
 s2 : ffffffe0d7928000 s3 : ffffffe0d7928050 s4 : 0000000000002ac9
 s5 : ffffffff81b96098 s6 : ffffffd004b63d80 s7 : ffffffe0bff04810
 s8 : 0000003ff3381562 s9 : 0000000000000000 s10: 000000001dc3e6f0
 s11: 0000003ff3380fc0 t3 : 0000000000000010 t4 : 00000000000000f3
 t5 : 0000000000000001 t6 : ffffffe0bfe0c6c8
status: 0000000200000120 badaddr: 0000000000000000 cause: 0000000000000003
[<ffffffff80a753b2>] .Ltmp275+0x0/0xe

[1]kdb>

Relevant dmesg before:

<6>[   99.143581] PM: hibernation: hibernation entry
<6>[   99.356750] Filesystems sync: 0.141 seconds
<6>[   99.356773] Freezing user space processes ... (elapsed 0.001 seconds) done.
<6>[   99.358198] OOM killer disabled.
<7>[   99.358304] PM: hibernation: Basic memory bitmaps created
<6>[   99.358313] PM: hibernation: Preallocating image memory
<6>[  100.102192] PM: hibernation: Allocated 215102 pages for snapshot
<6>[  100.102216] PM: hibernation: Allocated 860408 kbytes in 0.74 seconds (1162.71 MB/s)
<6>[  100.102234] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
<6>[  100.104910] printk: Suspending console(s) (use no_console_suspend to debug)
<6>[  100.289154] starfive soc:display-subsystem: vs_drm_suspend
<6>[  100.289386] starfive-eth-plat 16040000.ethernet eth0: Link is Down
<6>[  100.297958] Disabling non-boot CPUs ...
<4>[  100.299595] IRQ58: set affinity failed(-22).
<5>[  100.299680] CPU1: off
<4>[  100.302500] IRQ58: set affinity failed(-22).
<5>[  100.302564] CPU2: off
<4>[  100.305314] IRQ58: set affinity failed(-22).
<5>[  100.305407] CPU3: off
<6>[  100.306781] PM: hibernation: Creating image:
<6>[  100.306781] PM: hibernation: Need to copy 213466 pages
<7>[  100.306781] PM: hibernation: Normal pages needed: 213466 + 1024, available pages: 1882801
<6>[  100.306781] PM: hibernation: free pages cleared after restore
<6>[  100.306843] Enabling non-boot CPUs ...
<6>[  100.308156] CPU1 is up
<6>[  100.309498] CPU2 is up
<6>[  100.311033] CPU3 is up
<6>[  102.338028] starfive-eth-plat 16040000.ethernet eth0: configuring for phy/rgmii-id link mode
<6>[  102.338234] dwmac4: Master AXI performs any burst length
<6>[  102.338263] starfive-eth-plat 16040000.ethernet eth0: No Safety Features support found
<4>[  102.338277] starfive-eth-plat 16040000.ethernet eth0: RX IPC Checksum Offload disabled
<6>[  102.338438] starfive soc:display-subsystem: vs_drm_resume
<5>[  102.340906] usb usb1: root hub lost power or was reset
<5>[  102.340921] usb usb2: root hub lost power or was reset
<6>[  102.342516] pcie_plda 2b000000.pcie: msi#0 address_hi 0x0 address_lo 0x190
<6>[  102.343484] pcie_plda 2c000000.pcie: msi#0 address_hi 0x0 address_lo 0x190
<6>[  102.412774] pcie_plda 2c000000.pcie: msi#0 address_hi 0x0 address_lo 0x190
<6>[  102.412794] pcie_plda 2c000000.pcie: msi#1 address_hi 0x0 address_lo 0x190
<6>[  102.412810] pcie_plda 2c000000.pcie: msi#2 address_hi 0x0 address_lo 0x190
<6>[  102.412826] pcie_plda 2c000000.pcie: msi#3 address_hi 0x0 address_lo 0x190
<6>[  102.412842] pcie_plda 2c000000.pcie: msi#4 address_hi 0x0 address_lo 0x190
<6>[  102.414582] nvme nvme0: 4/0/0 default/read/poll queues
<6>[  102.675327] usb 1-1: reset high-speed USB device number 2 using xhci_hcd
<7>[  102.979192] PM: hibernation: Basic memory bitmaps freed
<6>[  102.979215] OOM killer enabled.
<6>[  102.979224] Restarting tasks ... done.
<6>[  102.980929] PM: hibernation: hibernation exit
<6>[  103.089072] Adding 17659200k swap on /dev/dm-2.  Priority:1 extents:1 across:17659200k SS
<6>[  179.050273] starfive-eth-plat 16040000.ethernet eth0: PHY [stmmac-1:00] driver [YT8531 Gigabit Ethernet] (irq=POLL)
<6>[  179.050587] starfive-eth-plat 16040000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
<6>[  179.050862] dwmac4: Master AXI performs any burst length
>>>>>> Attempt to ifup/down eth0
<6>[  179.050879] starfive-eth-plat 16040000.ethernet eth0: No Safety Features support found
<4>[  179.050888] starfive-eth-plat 16040000.ethernet eth0: RX IPC Checksum Offload disabled
<6>[  179.050904] starfive-eth-plat 16040000.ethernet eth0: IEEE 1588-2008 Advanced Timestamp supported
<6>[  179.050919] starfive-eth-plat 16040000.ethernet eth0: configuring for phy/rgmii-id link mode
<6>[  213.758990] starfive-eth-plat 16030000.ethernet eth1: PHY [stmmac-0:00] driver [YT8531 Gigabit Ethernet] (irq=POLL)
<6>[  213.759723] starfive-eth-plat 16030000.ethernet eth1: Register MEM_TYPE_PAGE_POOL RxQ-0
<6>[  213.760636] dwmac4: Master AXI performs any burst length
>>>>>> Attempt to bring up eth1 just to see if cable is at correct port: it said NO_CARRIER
<6>[  213.760688] starfive-eth-plat 16030000.ethernet eth1: No Safety Features support found
<4>[  213.760719] starfive-eth-plat 16030000.ethernet eth1: RX IPC Checksum Offload disabled
<6>[  213.760762] starfive-eth-plat 16030000.ethernet eth1: IEEE 1588-2008 Advanced Timestamp supported
<6>[  213.762247] starfive-eth-plat 16030000.ethernet eth1: configuring for phy/rgmii-id link mode

:crying_cat_face:

1 Like