On 28.02.2026 00:16, Andrew Cooper wrote:
> We wish to make use of opt_fred earlier on boot, which involves moving
> traps_init() earlier, but this comes with several ordering complications.
> 
> The feature word containing FRED needs collecting in early_cpu_init(), and
> legacy_syscall_init() cannot be called that early because it relies on the
> stubs being allocated, yet must be called ahead of cpu_init() so the SYSCALL
> linkage MSRs are set up before being cached.
> 
> Delaying legacy_syscall_init() is easy enough based on a system_state check.
> Reuse bsp_traps_reinit() to cause a call to legacy_syscall_init() to occur at
> the same point as previously.
> 
> Signed-off-by: Andrew Cooper <[email protected]>

Reviewed-by: Jan Beulich <[email protected]>

Irrespective ...

> @@ -359,7 +363,13 @@ void __init bsp_traps_reinit(void)
>   */
>  void percpu_traps_init(void)
>  {
> -    legacy_syscall_init();
> +    /*
> +     * Skip legacy_syscall_init() at early boot.  It requires the stubs being
> +     * allocated, limiting the placement of the traps_init() call, and gets
> +     * re-done anyway by bsp_traps_reinit().
> +     */
> +    if ( system_state > SYS_STATE_early_boot )
> +        legacy_syscall_init();

... I wonder if simply pulling this out of this function wouldn't be slightly
neater. To me at least, syscall/sysenter are only a remote from of "trap".

Jan

Reply via email to