Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jul 2016 05:30:31 +0000 (UTC)
From:      Sepherosa Ziehau <sephe@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r303127 - head/sys/dev/hyperv/vmbus
Message-ID:  <201607210530.u6L5UV1l090509@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sephe
Date: Thu Jul 21 05:30:31 2016
New Revision: 303127
URL: https://svnweb.freebsd.org/changeset/base/303127

Log:
  hyperv/vmbus: Save event flag location and evet flag mask.
  
  This avoids unnecessary access to the vmbus_softc struct on sending path.
  
  MFC after:	1 week
  Sponsored by:	Microsoft OSTC
  Differential Revision:	https://reviews.freebsd.org/D7257

Modified:
  head/sys/dev/hyperv/vmbus/vmbus_chan.c
  head/sys/dev/hyperv/vmbus/vmbus_chanvar.h

Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/vmbus_chan.c	Thu Jul 21 03:11:39 2016	(r303126)
+++ head/sys/dev/hyperv/vmbus/vmbus_chan.c	Thu Jul 21 05:30:31 2016	(r303127)
@@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$");
 #include <dev/hyperv/vmbus/vmbus_reg.h>
 #include <dev/hyperv/vmbus/vmbus_var.h>
 
-static void 	vmbus_chan_signal_tx(struct hv_vmbus_channel *chan);
 static void	vmbus_chan_update_evtflagcnt(struct vmbus_softc *,
 		    const struct hv_vmbus_channel *);
 
@@ -77,18 +76,13 @@ vmbus_chan_msgprocs[VMBUS_CHANMSG_TYPE_M
 	VMBUS_CHANMSG_PROC_WAKEUP(GPADL_DISCONNRESP)
 };
 
-/**
- *  @brief Trigger an event notification on the specified channel
+/*
+ * Notify host that there are data pending on our TX bufring.
  */
-static void
-vmbus_chan_signal_tx(struct hv_vmbus_channel *chan)
+static __inline void
+vmbus_chan_signal_tx(const struct hv_vmbus_channel *chan)
 {
-	struct vmbus_softc *sc = chan->ch_vmbus;
-	uint32_t chanid = chan->ch_id;
-
-	atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT],
-	    1UL << (chanid & VMBUS_EVTFLAG_MASK));
-
+	atomic_set_long(chan->ch_evtflag, chan->ch_evtflag_mask);
 	if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF)
 		atomic_set_int(chan->ch_montrig, chan->ch_montrig_mask);
 	else
@@ -1120,6 +1114,13 @@ vmbus_chan_msgproc_choffer(struct vmbus_
 		    1 << (offer->chm_montrig % VMBUS_MONTRIG_LEN);
 	}
 
+	/*
+	 * Setup event flag.
+	 */
+	chan->ch_evtflag =
+	    &sc->vmbus_tx_evtflags[chan->ch_id >> VMBUS_EVTFLAG_SHIFT];
+	chan->ch_evtflag_mask = 1UL << (chan->ch_id & VMBUS_EVTFLAG_MASK);
+
 	/* Select default cpu for this channel. */
 	vmbus_chan_cpu_default(chan);
 

Modified: head/sys/dev/hyperv/vmbus/vmbus_chanvar.h
==============================================================================
--- head/sys/dev/hyperv/vmbus/vmbus_chanvar.h	Thu Jul 21 03:11:39 2016	(r303126)
+++ head/sys/dev/hyperv/vmbus/vmbus_chanvar.h	Thu Jul 21 05:30:31 2016	(r303127)
@@ -77,13 +77,20 @@ typedef struct hv_vmbus_channel {
 	uint32_t			ch_id;		/* channel id */
 
 	/*
-	 * These are based on the offer_msg.monitor_id.
+	 * These are based on the vmbus_chanmsg_choffer.chm_montrig.
 	 * Save it here for easy access.
 	 */
-	volatile uint32_t		*ch_montrig;	/* MNF trigger */
+	volatile uint32_t		*ch_montrig;	/* MNF trigger loc. */
 	uint32_t			ch_montrig_mask;/* MNF trig mask */
 
 	/*
+	 * These are based on the vmbus_chanmsg_choffer.chm_chanid.
+	 * Save it here for easy access.
+	 */
+	volatile u_long			*ch_evtflag;	/* event flag loc. */
+	u_long				ch_evtflag_mask;/* event flag */
+
+	/*
 	 * TX bufring; at the beginning of ch_bufring.
 	 */
 	hv_vmbus_ring_buffer_info	ch_txbr;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607210530.u6L5UV1l090509>