From owner-svn-src-all@freebsd.org Tue Jun 26 14:07:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6ABCF1028353; Tue, 26 Jun 2018 14:07:12 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2170471D13; Tue, 26 Jun 2018 14:07:12 +0000 (UTC) (envelope-from royger@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F2EDE153F3; Tue, 26 Jun 2018 14:07:11 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5QE7BS2044177; Tue, 26 Jun 2018 14:07:11 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5QE7B2Q044176; Tue, 26 Jun 2018 14:07:11 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201806261407.w5QE7B2Q044176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Tue, 26 Jun 2018 14:07:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335664 - head/sys/dev/xen/netback X-SVN-Group: head X-SVN-Commit-Author: royger X-SVN-Commit-Paths: head/sys/dev/xen/netback X-SVN-Commit-Revision: 335664 X-SVN-Commit-Repository: base 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.26 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: Tue, 26 Jun 2018 14:07:12 -0000 Author: royger Date: Tue Jun 26 14:07:11 2018 New Revision: 335664 URL: https://svnweb.freebsd.org/changeset/base/335664 Log: xen-netback: fix LOR lock order reversal: (sleepable after non-sleepable) 1st 0xfffffe00357ff538 xnb_softc (xen netback softc lock) @ /usr/src/sys/dev/xen/netback/netback.c:1069 2nd 0xffffffff81fdccb0 intrsrc (intrsrc) @ /usr/src/sys/x86/x86/intr_machdep.c:224 There's no need to hold the lock since the cleaning of the interrupt cannot happen in parallel due to the XNBF_IN_SHUTDOWN flag being set. Note that the locking in netback needs some improvement or clarification. While there also remove a double newline. Sponsored by: Citrix Systems R&D Modified: head/sys/dev/xen/netback/netback.c Modified: head/sys/dev/xen/netback/netback.c ============================================================================== --- head/sys/dev/xen/netback/netback.c Tue Jun 26 14:01:03 2018 (r335663) +++ head/sys/dev/xen/netback/netback.c Tue Jun 26 14:07:11 2018 (r335664) @@ -662,6 +662,7 @@ xnb_disconnect(struct xnb_softc *xnb) mtx_lock(&xnb->rx_lock); mtx_unlock(&xnb->rx_lock); + mtx_lock(&xnb->sc_lock); /* Free malloc'd softc member variables */ if (xnb->bridge != NULL) { free(xnb->bridge, M_XENSTORE); @@ -689,6 +690,8 @@ xnb_disconnect(struct xnb_softc *xnb) sizeof(struct xnb_ring_config)); xnb->flags &= ~XNBF_RING_CONNECTED; + mtx_unlock(&xnb->sc_lock); + return (0); } @@ -1066,17 +1069,14 @@ xnb_shutdown(struct xnb_softc *xnb) if_free(xnb->xnb_ifp); xnb->xnb_ifp = NULL; } - mtx_lock(&xnb->sc_lock); xnb_disconnect(xnb); - mtx_unlock(&xnb->sc_lock); if (xenbus_get_state(xnb->dev) < XenbusStateClosing) xenbus_set_state(xnb->dev, XenbusStateClosing); mtx_lock(&xnb->sc_lock); xnb->flags &= ~XNBF_IN_SHUTDOWN; - /* Indicate to xnb_detach() that is it safe to proceed. */ wakeup(xnb);