aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/hyperv/vmbus/vmbus_chan.c
diff options
context:
space:
mode:
authorWei Hu <whu@FreeBSD.org>2023-10-20 08:58:20 +0000
committerWei Hu <whu@FreeBSD.org>2023-10-20 10:22:55 +0000
commitd0891e9cae629afebe1997c8912b79375221d9ac (patch)
tree1fb00d04f77a759f06d4eb4154baa4d2c138cd65 /sys/dev/hyperv/vmbus/vmbus_chan.c
parent51be8675416df4aa066e823fec37ea6667494e63 (diff)
downloadsrc-d0891e9cae629afebe1997c8912b79375221d9ac.tar.gz
src-d0891e9cae629afebe1997c8912b79375221d9ac.zip
Hyper-V: vmbus: check if signaling host is needed in vmbus_rxbr_read
It is observed that netvsc's send rings could stall on the latest Azure Boost platforms. This is due to vmbus_rxbr_read() routine doesn't check if host is waiting for more room to put data, which leads to host side sleeping forever on this vmbus channel. The problem was only observed on the latest platform because the host requests larger buffer ring room to be available, which causes the issue to happen much more easily. Fix this by adding check in the vmbus_rxbr_read call and signaling the host in the callers if check returns positively. Reported by: NetApp Tested by: whu Sponsored by: Microsoft (cherry picked from commit 49fa9a64372b087cfd66459a20f4ffd25464b6a3)
Diffstat (limited to 'sys/dev/hyperv/vmbus/vmbus_chan.c')
-rw-r--r--sys/dev/hyperv/vmbus/vmbus_chan.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/dev/hyperv/vmbus/vmbus_chan.c b/sys/dev/hyperv/vmbus/vmbus_chan.c
index 85f87a5dbf99..ff42f75a883f 100644
--- a/sys/dev/hyperv/vmbus/vmbus_chan.c
+++ b/sys/dev/hyperv/vmbus/vmbus_chan.c
@@ -1201,6 +1201,7 @@ vmbus_chan_recv(struct vmbus_channel *chan, void *data, int *dlen0,
{
struct vmbus_chanpkt_hdr pkt;
int error, dlen, hlen;
+ boolean_t sig_event;
error = vmbus_rxbr_peek(&chan->ch_rxbr, &pkt, sizeof(pkt));
if (error)
@@ -1231,9 +1232,12 @@ vmbus_chan_recv(struct vmbus_channel *chan, void *data, int *dlen0,
*dlen0 = dlen;
/* Skip packet header */
- error = vmbus_rxbr_read(&chan->ch_rxbr, data, dlen, hlen);
+ error = vmbus_rxbr_read(&chan->ch_rxbr, data, dlen, hlen, &sig_event);
KASSERT(!error, ("vmbus_rxbr_read failed"));
+ if (!error && sig_event)
+ vmbus_chan_signal_rx(chan);
+
return (0);
}
@@ -1242,6 +1246,7 @@ vmbus_chan_recv_pkt(struct vmbus_channel *chan,
struct vmbus_chanpkt_hdr *pkt, int *pktlen0)
{
int error, pktlen, pkt_hlen;
+ boolean_t sig_event;
pkt_hlen = sizeof(*pkt);
error = vmbus_rxbr_peek(&chan->ch_rxbr, pkt, pkt_hlen);
@@ -1273,9 +1278,12 @@ vmbus_chan_recv_pkt(struct vmbus_channel *chan,
* by the above vmbus_rxbr_peek().
*/
error = vmbus_rxbr_read(&chan->ch_rxbr, pkt + 1,
- pktlen - pkt_hlen, pkt_hlen);
+ pktlen - pkt_hlen, pkt_hlen, &sig_event);
KASSERT(!error, ("vmbus_rxbr_read failed"));
+ if (!error && sig_event)
+ vmbus_chan_signal_rx(chan);
+
return (0);
}