From nobody Fri Oct 20 10:34:37 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SBgv21fRzz4xd2C; Fri, 20 Oct 2023 10:34:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SBgv20cfNz4Syp; Fri, 20 Oct 2023 10:34:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697798078; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8J6umyz+MG71yhfXVIx8yZElTweAETjrew/FJOA5rZg=; b=rSYaVajhzqgYe8r+0FVRh1Y/DWB/oMojsJs19/AGwrl3mUJp5SmsPy6kaaKXH0YgC2r0k9 J+jTCM3guLGXkh+2f6NDbONqxfiRH4vjbWeI9iRUk7IKAbWobAjZsbp5dsqrK+GSGKsj+x FahW6lvw2vYwLyyisaM3XiCD01RZToVJMNJqSyW2eeaaZ4xRU57NsfOVT9QTETOJPHn3dS Hgirt6CmrfxCwUGU5iqxwO9U3cgWEVSZluDbjWOUXqiCcbKg/vwnsNQk45zqw+CA2s2oa2 XfO+wXCZkHr5ecUX+coHvql56qlsrpK2E17fFCQCD0pV7rL7hFQvNhY2ZKokFw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697798078; a=rsa-sha256; cv=none; b=G16gYi1TrBeFMB97UTvmOCZtiVAf1hHsvsYLGnT+30fuUo/w1WDGFqg/TXRa+tEOUY95u3 44U67YeS0liZq43sulNNr8aGclNbju85OppCLyNDE92kf1VAE3/v6RlvXe91hfWgd1qvgt kSz09XOcU1DLVVMkOxAx1XNynpH1mBCHQdA6g9jY2SuOmzAls966t63j7gD6dfv/2zW1iT Q4d6dfGx/3nPi/o1IEg5NPYUmdZEDbM6f6v3pzetbNdbw49yoQbBscCUa/yZisFhOxD2ox N4J8VsgqX4i6M6OACdfkWPxqVNV4Pr+Mirhtmd8feo70G2rJTyVXIQFm2+GGUA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697798078; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8J6umyz+MG71yhfXVIx8yZElTweAETjrew/FJOA5rZg=; b=PEQ0PlVXm/MJWcvzVxWdn/zYmmIYpNSpiQPEKi8wN/BHAaP0Im3aglD2IIySwamgl1ofuK 3/IobiVVbGOgNfoNUU+IY68qDch/c/Mw1wHcHEXzGy7Oek/ZaWc6148yboO6a/XCGWiXKi lfX+/L+FWPbfY04obh7dP7zaZEdMWXntIdHJBmTQztT4QkpK1FyNUkGVuJ/CoYrVKgUfI0 ABsvj2u0T0caaBVcOXCJfabUXfoqkJO8G1p7HhiTpRBZnQziIajVgIZDnYZUSMTR3Ys/mc JJ5tB/htRPPlJJ/Zq0+kfNuEeBgWrLPP3RWWJ9oY3MOlSsNvAdgws/lGvHOy3Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SBgv16gFYzVMd; Fri, 20 Oct 2023 10:34:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39KAYbPS089839; Fri, 20 Oct 2023 10:34:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39KAYbHL089837; Fri, 20 Oct 2023 10:34:37 GMT (envelope-from git) Date: Fri, 20 Oct 2023 10:34:37 GMT Message-Id: <202310201034.39KAYbHL089837@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: d0891e9cae62 - stable/13 - Hyper-V: vmbus: check if signaling host is needed in vmbus_rxbr_read List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d0891e9cae629afebe1997c8912b79375221d9ac Auto-Submitted: auto-generated The branch stable/13 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=d0891e9cae629afebe1997c8912b79375221d9ac commit d0891e9cae629afebe1997c8912b79375221d9ac Author: Wei Hu AuthorDate: 2023-10-20 08:58:20 +0000 Commit: Wei Hu CommitDate: 2023-10-20 10:22:55 +0000 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_br.c | 9 ++++++++- sys/dev/hyperv/vmbus/vmbus_brvar.h | 2 +- sys/dev/hyperv/vmbus/vmbus_chan.c | 12 ++++++++++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/sys/dev/hyperv/vmbus/vmbus_br.c b/sys/dev/hyperv/vmbus/vmbus_br.c index 997a5de1b230..6418f8e59cf8 100644 --- a/sys/dev/hyperv/vmbus/vmbus_br.c +++ b/sys/dev/hyperv/vmbus/vmbus_br.c @@ -682,7 +682,8 @@ vmbus_rxbr_idxadv(struct vmbus_rxbr *rbr, uint32_t idx_adv, * We assume (dlen + skip) == sizeof(channel packet). */ int -vmbus_rxbr_read(struct vmbus_rxbr *rbr, void *data, int dlen, uint32_t skip) +vmbus_rxbr_read(struct vmbus_rxbr *rbr, void *data, int dlen, uint32_t skip, + boolean_t *need_sig) { uint32_t rindex, br_dsize = rbr->rxbr_dsize; @@ -714,5 +715,11 @@ vmbus_rxbr_read(struct vmbus_rxbr *rbr, void *data, int dlen, uint32_t skip) mtx_unlock_spin(&rbr->rxbr_lock); + if (need_sig) { + *need_sig = + vmbus_rxbr_need_signal(rbr, + dlen + skip + sizeof(uint64_t)); + } + return (0); } diff --git a/sys/dev/hyperv/vmbus/vmbus_brvar.h b/sys/dev/hyperv/vmbus/vmbus_brvar.h index 883b74e92d95..97bdc12d80cb 100644 --- a/sys/dev/hyperv/vmbus/vmbus_brvar.h +++ b/sys/dev/hyperv/vmbus/vmbus_brvar.h @@ -127,7 +127,7 @@ void vmbus_rxbr_deinit(struct vmbus_rxbr *rbr); void vmbus_rxbr_setup(struct vmbus_rxbr *rbr, void *buf, int blen); int vmbus_rxbr_peek(struct vmbus_rxbr *rbr, void *data, int dlen); int vmbus_rxbr_read(struct vmbus_rxbr *rbr, void *data, int dlen, - uint32_t skip); + uint32_t skip, boolean_t *need_sig); int vmbus_rxbr_idxadv(struct vmbus_rxbr *rbr, uint32_t idx_adv, boolean_t *need_sig); int vmbus_rxbr_idxadv_peek(struct vmbus_rxbr *rbr, void *data, 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); }