[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/5 gnumach] smp: Delay setting spl_init flag until after smp
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 3/5 gnumach] smp: Delay setting spl_init flag until after smp bringup |
Date: |
Tue, 10 Dec 2024 19:05:18 +0100 |
Damien Zammit via Bug reports for the GNU Hurd, le mar. 10 déc. 2024 07:29:56
+0000, a ecrit:
> If this is not done, the spl code is called by kmsg_putchar
> on APs during printing of bringup debug, causing the only
> unnecessary early access of GS.
> ---
> i386/i386/mp_desc.c | 3 ++-
> i386/i386at/model_dep.c | 3 ++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/i386/i386/mp_desc.c b/i386/i386/mp_desc.c
> index 16b1c865..7595eb1e 100644
> --- a/i386/i386/mp_desc.c
> +++ b/i386/i386/mp_desc.c
> @@ -325,7 +325,7 @@ start_other_cpus(void)
>
> unsigned cpu;
>
> - splhigh();
> + asm volatile ("cli");
>
> /* Disable IOAPIC interrupts (IPIs not affected).
> * Clearing this flag is similar to masking all
> @@ -357,5 +357,6 @@ start_other_cpus(void)
>
> /* Re-enable IOAPIC interrupts as per setup */
> lapic_enable();
> + spl_init = 1;
> }
> #endif /* NCPUS > 1 */
> diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c
> index 30449c37..7cbbf70b 100644
> --- a/i386/i386at/model_dep.c
> +++ b/i386/i386at/model_dep.c
> @@ -380,8 +380,9 @@ i386at_init(void)
> #else /* MACH_HYP */
> hyp_intrinit();
> #endif /* MACH_HYP */
> +#if NCPUS == 1
> spl_init = 1;
> -
> +#endif
But then kmsg_putchar becomes unsafe until very late, that will bite
us... And you never know who would introduce gs usage in whatever place
in the boot code.
I know that you don't like tinkering with assembler, but it's simpler to
fix one place than to have to maintain principles in a lot of places.
Samuel
- [PATCH 0/5 gnumach] smp: Parallel SMP init, Damien Zammit, 2024/12/10
- [PATCH 1/5 gnumach] i386/apic: Fix logical id numbering, Damien Zammit, 2024/12/10
- [PATCH 2/5 gnumach] smp: Remove early GS access, Damien Zammit, 2024/12/10
- [PATCH 3/5 gnumach] smp: Delay setting spl_init flag until after smp bringup, Damien Zammit, 2024/12/10
- Re: [PATCH 3/5 gnumach] smp: Delay setting spl_init flag until after smp bringup,
Samuel Thibault <=
- [PATCH 4/5 gnumach] smp: Make sure BSP is cpu 0 when starting other cpus, Damien Zammit, 2024/12/10
- [PATCH 5/5 gnumach] smp: Parallel SMP init, Damien Zammit, 2024/12/10