Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Feb 2019 14:32:37 -0800
From:      Mark Millard <marklmi@yahoo.com>
To:        Justin Hibbits <chmeeedalf@gmail.com>, FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>
Subject:   question powermac_smp_start_cpu return values vs. cpu_mp_unleash use of them (SMP context)
Message-ID:  <F32DAE2C-B55E-40F7-A5EB-580007D03D47@yahoo.com>

next in thread | raw e-mail | index | archive | help
The following is based on head -r343670 .


( from /usr/src/sys/powerpc/powermac/platform_powermac.c )

static int
powermac_smp_start_cpu(platform_t plat, struct pcpu *pc)
{
#ifdef SMP
. . .
        while (!pc->pc_awake && timeout--)
                DELAY(100);

        return ((pc->pc_awake) ? 0 : EBUSY);
#else
. . .
#endif
}

So EBUSY above indicates pc->pc_awake==0 on return.
0 indicates pc->pc_awake!=0 .

But:
( from /usr/src/sys/powerpc/powerpc/mp_machdep.c )

static void
cpu_mp_unleash(void *dummy)
{
. . .
                        ret = platform_smp_start_cpu(pc);
                        if (ret == 0) {
                                timeout = 2000; /* wait 2sec for the AP */
                                while (!pc->pc_awake && --timeout > 0)
                                        DELAY(1000);
                        }
. . .
}

So cpu_mp_unleash only waits for pc->pc_awake!=0 if it it receives
a status value indicating that pc->pc_pc_awake was already not zero.
EBUSY results in no waiting in the cpu_mp_unleash code above despite
pc->pc_awake having been zero at the return.

How things match up for powermac seems odd to me. Is something wrong
here?

===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F32DAE2C-B55E-40F7-A5EB-580007D03D47>