From owner-svn-src-all@freebsd.org Thu Jan 5 08:42:59 2017 Return-Path: Delivered-To: svn-src-all@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 7AFE3C9FF06; Thu, 5 Jan 2017 08:42:59 +0000 (UTC) (envelope-from sephe@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 55AF41CA4; Thu, 5 Jan 2017 08:42:59 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v058gwZx081991; Thu, 5 Jan 2017 08:42:58 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v058gwUH081987; Thu, 5 Jan 2017 08:42:58 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201701050842.v058gwUH081987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 5 Jan 2017 08:42:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r311389 - stable/11/sys/dev/hyperv/vmbus X-SVN-Group: stable-11 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.23 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: Thu, 05 Jan 2017 08:42:59 -0000 Author: sephe Date: Thu Jan 5 08:42:58 2017 New Revision: 311389 URL: https://svnweb.freebsd.org/changeset/base/311389 Log: MFC 310651 hyperv/vmbus: Nuke unnecessary critical sections. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8906 Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus.c Thu Jan 5 08:41:29 2017 (r311388) +++ stable/11/sys/dev/hyperv/vmbus/vmbus.c Thu Jan 5 08:42:58 2017 (r311389) @@ -1393,7 +1393,7 @@ cleanup: vmbus_xact_ctx_destroy(sc->vmbus_xc); sc->vmbus_xc = NULL; } - free(sc->vmbus_chmap, M_DEVBUF); + free(__DEVOLATILE(void *, sc->vmbus_chmap), M_DEVBUF); mtx_destroy(&sc->vmbus_prichan_lock); mtx_destroy(&sc->vmbus_chan_lock); @@ -1480,7 +1480,7 @@ vmbus_detach(device_t dev) sc->vmbus_xc = NULL; } - free(sc->vmbus_chmap, M_DEVBUF); + free(__DEVOLATILE(void *, sc->vmbus_chmap), M_DEVBUF); mtx_destroy(&sc->vmbus_prichan_lock); mtx_destroy(&sc->vmbus_chan_lock); Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Thu Jan 5 08:41:29 2017 (r311388) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Thu Jan 5 08:42:58 2017 (r311389) @@ -775,9 +775,7 @@ vmbus_chan_clrchmap_task(void *xchan, in { struct vmbus_channel *chan = xchan; - critical_enter(); chan->ch_vmbus->vmbus_chmap[chan->ch_id] = NULL; - critical_exit(); } static void @@ -1308,15 +1306,17 @@ vmbus_chan_pollcfg_task(void *xarg, int chan->ch_poll_flags = poll_flags; /* - * Disable interrupt from the RX bufring (TX bufring does not - * generate interrupt to VM), and disconnect this channel from - * the channel map to make sure that ISR can not enqueue this - * channel task anymore. + * Disconnect this channel from the channel map to make sure that + * the RX bufring interrupt enabling bit can not be touched, and + * ISR can not enqueue this channel task anymore. THEN, disable + * interrupt from the RX bufring (TX bufring does not generate + * interrupt to VM). + * + * NOTE: order is critical. */ - critical_enter(); - vmbus_rxbr_intr_mask(&chan->ch_rxbr); chan->ch_vmbus->vmbus_chmap[chan->ch_id] = NULL; - critical_exit(); + __compiler_membar(); + vmbus_rxbr_intr_mask(&chan->ch_rxbr); /* * NOTE: @@ -1380,11 +1380,9 @@ vmbus_chan_polldis_task(void *xchan, int * Plug this channel back to the channel map and unmask * the RX bufring interrupt. */ - critical_enter(); chan->ch_vmbus->vmbus_chmap[chan->ch_id] = chan; __compiler_membar(); vmbus_rxbr_intr_unmask(&chan->ch_rxbr); - critical_exit(); /* * Kick start the interrupt task, just in case unmasking Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jan 5 08:41:29 2017 (r311388) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jan 5 08:42:58 2017 (r311389) @@ -93,7 +93,7 @@ struct vmbus_softc { u_long *vmbus_rx_evtflags; /* compat evtflgs from host */ - struct vmbus_channel **vmbus_chmap; + struct vmbus_channel *volatile *vmbus_chmap; struct vmbus_xact_ctx *vmbus_xc; struct vmbus_pcpu_data vmbus_pcpu[MAXCPU];