Re: [PATCH 1/2] x86/fred: Always install system interrupt handler into IDT
From: Thomas Gleixner
Date: Tue Jun 25 2024 - 13:01:25 EST
On Tue, Jun 25 2024 at 09:30, Xin Li wrote:
> On 6/25/2024 5:31 AM, Thomas Gleixner wrote:
>> On Tue, Jun 25 2024 at 02:19, Xin Li wrote:
>>> On 6/21/2024 6:12 AM, Hou Wenlong wrote:
>>>> diff --git a/arch/x86/include/asm/idtentry.h b/arch/x86/include/asm/idtentry.h
>>>> index d4f24499b256..daee9f7765bc 100644
>>>> --- a/arch/x86/include/asm/idtentry.h
>>>> +++ b/arch/x86/include/asm/idtentry.h
>>>> @@ -470,8 +470,7 @@ static inline void fred_install_sysvec(unsigned int vector, const idtentry_t fun
>>>> #define sysvec_install(vector, function) { \
>>>> if (cpu_feature_enabled(X86_FEATURE_FRED)) \
>>>> fred_install_sysvec(vector, function); \
>>>> - else \
>>>> - idt_install_sysvec(vector, asm_##function); \
>>>
>>> empty line, it improves readability.
>>>
>>> And please put a comment here to explain why this is unconditionally
>>> done for IDT.
>>
>> Wait. If we need this during early boot, then why don't we enable FRED
>> earlier?
>
> Unconditionally call idt_install_sysvec() is still needed, right?
Not when we enable FRED early enough.
> But this sounds a smart move to me! Because it helps to deal with not
> only the initialization order issue, but also the following cases in a
> longer term:
>
> 1) BIOS enables FRED and keeps it enabled when transferring control to
> Linux. Then we just need to disable FRED when it is disabled in the
> kernel command line.
>
> 2) IDT support is removed from a kernel config thus a kernel binary, say
> a new kernel config CONFIG_X86_IDT is added and set to N.
>
> And we need to:
>
> 1) Find a place to enable FRED as early as possible if not yet enabled.
>
> 2) Disable FRED when fred=off is in the kernel command line.
>
> Anything I missed?
No.
Thanks,
tglx