From nobody Fri Oct 20 09:16:21 2023 X-Original-To: dev-commits-src-main@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 4SBf8j53H7z4xXvk; Fri, 20 Oct 2023 09:16:21 +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 4SBf8j4Zm6z4LKP; Fri, 20 Oct 2023 09:16:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697793381; 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=Lk2RxlLEOL2a5imL/EbVeVAuObMrOWsKB49AKAmJySI=; b=ikmcrwiI4qKNO2wYEXNYte4ML6QTN27iehrrkQmfJzZYPRsDa+QRKv1CPbIzE8+WPFXHgl Tsnz+gDgcA8CUzgFXXY2ZH6WIrRo7pIFgerrC9OSjdTYFR/idtdrbVcQpeCH7PcNDrplrv 10qNsO8M8Ja6pdrVUgxV9/ert4t8DSmLRr4VeHIT+NchX5i8gSlHkPvX/S1PNsoDQzyE0G ojIaJq6nByDzUbivdURhpspjcgabO1Nwcb7i3GKl3bzY7PtlHnMuPVcrxmoQmoORwwL2XV T7f9tUK+6zoweqAmVJIXQYiOBs/yLHoBhkus4uJG6IKcvSQLwU4c9U4U9Qw6XA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697793381; a=rsa-sha256; cv=none; b=YtzWyGk7mvyrE2ykzShGU8+WI0D5YCS71X1enkmSlsa2Gp241yn3HSj5FjBO/z05cpKdrT 8WgzzuDsDJ/Am3L4PzmNypQRx4glg7XqcW+43xUnpIABoaIUsTV2iqT1Sxcy4SbfGdfJUv jhenWLpewLI4OEmfpyX1fumqRF7XIVDnUyQ8HfgNzR+Q15WI3zePaHAHi8eq3Pc5ZFcXlB 4mXo6m3AUghClx6brAfsVvyaQnTcxJkYR2G2KQlFKHJi0KJIA/rnQyYBszaEBoEzQEwqjI UiQ0+7LGpORSzL2HvVSCibL3oJ1J6Fq4rXR5+BiL4Rvlqar/Ex+XqINnVZuRvg== 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=1697793381; 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=Lk2RxlLEOL2a5imL/EbVeVAuObMrOWsKB49AKAmJySI=; b=FSA/v8Gep1k7j6eerWtXVjeHSaEGUMFlnT+5PAICmDbHrlB6HTK20+uYA8tl4tyUm+Hha4 lFknS9IgVNe2uLYZ4f82hVG+rLPkWuo3lvYndYDJ6N6HESELY9n4k1x11gb6ZE2njEf6Qz qCe27ViEKxQb1JbuAxdrNkbTDdSICEJLbk9rTSO+uqwsFXLsZkX2+9DA3mSnJplNpANLy/ c9FyzsLPxxSMhIlPsPp8Na3P25+OmemWYZZz3YagM65RdHjqqp3PqYX/YsSoISx6XGzoBa M2Mm7L2b/Qs85c8DPh4OU2Vs1LQQU3os17bt1tG6+L/J0LKncHS5lLCsI53Xxw== 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 4SBf8j3f7qzBPy; Fri, 20 Oct 2023 09:16:21 +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 39K9GLRr056708; Fri, 20 Oct 2023 09:16:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39K9GLn0056705; Fri, 20 Oct 2023 09:16:21 GMT (envelope-from git) Date: Fri, 20 Oct 2023 09:16:21 GMT Message-Id: <202310200916.39K9GLn0056705@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wei Hu Subject: git: 49fa9a64372b - main - Hyper-V: vmbus: check if signaling host is needed in vmbus_rxbr_read List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 49fa9a64372b087cfd66459a20f4ffd25464b6a3 Auto-Submitted: auto-generated The branch main has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=49fa9a64372b087cfd66459a20f4ffd25464b6a3 commit 49fa9a64372b087cfd66459a20f4ffd25464b6a3 Author: Wei Hu AuthorDate: 2023-10-20 08:58:20 +0000 Commit: Wei Hu CommitDate: 2023-10-20 09:15:21 +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 MFC after: 3 days Sponsored by: Microsoft --- 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 27adf71fd6ea..f663bb7c2ba5 100644 --- a/sys/dev/hyperv/vmbus/vmbus_br.c +++ b/sys/dev/hyperv/vmbus/vmbus_br.c @@ -684,7 +684,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; @@ -717,5 +718,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 8593c1886b0f..a04169f3291c 100644 --- a/sys/dev/hyperv/vmbus/vmbus_brvar.h +++ b/sys/dev/hyperv/vmbus/vmbus_brvar.h @@ -129,7 +129,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 d5c4d357e9ec..ecb2e947c953 100644 --- a/sys/dev/hyperv/vmbus/vmbus_chan.c +++ b/sys/dev/hyperv/vmbus/vmbus_chan.c @@ -1205,6 +1205,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) @@ -1235,9 +1236,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); } @@ -1246,6 +1250,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); @@ -1277,9 +1282,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); }