From nobody Fri Oct 25 18:20:00 2024 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 4XZrfn3b7cz5b1Wk; Fri, 25 Oct 2024 18:20:01 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XZrfm5nkjz4XmK; Fri, 25 Oct 2024 18:20:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729880400; 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=YVc3aRTjpnWagEBr5jZ3Gq7TcGigCjn4KGsOSHhUEiM=; b=rgz/fXFxncE6VHpI5i+9Z3jooa5u+/+g+ztmP0sOdidWnnn2mNrVRjKTsX3IfYPYkYIvCG oR3zK6Rpz5IpdPCDHrVGerpiVUA/yAsPbI9L92Bp6hhbs5O7FGQUqbLSsI/L8ZKumhW1KO DB/5MkHTF/G1+BENAm/PIKrj/iM8f8SYjiVO8qgftoN60kUvPw9gYFGyDmIvFLZnzfYWlx 5gBwyIxKDCMtA+FLqjx+BKj4DnBZ9rk+iMR17w87mHyUVaCcFtE4X1mKniq6YnRv/eUKzf 9WyOs9kBWPMiQRKVyOJj5i4YDIGFrQNqtrp5y41CNkfN+tIea1MrDwzgw4WAUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729880400; 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=YVc3aRTjpnWagEBr5jZ3Gq7TcGigCjn4KGsOSHhUEiM=; b=hDj0IOFDxd0c++IRnwbvmd0r2/UPUaJTIAV75f2mzQxwHjJHAQ9jL0ovioxQ86nHnzhun9 DHBQ7qz17lq5Bn/+BVwpjbMDJsTG4chf/7wtJzhQS76T1DG5IYznADk+XTk7EqmLgdF6UM LHUVU+/zdO7JUzJ/eWO6K1OT2NWFSNf0BnxvjVVPjxOFl2Gh1381TC/+IFPc4120r/Un9M h3XdjscxHBRzdxaO4pdVPoKPM0MdDeZ7lPc3MqYWrj6OiYohiZbNAFw0kpur83BDkz6BAa DXA0aH34tsHQh1qnspjIdcamCcunbQJ1x0TcOlLAmnD3Csc5rdjRyBDIO2gevQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729880400; a=rsa-sha256; cv=none; b=seeSbJhcYJKkFNrJjhVBScgcdDw5kpL6PbEuZHEPe9vwYfGYGIrj2B7M43QXTujppiZHkT 0Ry6r+euEBdrLIJZY5uycvhgfH/LQni3KKvyt53q8ujhfHaqcX3sNhCQLIc/W6YxyWCM3t qvcOwbkZi3gSKvvnriyhhYoioFcMpfR3oLQpf1qjbzQouZKaKTROrJVA5TpVd8dtfEamBO pn8v7S150DBi1c2GFi3bsc6/n4aPNYX6oFfz65tMxrG5KEFP/Qm9krxV3Wg8cZMBSL86SR xFXxZEABoDTlAzEipgpMAZmUNLAGWPhcVbfX9ikXaSZ5dtIOIuFPwC1MWg0yug== 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 4XZrfm5Q0zzc8c; Fri, 25 Oct 2024 18:20:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49PIK0Vb088096; Fri, 25 Oct 2024 18:20:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49PIK08B088075; Fri, 25 Oct 2024 18:20:00 GMT (envelope-from git) Date: Fri, 25 Oct 2024 18:20:00 GMT Message-Id: <202410251820.49PIK08B088075@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 28c9b13b236d - main - virtio_p9fs: Simplify vt9p_req_wait() a bit 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 28c9b13b236d25512cfe4e1902411ff421a14b64 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=28c9b13b236d25512cfe4e1902411ff421a14b64 commit 28c9b13b236d25512cfe4e1902411ff421a14b64 Author: Mark Johnston AuthorDate: 2024-10-25 17:52:52 +0000 Commit: Mark Johnston CommitDate: 2024-10-25 17:54:39 +0000 virtio_p9fs: Simplify vt9p_req_wait() a bit Remove an always-false check for whether the request has already completed before sleeping. Even if the request is complete, the response tag is updated while holding the channel lock, which is also held here. No functional change intended. Sponsored by: Klara, Inc. --- sys/dev/virtio/p9fs/virtio_p9fs.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c b/sys/dev/virtio/p9fs/virtio_p9fs.c index dae38a507428..1fdeeaae2a96 100644 --- a/sys/dev/virtio/p9fs/virtio_p9fs.c +++ b/sys/dev/virtio/p9fs/virtio_p9fs.c @@ -110,20 +110,20 @@ SYSCTL_UINT(_vfs_9p, OID_AUTO, ackmaxidle, CTLFLAG_RW, &vt9p_ackmaxidle, 0, static int vt9p_req_wait(struct vt9p_softc *chan, struct p9_req_t *req) { - if (req->tc->tag != req->rc->tag) { - if (msleep(req, VT9P_MTX(chan), 0, "chan lock", - vt9p_ackmaxidle * hz)) { - /* - * Waited for 120s. No response from host. - * Can't wait for ever.. - */ - P9_DEBUG(ERROR, "Timeout after waiting %u seconds" - "for an ack from host\n", vt9p_ackmaxidle); - return (EIO); - } - KASSERT(req->tc->tag == req->rc->tag, - ("Spurious event on p9 req")); + KASSERT(req->tc->tag != req->rc->tag, + ("%s: request %p already completed", __func__, req)); + + if (msleep(req, VT9P_MTX(chan), 0, "chan lock", vt9p_ackmaxidle * hz)) { + /* + * Waited for 120s. No response from host. + * Can't wait for ever.. + */ + P9_DEBUG(ERROR, "Timeout after waiting %u seconds" + "for an ack from host\n", vt9p_ackmaxidle); + return (EIO); } + KASSERT(req->tc->tag == req->rc->tag, + ("%s spurious event on request %p", __func__, req)); return (0); }