From owner-p4-projects@FreeBSD.ORG Sun Dec 30 05:03:56 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9A04F16A41A; Sun, 30 Dec 2007 05:03:56 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12F1016A419 for ; Sun, 30 Dec 2007 05:03:56 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 02FDA13C45B for ; Sun, 30 Dec 2007 05:03:56 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lBU53tES041402 for ; Sun, 30 Dec 2007 05:03:55 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lBU53tYX041398 for perforce@freebsd.org; Sun, 30 Dec 2007 05:03:55 GMT (envelope-from kmacy@freebsd.org) Date: Sun, 30 Dec 2007 05:03:55 GMT Message-Id: <200712300503.lBU53tYX041398@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 132023 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Dec 2007 05:03:56 -0000 http://perforce.freebsd.org/chv.cgi?CH=132023 Change 132023 by kmacy@pandemonium:kmacy:xen31 on 2007/12/30 05:02:56 no need to use spin locks - switch to MTX_DEF Affected files ... .. //depot/projects/xen31/sys/dev/xen/console/console.c#3 edit Differences ... ==== //depot/projects/xen31/sys/dev/xen/console/console.c#3 (text+ko) ==== @@ -76,9 +76,9 @@ #define XCUNIT(x) (minor(x)) #define ISTTYOPEN(tp) ((tp) && ((tp)->t_state & TS_ISOPEN)) #define CN_LOCK_INIT(x, _name) \ - mtx_init(&x, _name, _name, MTX_SPIN) -#define CN_LOCK(l, f) mtx_lock_irqsave(&(l), (f)) -#define CN_UNLOCK(l, f) mtx_unlock_irqrestore(&(l), (f)) + mtx_init(&x, _name, NULL, MTX_DEF) +#define CN_LOCK(l) mtx_lock(&(l)) +#define CN_UNLOCK(l) mtx_unlock(&(l)) #define CN_LOCK_ASSERT(x) mtx_assert(&x, MA_OWNED) #define CN_LOCK_DESTROY(x) mtx_destroy(&x) @@ -146,24 +146,22 @@ xccncheckc(struct consdev *dev) { int ret = (xc_mute ? 0 : -1); - int flags; - CN_LOCK(cn_mtx, flags); + CN_LOCK(cn_mtx); if ((rp - rc)) { /* we need to return only one char */ ret = (int)rbuf[RBUF_MASK(rc)]; rc++; } - CN_UNLOCK(cn_mtx, flags); + CN_UNLOCK(cn_mtx); return(ret); } static void xccnputc(struct consdev *dev, int c) { - int flags; - CN_LOCK(cn_mtx, flags); + CN_LOCK(cn_mtx); xcons_putc(c); - CN_UNLOCK(cn_mtx, flags); + CN_UNLOCK(cn_mtx); } static void @@ -284,17 +282,17 @@ void xencons_rx(char *buf, unsigned len) { - int i, flags; + int i; struct tty *tp = xccons; - CN_LOCK(cn_mtx, flags); + CN_LOCK(cn_mtx); for (i = 0; i < len; i++) { if (xen_console_up) (*linesw[tp->t_line]->l_rint)(buf[i], tp); else rbuf[RBUF_MASK(rp++)] = buf[i]; } - CN_UNLOCK(cn_mtx, flags); + CN_UNLOCK(cn_mtx); } static void @@ -325,10 +323,9 @@ void xencons_tx(void) { - unsigned long flags; - CN_LOCK(cn_mtx, flags); + CN_LOCK(cn_mtx); __xencons_tx_flush(); - CN_UNLOCK(cn_mtx, flags); + CN_UNLOCK(cn_mtx); } static void @@ -432,15 +429,14 @@ static void xcstart(struct tty *tp) { - int flags; int s; boolean_t cons_full = FALSE; s = spltty(); - CN_LOCK(cn_mtx, flags); + CN_LOCK(cn_mtx); if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) { ttwwakeup(tp); - CN_UNLOCK(cn_mtx, flags); + CN_UNLOCK(cn_mtx); return; } @@ -456,7 +452,7 @@ /* let the timeout kick us in a bit */ xc_start_needed = TRUE; } - CN_UNLOCK(cn_mtx, flags); + CN_UNLOCK(cn_mtx); splx(s); }