From owner-svn-src-head@freebsd.org Fri Dec 30 14:47:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDF04C97D42; Fri, 30 Dec 2016 14:47:47 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 9D60F161C; Fri, 30 Dec 2016 14:47:47 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUElkth034739; Fri, 30 Dec 2016 14:47:46 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUElkDI034738; Fri, 30 Dec 2016 14:47:46 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201612301447.uBUElkDI034738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 30 Dec 2016 14:47:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310822 - 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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 14:47:47 -0000 Author: adrian Date: Fri Dec 30 14:47:46 2016 New Revision: 310822 URL: https://svnweb.freebsd.org/changeset/base/310822 Log: [netmap] fix locking regressions * Firmware oriented NICs may need to sleep in their configuration paths. Use RLOCK instead of WLOCK to allow this to again occur. This fixes netmap on cxgbe. * Change the worker lock to a normal mutex rather than a spin lock. Drivers shouldn't be doing netmap work from the fast interrupt handlers, so it's not required to be a spinlock. Submitted by: luigi, Vincenzo Maffione Reviewed by: jhb Modified: head/sys/dev/netmap/netmap_freebsd.c Modified: head/sys/dev/netmap/netmap_freebsd.c ============================================================================== --- head/sys/dev/netmap/netmap_freebsd.c Fri Dec 30 13:04:43 2016 (r310821) +++ head/sys/dev/netmap/netmap_freebsd.c Fri Dec 30 14:47:46 2016 (r310822) @@ -92,7 +92,7 @@ nm_os_selinfo_uninit(NM_SELINFO_T *si) void nm_os_ifnet_lock(void) { - IFNET_WLOCK(); + IFNET_RLOCK(); } void @@ -1090,8 +1090,8 @@ nm_kthread_worker(void *data) continue; } else if (nmk->run) { /* wait on event with one second timeout */ - msleep_spin((void *)(uintptr_t)ctx->cfg.wchan, - &nmk->worker_lock, "nmk_ev", hz); + msleep((void *)(uintptr_t)ctx->cfg.wchan, + &nmk->worker_lock, 0, "nmk_ev", hz); nmk->scheduled++; } mtx_unlock(&nmk->worker_lock); @@ -1122,7 +1122,7 @@ nm_os_kthread_create(struct nm_kthread_c if (!nmk) return NULL; - mtx_init(&nmk->worker_lock, "nm_kthread lock", NULL, MTX_SPIN); + mtx_init(&nmk->worker_lock, "nm_kthread lock", NULL, MTX_DEF); nmk->worker_ctx.worker_fn = cfg->worker_fn; nmk->worker_ctx.worker_private = cfg->worker_private; nmk->worker_ctx.type = cfg->type;