Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Dec 2019 15:10:04 -0800
From:      Mark Millard <marklmi@yahoo.com>
To:        "jeff@freebsd.org " <jeff@FreeBSD.org>, svn-src-head@freebsd.org
Subject:   Re: svn commit: r355819 - in head/sys: arm/arm arm64/arm64 i386/i386  mips/mips powerpc/powerpc riscv/riscv
Message-ID:  <3C939E47-40DB-484D-9948-A88378051682@yahoo.com>
References:  <3C939E47-40DB-484D-9948-A88378051682.ref@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> Author: jeff
> Date: Mon Dec 16 20:15:04 2019
> New Revision: 355819
> URL:=20
> https://svnweb.freebsd.org/changeset/base/355819
>=20
>=20
> 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.
>  =20
>   Reported by:	emaste
>   Suggested by:	rlibby
>   Discussed with:	jhb, rlibby
>   Tested by:	manu (arm64)
>=20
> 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:

=46rom /usr/src/sys/sparc64/sparc64/machdep.c . . .

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

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

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

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


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

=3D=3D=3D
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?3C939E47-40DB-484D-9948-A88378051682>