From owner-svn-src-all@FreeBSD.ORG Fri Jun 6 00:24:05 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AFF63B6F; Fri, 6 Jun 2014 00:24:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 830192C10; Fri, 6 Jun 2014 00:24:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s560O5mo077926; Fri, 6 Jun 2014 00:24:05 GMT (envelope-from zont@svn.freebsd.org) Received: (from zont@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s560O57I077923; Fri, 6 Jun 2014 00:24:05 GMT (envelope-from zont@svn.freebsd.org) Message-Id: <201406060024.s560O57I077923@svn.freebsd.org> From: Andrey Zonov Date: Fri, 6 Jun 2014 00:24:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267142 - head/sys/dev/netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jun 2014 00:24:05 -0000 Author: zont Date: Fri Jun 6 00:24:04 2014 New Revision: 267142 URL: http://svnweb.freebsd.org/changeset/base/267142 Log: Use mtx_lock_spin/mtx_unlock_spin primitives on spin lock Reviewed by: luigi MFC after: 1 week Modified: head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_mbq.c Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Fri Jun 6 00:22:19 2014 (r267141) +++ head/sys/dev/netmap/netmap.c Fri Jun 6 00:24:04 2014 (r267142) @@ -1009,7 +1009,7 @@ netmap_rxsync_from_host(struct netmap_ad (void)pwait; /* disable unused warnings */ (void)td; - mtx_lock(&q->lock); + mtx_lock_spin(&q->lock); /* First part: import newly received packets */ n = mbq_len(q); @@ -1051,7 +1051,7 @@ netmap_rxsync_from_host(struct netmap_ad if (kring->rcur == kring->rtail && td) /* no bufs available */ selrecord(td, &kring->si); - mtx_unlock(&q->lock); + mtx_unlock_spin(&q->lock); return ret; } @@ -2381,7 +2381,7 @@ netmap_transmit(struct ifnet *ifp, struc * not possible on Linux). * Also avoid overflowing the queue. */ - mtx_lock(&q->lock); + mtx_lock_spin(&q->lock); space = kring->nr_hwtail - kring->nr_hwcur; if (space < 0) @@ -2398,7 +2398,7 @@ netmap_transmit(struct ifnet *ifp, struc m = NULL; error = 0; } - mtx_unlock(&q->lock); + mtx_unlock_spin(&q->lock); done: if (m) Modified: head/sys/dev/netmap/netmap_mbq.c ============================================================================== --- head/sys/dev/netmap/netmap_mbq.c Fri Jun 6 00:22:19 2014 (r267141) +++ head/sys/dev/netmap/netmap_mbq.c Fri Jun 6 00:24:04 2014 (r267142) @@ -76,9 +76,9 @@ static inline void __mbq_enqueue(struct void mbq_safe_enqueue(struct mbq *q, struct mbuf *m) { - mtx_lock(&q->lock); + mtx_lock_spin(&q->lock); __mbq_enqueue(q, m); - mtx_unlock(&q->lock); + mtx_unlock_spin(&q->lock); } @@ -110,9 +110,9 @@ struct mbuf *mbq_safe_dequeue(struct mbq { struct mbuf *ret; - mtx_lock(&q->lock); + mtx_lock_spin(&q->lock); ret = __mbq_dequeue(q); - mtx_unlock(&q->lock); + mtx_unlock_spin(&q->lock); return ret; }