Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147356836
D7258.id18579.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D7258.id18579.diff
View Options
Index: sys/dev/hyperv/vmbus/vmbus_chan.c
===================================================================
--- sys/dev/hyperv/vmbus/vmbus_chan.c
+++ sys/dev/hyperv/vmbus/vmbus_chan.c
@@ -83,7 +83,7 @@
vmbus_chan_signal_tx(const struct hv_vmbus_channel *chan)
{
atomic_set_long(chan->ch_evtflag, chan->ch_evtflag_mask);
- if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF)
+ if (chan->ch_txflags & VMBUS_CHAN_TXF_HASMNF)
atomic_set_int(chan->ch_montrig, chan->ch_montrig_mask);
else
hypercall_signal_event(chan->ch_monprm_dma.hv_paddr);
@@ -95,7 +95,7 @@
struct hv_vmbus_channel *chan = arg1;
int mnf = 0;
- if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF)
+ if (chan->ch_txflags & VMBUS_CHAN_TXF_HASMNF)
mnf = 1;
return sysctl_handle_int(oidp, &mnf, 0, req);
}
@@ -1102,7 +1102,7 @@
/*
* Setup MNF stuffs.
*/
- chan->ch_flags |= VMBUS_CHAN_FLAG_HASMNF;
+ chan->ch_txflags |= VMBUS_CHAN_TXF_HASMNF;
trig_idx = offer->chm_montrig / VMBUS_MONTRIG_LEN;
if (trig_idx >= VMBUS_MONTRIGS_MAX)
Index: sys/dev/hyperv/vmbus/vmbus_chanvar.h
===================================================================
--- sys/dev/hyperv/vmbus/vmbus_chanvar.h
+++ sys/dev/hyperv/vmbus/vmbus_chanvar.h
@@ -71,42 +71,63 @@
} hv_vmbus_ring_buffer_info;
typedef struct hv_vmbus_channel {
- device_t ch_dev;
- struct vmbus_softc *ch_vmbus;
+ /*
+ * NOTE:
+ * Fields before ch_txbr are only accessed on this channel's
+ * target CPU.
+ */
uint32_t ch_flags; /* VMBUS_CHAN_FLAG_ */
- uint32_t ch_id; /* channel id */
+
+ /*
+ * RX bufring; immediately following ch_txbr.
+ */
+ hv_vmbus_ring_buffer_info ch_rxbr;
+
+ struct taskqueue *ch_tq;
+ struct task ch_task;
+ vmbus_chan_callback_t ch_cb;
+ void *ch_cbarg;
+
+ /*
+ * TX bufring; at the beginning of ch_bufring.
+ *
+ * NOTE:
+ * Put TX bufring and the following MNF/evtflag to a new
+ * cacheline, since they will be accessed on all CPUs by
+ * locking ch_txbr first.
+ *
+ * XXX
+ * TX bufring and following MNF/evtflags do _not_ fit in
+ * one 64B cacheline.
+ */
+ hv_vmbus_ring_buffer_info ch_txbr __aligned(CACHE_LINE_SIZE);
+ uint32_t ch_txflags; /* VMBUS_CHAN_TXF_ */
/*
* These are based on the vmbus_chanmsg_choffer.chm_montrig.
* Save it here for easy access.
*/
- volatile uint32_t *ch_montrig; /* MNF trigger loc. */
uint32_t ch_montrig_mask;/* MNF trig mask */
+ volatile uint32_t *ch_montrig; /* MNF trigger loc. */
/*
* 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 */
+ volatile u_long *ch_evtflag; /* event flag loc. */
/*
- * TX bufring; at the beginning of ch_bufring.
- */
- hv_vmbus_ring_buffer_info ch_txbr;
- /*
- * RX bufring; immediately following ch_txbr.
+ * Rarely used fields.
*/
- hv_vmbus_ring_buffer_info ch_rxbr;
-
- struct taskqueue *ch_tq;
- struct task ch_task;
- vmbus_chan_callback_t ch_cb;
- void *ch_cbarg;
struct hyperv_mon_param *ch_monprm;
struct hyperv_dma ch_monprm_dma;
+ uint32_t ch_id; /* channel id */
+ device_t ch_dev;
+ struct vmbus_softc *ch_vmbus;
+
int ch_cpuid; /* owner cpu */
/*
* Virtual cpuid for ch_cpuid; it is used to communicate cpuid
@@ -141,11 +162,10 @@
struct hyperv_guid ch_guid_inst;
struct sysctl_ctx_list ch_sysctl_ctx;
-} hv_vmbus_channel;
+} hv_vmbus_channel __aligned(CACHE_LINE_SIZE);
#define VMBUS_CHAN_ISPRIMARY(chan) ((chan)->ch_subidx == 0)
-#define VMBUS_CHAN_FLAG_HASMNF 0x0001
/*
* If this flag is set, this channel's interrupt will be masked in ISR,
* and the RX bufring will be drained before this channel's interrupt is
@@ -156,6 +176,8 @@
*/
#define VMBUS_CHAN_FLAG_BATCHREAD 0x0002
+#define VMBUS_CHAN_TXF_HASMNF 0x0001
+
#define VMBUS_CHAN_ST_OPENED_SHIFT 0
#define VMBUS_CHAN_ST_OPENED (1 << VMBUS_CHAN_ST_OPENED_SHIFT)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 11, 7:11 AM (1 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29531353
Default Alt Text
D7258.id18579.diff (3 KB)
Attached To
Mode
D7258: hyperv/vmbus: Reorder channel fields.
Attached
Detach File
Event Timeline
Log In to Comment