From d0891e9cae629afebe1997c8912b79375221d9ac Mon Sep 17 00:00:00 2001 From: Wei Hu Date: Fri, 20 Oct 2023 08:58:20 +0000 Subject: 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) --- sys/dev/hyperv/vmbus/vmbus_chan.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'sys/dev/hyperv/vmbus/vmbus_chan.c') 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); } -- cgit v1.2.3