[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 11/12 gnumach] smp: Serialise AP bringup
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 11/12 gnumach] smp: Serialise AP bringup |
Date: |
Tue, 31 Jan 2023 21:07:29 +0100 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Damien Zammit, le mar. 31 janv. 2023 09:39:35 +0000, a ecrit:
> @@ -262,11 +259,14 @@ cpu_setup()
> void
> cpu_ap_main()
> {
> + unsigned apic_id = (((ApicLocalUnit*)phystokv(lapic_addr))->apic_id.r >>
> 24) & 0xff;
> + int cpu = apic_get_cpu_kernel_id(apic_id);
> +
> do {
> asm volatile ("pause" : : : "memory");
I believe you actually want a full __sync_synchronize() barrier,
otherwise the booted AP may not be getting all variables flushes from
the BSP.
> @@ -309,16 +309,12 @@ start_other_cpus(void)
> //Start cpu
> printf("Starting AP %d\n", cpu);
> cpu_start(cpu);
> - }
> - printf("BSP: Completed SMP init\n");
> - bspdone = 1;
>
> - for (cpu = 1; cpu < ncpus; cpu++) {
> + bspdone++;
> do {
> asm volatile ("pause" : : : "memory");
And conversely here, I believe you actually want a full __sync_synchronize()
barrier,
otherwise the BSP may not be getting all variables flushes from
the booted AP.
> } while (machine_slot[cpu].running == FALSE);
> }
> -
> - cpu_intr_restore(flags);
> + printf("BSP: Completed SMP init\n");
> }
> #endif /* NCPUS > 1 */
> diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c
> index 5cd68878..754334c9 100644
> --- a/i386/intel/pmap.c
> +++ b/i386/intel/pmap.c
> @@ -2920,6 +2920,7 @@ void pmap_update_interrupt(void)
> int s;
>
> my_cpu = cpu_number();
> + printf("PMAP(%d)\n", my_cpu);
>
> /*
> * Exit now if we're idle. We'll pick up the update request
Avoid leftovers :)
Samuel