[RFC PATCH 0/7] x86/kexec: Add exception handling for relocate_kernel

From: David Woodhouse
Date: Sun Nov 03 2024 - 01:41:41 EST


Page faults in relocate_kernel() are extremely painful to debug. Provide a
basic exception handler which will just dump the exception information and
registers to a serial port.

It's disabled by default and has to be enabled with #define DEBUG.

While I was at it, I also stopped swap_pages from actually swapping pages
in the case of a plain kexec without preserve_context. Unless I'm missing
something, that's just a pointless waste of time.

David Woodhouse (7):
x86/kexec: Clean up and document register use in relocate_kernel_64.S
x86/kexec: Use named labels in swap_pages in relocate_kernel_64.S
x86/kexec: Only swap pages for preserve_context mode
x86/kexec: Debugging support: load a GDT
x86/kexec: Debugging support: Load an IDT and basic exception entry points
x86/kexec: Debugging support: Dump registers on exception

arch/x86/kernel/relocate_kernel_64.S | 265 ++++++++++++++++++++++++++++++++---
1 file changed, 246 insertions(+), 19 deletions(-)