From: kys@exchange.microsoft.com
To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com,
vkuznets@redhat.com, jasowang@redhat.com,
leann.ogasawara@canonical.com, marcelo.cerri@canonical.com,
sthemmin@microsoft.com
Cc: Stephen Hemminger <stephen@networkplumber.org>,
"K. Y. Srinivasan" <kys@microsoft.com>
Subject: [PATCH 5/6] vmbus: more host signalling avoidance
Date: Sun, 25 Jun 2017 12:30:28 -0700 [thread overview]
Message-ID: <1498419029-4127-5-git-send-email-kys@exchange.microsoft.com> (raw)
In-Reply-To: <1498418991-4071-1-git-send-email-kys@exchange.microsoft.com>
From: Stephen Hemminger <stephen@networkplumber.org>
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>
---
drivers/hv/ring_buffer.c | 27 +++++++++++++++++++--------
1 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
index b0f7952..741daa6 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);
--
1.7.1
next prev parent reply other threads:[~2017-06-25 19:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-25 19:29 [PATCH 0/6] Drivers: hv: vmbus: Ringbuffer cleanup and optimizations kys
2017-06-25 19:30 ` [PATCH 1/6] vmbus: simplify hv_ringbuffer_read kys
2017-06-25 19:30 ` [PATCH 2/6] vmbus: drop unused ring_buffer_info elements kys
2017-06-25 19:30 ` [PATCH 3/6] vmbus: refactor hv_signal_on_read kys
2017-06-25 19:30 ` [PATCH 4/6] vmbus: eliminate duplicate cached index kys
2017-06-25 19:30 ` kys [this message]
2017-06-25 19:30 ` [PATCH 6/6] vmbus: add prefetch to ring buffer iterator kys
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1498419029-4127-5-git-send-email-kys@exchange.microsoft.com \
--to=kys@exchange.microsoft.com \
--cc=apw@canonical.com \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=jasowang@redhat.com \
--cc=kys@microsoft.com \
--cc=leann.ogasawara@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.cerri@canonical.com \
--cc=olaf@aepfle.de \
--cc=stephen@networkplumber.org \
--cc=sthemmin@microsoft.com \
--cc=vkuznets@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®