Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Sep 2000 13:37:29 -0700 (PDT)
From:      John Baldwin <jhb@pike.osd.bsdi.com>
To:        dfr@FreeBSD.org
Cc:        alpha@FreeBSD.org
Subject:   Bug in spinlocks?
Message-ID:  <200009112037.NAA61735@pike.osd.bsdi.com>

next in thread | raw e-mail | index | archive | help
Hmm, is there any reason why we aren't disabling interrupts on the alpha
when we obtain spinlocks?  In the i386 code we use the following macro:

/* Get a spin lock, handle recursion inline (as the less common case) */
#define _getlock_spin_block(mp, tid, type) do {                         \
        u_int _mtx_fl = read_eflags();                                  \
        disable_intr();                                                 \
        if (atomic_cmpset_int(&(mp)->mtx_lock, MTX_UNOWNED, (tid)) == 0) \
                mtx_enter_hard(mp, (type) & MTX_HARDOPTS, _mtx_fl);     \
        else                                                            \
                (mp)->mtx_savefl = _mtx_fl;                             \
} while (0)

on the alpha it is almost the same:

/*
 * Get a spin lock, handle recusion inline (as the less common case)
 */

#define _getlock_spin_block(mp, tid, type) do {                         \
        u_int _ipl = alpha_pal_rdps() & ALPHA_PSL_IPL_MASK;             \
        if (atomic_cmpset_64(&(mp)->mtx_lock, MTX_UNOWNED, (tid)) == 0) \
                mtx_enter_hard(mp, (type) & MTX_HARDOPTS, _ipl);        \
        else {                                                          \
                alpha_mb();                                             \
                (mp)->mtx_saveipl = _ipl;                               \
        }                                                               \
} while (0)

Note that in the alpha we are just saving and restoring the ipl, but we
aren't actually changing it to disable interrupts.

-- 

John Baldwin <jhb@bsdi.com> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.cslab.vt.edu/~jobaldwi/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200009112037.NAA61735>