summaryrefslogtreecommitdiffstats
path: root/drivers/hv/ring_buffer.c
diff options
context:
space:
mode:
authorStephen Hemminger <stephen@networkplumber.org>2017-06-25 12:30:28 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-07-17 17:16:05 +0200
commit03bad714a1619c0074eb44d6f217c505fe27030f (patch)
tree3185ecea62d5166d5fc711b0b164ff8f7abf933c /drivers/hv/ring_buffer.c
parent05d00bc94ac27d220d8a78e365d7fa3a26dcca17 (diff)
downloadlinux-03bad714a1619c0074eb44d6f217c505fe27030f.tar.bz2
vmbus: more host signalling avoidance
Don't signal host if it has disabled interrupts for that ring buffer. Check the feature bit to see if host supports pending send size flag. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hv/ring_buffer.c')
-rw-r--r--drivers/hv/ring_buffer.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
index b0f79526b86a..741daa6e2fc7 100644
--- a/drivers/hv/ring_buffer.c
+++ b/drivers/hv/ring_buffer.c
@@ -396,7 +396,6 @@ void hv_pkt_iter_close(struct vmbus_channel *channel)
{
struct hv_ring_buffer_info *rbi = &channel->inbound;
u32 orig_write_sz = hv_get_bytes_to_write(rbi);
- u32 pending_sz;
/*
* Make sure all reads are done before we update the read index since
@@ -419,15 +418,27 @@ void hv_pkt_iter_close(struct vmbus_channel *channel)
*/
virt_mb();
- pending_sz = READ_ONCE(rbi->ring_buffer->pending_send_sz);
- /* If the other end is not blocked on write don't bother. */
- if (pending_sz == 0)
+ /* If host has disabled notifications then skip */
+ if (rbi->ring_buffer->interrupt_mask)
return;
- if (hv_get_bytes_to_write(rbi) < pending_sz)
- return;
+ if (rbi->ring_buffer->feature_bits.feat_pending_send_sz) {
+ u32 pending_sz = READ_ONCE(rbi->ring_buffer->pending_send_sz);
- if (orig_write_sz < pending_sz)
- vmbus_setevent(channel);
+ /*
+ * If there was space before we began iteration,
+ * then host was not blocked. Also handles case where
+ * pending_sz is zero then host has nothing pending
+ * and does not need to be signaled.
+ */
+ if (orig_write_sz > pending_sz)
+ return;
+
+ /* If pending write will not fit, don't give false hope. */
+ if (hv_get_bytes_to_write(rbi) < pending_sz)
+ return;
+ }
+
+ vmbus_setevent(channel);
}
EXPORT_SYMBOL_GPL(hv_pkt_iter_close);