svn commit: r355819 - in head/sys: arm/arm arm64/arm64 i386/i386 mips/mips powerpc/powerpc riscv/riscv

Mark Millard marklmi at yahoo.com
Mon Dec 16 23:10:16 UTC 2019


> Author: jeff
> Date: Mon Dec 16 20:15:04 2019
> New Revision: 355819
> URL: 
> https://svnweb.freebsd.org/changeset/base/355819
> 
> 
> Log:
>   Repeat the spinlock_enter/exit pattern from amd64 on other architectures to
>   fix an assert violation introduced in r355784.  Without this spinlock_exit()
>   may see owepreempt and switch before reducing the spinlock count.  amd64
>   had been optimized to do a single critical enter/exit regardless of the
>   number of spinlocks which avoided the problem and this optimization had
>   not been applied elsewhere.
>   
>   Reported by:	emaste
>   Suggested by:	rlibby
>   Discussed with:	jhb, rlibby
>   Tested by:	manu (arm64)
> 
> Modified:
>   head/sys/arm/arm/machdep.c
>   head/sys/arm64/arm64/machdep.c
>   head/sys/i386/i386/machdep.c
>   head/sys/mips/mips/machdep.c
>   head/sys/powerpc/powerpc/machdep.c
>   head/sys/riscv/riscv/machdep.c

It looks like sparc64 still has the old code structure:

From /usr/src/sys/sparc64/sparc64/machdep.c . . .

void
spinlock_enter(void)
{
        struct thread *td;
        register_t pil;

        td = curthread;
        if (td->td_md.md_spinlock_count == 0) {
                pil = rdpr(pil);
                wrpr(pil, 0, PIL_TICK);
                td->td_md.md_spinlock_count = 1;
                td->td_md.md_saved_pil = pil;
        } else
                td->td_md.md_spinlock_count++;
        critical_enter();
}

void
spinlock_exit(void)
{
        struct thread *td;
        register_t pil;

        td = curthread;
        critical_exit();
        pil = td->td_md.md_saved_pil;
        td->td_md.md_spinlock_count--;
        if (td->td_md.md_spinlock_count == 0)
                wrpr(pil, pil, 0);
}


(Not that I ever do anything with sparc64 machines.)

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



More information about the svn-src-head mailing list