Skip to content

arm64: hibernate: dust off the suspend/cleanup rework

Bradley Morgan linux-arm-kernel lkml stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 15 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7arm64: hibernate: pass HVC_SET_VECTORS args to the resume hvcarch/arm64/kernel/hibernate-asm.S+2 -00 replies
2/7arm64: head: correct comment for init_kernel_el()arch/arm64/kernel/head.S+3 -34 replies
3/7arm64: hibernate: free MTE tag pages after savingarch/arm64/kernel/hibernate.c+10 -00 replies
4/7arm64: hibernate: fix _cpu_resume() calling conventionarch/arm64/include/asm/suspend.h arch/arm64/kernel/hibernate.c arch/arm64/kernel/sleep.S+8 -50 replies
5/7arm64: hibernate: use dcache_by_myline_oparch/arm64/kernel/hibernate-asm.S+3 -80 replies
6/7arm64: hibernate: only clean to PoCarch/arm64/kernel/hibernate.c+8 -90 replies
7/7arm64: hibernate: use regular cpu_resume() logicarch/arm64/include/asm/suspend.h arch/arm64/kernel/hibernate-asm.S arch/arm64/kernel/hibernate.c +1 more+71 -700 replies

Reviews trailers per patch

None of the 7 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchArd BiesheuvelMark Rutland
SeriesT-b A-b
1/7
2/7
3/7
4/7
5/7
6/7
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/7] arm64: hibernate: dust off the suspend/cleanup rework

This comes out of the hibernate resume discussion where Will asked if the restored kernel's hyp vectors are reinstalled before we come back from swsusp_arch_suspend() and free the reserved pages. Rather than answer with a one off fix, this series reworks resume to look like a resume from idle, which makes the answer fall out on its own.

The series leans on Mark Rutland's old work for inspiration, he had the same end goal in a branch from back then:

https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/log/?h=arm64/suspend/cleanup

The short answer to the question: yes, but only because the rework makes resume look like a resume from idle. We enter cpu_resume() at the highest available EL with the MMU off, and the resumed kernel installs its own hyp stub vectors into VBAR_EL2 through init_kernel_el() before anything else runs, so by the time swsusp_free() releases the trans_pgd copies nothing points at them anymore.

The series is structured so the first patch stands alone as a stable worthy fix for the missing hvc arguments. The rest is the cleanup: the stale init_kernel_el() comment gets corrected, MTE tag pages get freed after save instead of leaking on failed hibernates, the fragile _cpu_resume() calling convention gets split, and the last patch reworks hibernate to use the regular cpu_resume() logic end to end.

Everything object compiles and passes checkpatch and sparse. I could not boot or run a hibernate cycle on real hardware here, so that still wants doing before anyone gets excited.

Bradley Morgan (7):
arm64: hibernate: pass HVC_SET_VECTORS args to the resume hvc
arm64: head: correct comment for init_kernel_el()
arm64: hibernate: free MTE tag pages after saving
arm64: hibernate: fix _cpu_resume() calling convention
arm64: hibernate: use dcache_by_myline_op
arm64: hibernate: only clean to PoC
arm64: hibernate: use regular cpu_resume() logic

 arch/arm64/include/asm/suspend.h  |  1 -
 arch/arm64/kernel/head.S          |  6 +--
 arch/arm64/kernel/hibernate-asm.S | 87 +++++++++++++++++++------------
 arch/arm64/kernel/hibernate.c     | 66 +++++++++++------------
 arch/arm64/kernel/sleep.S         |  6 +--
 5 files changed, 88 insertions(+), 78 deletions(-)
Signature · 1 line
2.47.3