On 17.03.2025 20:20, Andrew Cooper wrote:
> Something I overlooked when last cleaning up exception handling is that a TSS
> is not necessary if IST isn't configured, and IST isn't necessary until we're
> running guest code.
> 
> Introduce early_traps_init() which is far more minimal than init_idt_traps();
> bsp_ist[] is constructed without IST settings, so all early_traps_init() needs
> to do is load the IDT, and invalidate TR/LDTR.
> 
> Put the remaining logic into traps_init(), later on boot.  Note that
> load_system_tables() already contains enable_each_ist(), so the call is simply
> dropped.
> 
> This removes some complexity prior to having exception support, and lays the
> groundwork to not even allocate a TSS when using FRED.
> 
> No practical change.
> 
> Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>

Given the present state of thing:
Reviewed-by: Jan Beulich <jbeul...@suse.com>
What worries me slightly is that ...

> @@ -63,6 +88,13 @@ void __init traps_init(void)
>      /* Replace early pagefault with real pagefault handler. */
>      _update_gate_addr_lower(&bsp_idt[X86_EXC_PF], entry_PF);
>  
> +    this_cpu(idt) = bsp_idt;
> +    this_cpu(gdt) = boot_gdt;
> +    if ( IS_ENABLED(CONFIG_PV32) )
> +        this_cpu(compat_gdt) = boot_compat_gdt;

... this being done later now requires more care with e.g. play_dead().
Yet if and when needed, this setting up could of course be moved earlier
again. It's not entirely clear to me why you specifically want it here
and not in early_traps_init(). The sole dependency is percpu_init_areas(),
which runs - as even visible from patch context here - ahead of
early_traps_init(). My take is - the earlier we do things that can be
done easily, the less we have to worry about ordering and dependencies.

Jan

Reply via email to