From owner-svn-src-projects@FreeBSD.ORG Tue May 12 01:00:30 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D98B106566B; Tue, 12 May 2009 01:00:30 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 80D248FC0A; Tue, 12 May 2009 01:00:30 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4C10U8V006765; Tue, 12 May 2009 01:00:30 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4C10UwR006762; Tue, 12 May 2009 01:00:30 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905120100.n4C10UwR006762@svn.freebsd.org> From: Kip Macy Date: Tue, 12 May 2009 01:00:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192005 - projects/releng_7_xen/sys/dev/xen/console X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 01:00:30 -0000 Author: kmacy Date: Tue May 12 01:00:30 2009 New Revision: 192005 URL: http://svn.freebsd.org/changeset/base/192005 Log: convert xen console lock to a spin lock to handle case of being called from interrupt context Modified: projects/releng_7_xen/sys/dev/xen/console/console.c projects/releng_7_xen/sys/dev/xen/console/xencons_ring.c projects/releng_7_xen/sys/dev/xen/console/xencons_ring.h Modified: projects/releng_7_xen/sys/dev/xen/console/console.c ============================================================================== --- projects/releng_7_xen/sys/dev/xen/console/console.c Mon May 11 23:03:15 2009 (r192004) +++ projects/releng_7_xen/sys/dev/xen/console/console.c Tue May 12 01:00:30 2009 (r192005) @@ -77,18 +77,8 @@ static unsigned int wc, wp; /* write_con #define XCUNIT(x) (minor(x)) #define ISTTYOPEN(tp) ((tp) && ((tp)->t_state & TS_ISOPEN)) #define CN_LOCK_INIT(x, _name) \ - mtx_init(&x, _name, NULL, MTX_DEF|MTX_RECURSE) + mtx_init(&x, _name, NULL, MTX_SPIN|MTX_RECURSE) -#define CN_LOCK(l) \ - do { \ - if (panicstr == NULL) \ - mtx_lock(&(l)); \ - } while (0) -#define CN_UNLOCK(l) \ - do { \ - if (panicstr == NULL) \ - mtx_unlock(&(l)); \ - } while (0) #define CN_LOCK_ASSERT(x) mtx_assert(&x, MA_OWNED) #define CN_LOCK_DESTROY(x) mtx_destroy(&x) Modified: projects/releng_7_xen/sys/dev/xen/console/xencons_ring.c ============================================================================== --- projects/releng_7_xen/sys/dev/xen/console/xencons_ring.c Mon May 11 23:03:15 2009 (r192004) +++ projects/releng_7_xen/sys/dev/xen/console/xencons_ring.c Tue May 12 01:00:30 2009 (r192005) @@ -83,25 +83,27 @@ xencons_handle_input(void *unused) struct xencons_interface *intf; XENCONS_RING_IDX cons, prod; - mtx_lock(&cn_mtx); + CN_LOCK(cn_mtx); intf = xencons_interface(); cons = intf->in_cons; prod = intf->in_prod; - + CN_UNLOCK(cn_mtx); + /* XXX needs locking */ while (cons != prod) { xencons_rx(intf->in + MASK_XENCONS_IDX(cons, intf->in), 1); cons++; } + CN_LOCK(cn_mtx); mb(); intf->in_cons = cons; notify_remote_via_evtchn(xen_start_info->console_evtchn); xencons_tx(); - mtx_unlock(&cn_mtx); + CN_UNLOCK(cn_mtx); } void Modified: projects/releng_7_xen/sys/dev/xen/console/xencons_ring.h ============================================================================== --- projects/releng_7_xen/sys/dev/xen/console/xencons_ring.h Mon May 11 23:03:15 2009 (r192004) +++ projects/releng_7_xen/sys/dev/xen/console/xencons_ring.h Tue May 12 01:00:30 2009 (r192005) @@ -5,6 +5,18 @@ #ifndef _XENCONS_RING_H #define _XENCONS_RING_H +#define CN_LOCK(l) \ + do { \ + if (panicstr == NULL) \ + mtx_lock_spin(&(l)); \ + } while (0) +#define CN_UNLOCK(l) \ + do { \ + if (panicstr == NULL) \ + mtx_unlock_spin(&(l)); \ + } while (0) + + int xencons_ring_init(void); int xencons_ring_send(const char *data, unsigned len); void xencons_rx(char *buf, unsigned len);