From: Yuho Choi <oss.patchbox@gmail.com>
To: Eric Van Hensbergen <ericvh@kernel.org>,
Latchesar Ionkov <lucho@ionkov.net>,
Dominique Martinet <asmadeus@codewreck.org>
Cc: Yuho Choi <oss.patchbox@gmail.com>,
Christian Schoenebeck <linux_oss@crudebyte.com>,
v9fs@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [Question] 9p/virtio: zero-copy pages after interrupted request
Date: Wed, 11 Nov 2026 21:45:50 -0500 [thread overview]
Message-ID: <20261112024555.1201300-2-oss.patchbox@gmail.com> (raw)
Hi,
I have a question about the zero-copy page lifetime in
p9_virtio_zc_request() (mainline 067c5c24cef2) and would appreciate your
view.
After virtqueue_add_sgs() and virtqueue_kick(), the function waits for the
response with io_wait_event_killable(). If a signal interrupts that wait,
it reaches err_out and calls p9_release_pages() before returning
-ERESTARTSYS. Only after the transport returns does p9_client_zc_rpc()
send TFLUSH.
If I read this correctly, the sequence can be:
publish the zero-copy scatterlist to the virtqueue
interrupt the wait with a signal
drop the user page references
send TFLUSH
finish or cancel the original backend request
The virtio backend still owns the original descriptor when the page
references are dropped, so it seems able to access pages that can meanwhile
be unmapped and reused.
I also checked QEMU's 9p backend (71f25c75417d). v9fs_flush() marks
the original PDU cancelled and waits on cancel_pdu->complete.
pdu_complete() calls push_and_notify() for the original PDU before
waking that waiter, and the flush coroutine then completes RFLUSH. A
successfully cancelled PDU is returned with a zero used length. This
ordering suggests that the original request can remain active after
Linux has released the pages.
Is there a 9p or virtio guarantee I am missing that makes it safe to
release the pages as soon as the killable wait returns? Or should the
pages and the transport's request reference remain alive until
req_done() consumes the original used buffer, including a zero-length
completion after TFLUSH?
Thanks,
Yuho
reply other threads:[~2026-11-12 2:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261112024555.1201300-2-oss.patchbox@gmail.com \
--to=oss.patchbox@gmail.com \
--cc=asmadeus@codewreck.org \
--cc=ericvh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux_oss@crudebyte.com \
--cc=lucho@ionkov.net \
--cc=v9fs@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox