From nobody Fri Oct 25 18:19:58 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 4XZrfk6JfLz5b1f8; Fri, 25 Oct 2024 18:19:58 +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 4XZrfk4Jdpz4Xgq; Fri, 25 Oct 2024 18:19:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729880398; 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=WfBeAu/6VY5SA22mM1Qcq8yFF5iQNHskdlBniZhAeSI=; b=MYOAph9zd50CUKncbHdlz5kWWgxZWIA2rDwEF0SE/eSKyN9SJ3EiIQrwCkUGNNJ6MPQqAt hDxn6RjwoWzTi5ZkjeNsRdyN6pOxA+QBdS2w3TUWHOnhoiNilnZz5/TU6KnSUtZUj4lzPs 1dRfpErGd7GggRDYtR60q4Sfd6tIdnKp4AeFqVWY2bQBCLav5DKv5IQHc7c7GekiWyVi0Z 2AcuWo7vavdDxkWvzbIZNzmbR53DwLYVZ82i5IEJOgtI/uA9DvnqAqm7huRYgXNslx9ufj MsS5BgTSORVGgckzvP4vIijbGF5p2uQi6iFDTQ416in0veBip3giyajUsIwDpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729880398; 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=WfBeAu/6VY5SA22mM1Qcq8yFF5iQNHskdlBniZhAeSI=; b=xxV9fA90xxX3sAIplpyK9IOsvVpoDe6qtdJKn9gyV29r8Az/FZT6hmFHy05qEeaI0bU+e6 JsuZ4vsQon9gVR0uPsOo+auzDx0lG/6gnHOEGdpCn6+3u3L5ucaGW4AUkUKY7ZtrIk1oTZ eooQNdDwpxohTv2HaCoCy+L9MyHGvnsKugdNK/pw6tciJOQDyi0+QRLCKeXUiAaHNaWqgn 02hNG9IR5u06tRbx6WISNOOmE+ZaRV9Nqxrj/A6ap12ZRJXkYi+NmHZguHp03pW0QD2jCg lAQMHazw/Qv3Z+6PxWk0vrFvk6p8BPjjqeEDvKLoxvCOhI3SKNRejDGXMvPedw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729880398; a=rsa-sha256; cv=none; b=nUnd3liOrYYbYq3O+m38k879Xwx3twx9moQepzQX5SccbQWK5Z4kTtCs7hgnZgLog6hwjQ J1OQb0i2ao50g938VDdvT85hiZa6CDRZ5sLSpvFn8AgKY7oe/90H2J1ZBmOscVUblTDdmS lZP5/NILsQCUySazrBpdpUlGz10JVE5kOpjC7n/uJWwotkolrCGHjyqF0WovamhXjzRoYd OCyuw6zEjZqml5YjaGVsmcNNomo7tDRKVqI9bMe7kkx2+FogJID+O/qDMZKOIJlj22PMt4 5bbJjRbAFIVlbeeR8HGNtQVpuWXvwWj7Sr2bG9Rfp/q2U2JZEUv++7nA1n3d2Q== 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 4XZrfk3wBxzc8Y; Fri, 25 Oct 2024 18:19:58 +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 49PIJwqt087290; Fri, 25 Oct 2024 18:19:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49PIJw9P087287; Fri, 25 Oct 2024 18:19:58 GMT (envelope-from git) Date: Fri, 25 Oct 2024 18:19:58 GMT Message-Id: <202410251819.49PIJw9P087287@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: fff518117b40 - main - virtio_p9fs: Fix handling of a full request queue 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: fff518117b40cbc3bca49073eed85dc725ebae4c Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fff518117b40cbc3bca49073eed85dc725ebae4c commit fff518117b40cbc3bca49073eed85dc725ebae4c Author: Mark Johnston AuthorDate: 2024-10-25 17:51:16 +0000 Commit: Mark Johnston CommitDate: 2024-10-25 17:51:16 +0000 virtio_p9fs: Fix handling of a full request queue If, when submitting a request, the virtqueue is full, we sleep until an interrupt has fired, then restart the request. However, while sleeping the channel lock is dropped, and in the meantime another thread may have reset the per-channel SG list, so upon retrying we'd (re)submit whatever happened to be left over in the previous request. Fix the problem by rebuilding the SG list after sleeping. Sponsored by: Klara, Inc. --- sys/dev/virtio/p9fs/virtio_p9fs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c b/sys/dev/virtio/p9fs/virtio_p9fs.c index cdcd9c125dbb..42f47a4f63cb 100644 --- a/sys/dev/virtio/p9fs/virtio_p9fs.c +++ b/sys/dev/virtio/p9fs/virtio_p9fs.c @@ -152,6 +152,7 @@ vt9p_request(void *handle, struct p9_req_t *req) /* Grab the channel lock*/ VT9P_LOCK(chan); +req_retry: sglist_reset(sg); /* Handle out VirtIO ring buffers */ error = sglist_append(sg, req->tc->sdata, req->tc->size); @@ -170,9 +171,7 @@ vt9p_request(void *handle, struct p9_req_t *req) } writable = sg->sg_nseg - readable; -req_retry: error = virtqueue_enqueue(vq, req, sg, readable, writable); - if (error != 0) { if (error == ENOSPC) { /*