Re: [PATCH v7 7/8] [DO NOT MERGE] x86/kexec: Add int3 in kexec path for testing
From: Ingo Molnar
Date: Thu Mar 13 2025 - 06:44:53 EST
* David Woodhouse <dwmw2@xxxxxxxxxxxxx> wrote:
> From: David Woodhouse <dwmw@xxxxxxxxxxxx>
>
> Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
> ---
> arch/x86/kernel/relocate_kernel_64.S | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/relocate_kernel_64.S b/arch/x86/kernel/relocate_kernel_64.S
> index 17d41e6e1a4b..2b7fc59af373 100644
> --- a/arch/x86/kernel/relocate_kernel_64.S
> +++ b/arch/x86/kernel/relocate_kernel_64.S
> @@ -158,7 +158,7 @@ SYM_CODE_START_LOCAL_NOALIGN(identity_mapped)
> lidt (%rsp)
> addq $10, %rsp
>
> - //int3
> + int3
So this is all boot-serialized functionality with no SMP concerns
whatsoever, right?
If yes then we could use something like this:
static int exception_selftest = 1;
and add the INT3 point:
int3
.globl after_int3
after_int3:
And do this in the early exception handler:
...
if (exception_selftest) {
exception_selftest = 0;
print_something_warm_and_fuzzy();
IRET-to-after_int3;
}
...
... regular exception path ...
... but all in assembly or so ;-)
This would make it reasonably certain that the most complex bits of
this new debuging code are in working order, all the time.
Thanks,
Ingo