From owner-freebsd-alpha Mon Sep 11 13:37:36 2000 Delivered-To: freebsd-alpha@freebsd.org Received: from pike.osd.bsdi.com (pike.osd.bsdi.com [204.216.28.222]) by hub.freebsd.org (Postfix) with ESMTP id 72DF537B422; Mon, 11 Sep 2000 13:37:30 -0700 (PDT) Received: (from jhb@localhost) by pike.osd.bsdi.com (8.9.3/8.9.3) id NAA61735; Mon, 11 Sep 2000 13:37:29 -0700 (PDT) (envelope-from jhb) From: John Baldwin Message-Id: <200009112037.NAA61735@pike.osd.bsdi.com> Subject: Bug in spinlocks? To: dfr@FreeBSD.org Date: Mon, 11 Sep 2000 13:37:29 -0700 (PDT) Cc: alpha@FreeBSD.org X-Mailer: ELM [version 2.4ME+ PL68 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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 -- 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