* [Question] 9p/virtio: zero-copy pages after interrupted request
@ 2026-11-12 2:45 Yuho Choi
0 siblings, 0 replies; only message in thread
From: Yuho Choi @ 2026-11-12 2:45 UTC (permalink / raw)
To: Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet
Cc: Yuho Choi, Christian Schoenebeck, v9fs, linux-kernel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-12 2:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-12 2:45 [Question] 9p/virtio: zero-copy pages after interrupted request Yuho Choi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®