[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0CDE8ED7-D8D2-4053-AE4B-4CFF59DB56F7@infradead.org>
Date: Thu, 13 Mar 2025 12:06:58 +0100
From: David Woodhouse <dwmw2@...radead.org>
To: Ingo Molnar <mingo@...nel.org>
CC: kexec@...ts.infradead.org, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H . Peter Anvin" <hpa@...or.com>, David Woodhouse <dwmw@...zon.co.uk>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
Kai Huang <kai.huang@...el.com>, Nikolay Borisov <nik.borisov@...e.com>,
linux-kernel@...r.kernel.org, Simon Horman <horms@...nel.org>,
Dave Young <dyoung@...hat.com>, Peter Zijlstra <peterz@...radead.org>,
jpoimboe@...nel.org, bsz@...zon.de
Subject: Re: [PATCH v7 7/8] [DO NOT MERGE] x86/kexec: Add int3 in kexec path for testing
On 13 March 2025 11:44:41 CET, Ingo Molnar <mingo@...nel.org> wrote:
>
>* David Woodhouse <dwmw2@...radead.org> wrote:
>
>> From: David Woodhouse <dwmw@...zon.co.uk>
>>
>> Signed-off-by: David Woodhouse <dwmw@...zon.co.uk>
>> ---
>> 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
The exception handler already returns if the exception was int3, but not for anything else. Less so the "print something warm and fuzzy" part; it just does the same register dump. But we could change that.
I'm less keen on making it unconditional though. Kexec is a performance-critical path when every millisecond is perceived as guest steal time, and the serial output should only happen in production if something goes *wrong*.
And besides, most kexec users don't have early_printk enabled anyway so if we break them, this idea doesn't help.
Powered by blists - more mailing lists