From: Christoph Hellwig <hch@infradead.org>
To: asmadeus@codewreck.org
Cc: Christoph Hellwig <hch@infradead.org>,
Eric Van Hensbergen <ericvh@kernel.org>,
Latchesar Ionkov <lucho@ionkov.net>,
Christian Schoenebeck <linux_oss@crudebyte.com>,
v9fs@lists.linux.dev, linux-kernel@vger.kernel.org,
David Howells <dhowells@redhat.com>,
Matthew Wilcox <willy@infradead.org>,
linux-fsdevel@vger.kernel.org,
Chris Arges <carges@cloudflare.com>
Subject: Re: [PATCH] 9p/virtio: restrict page pinning to user_backed_iter() iovec
Date: Sun, 14 Dec 2025 21:55:12 -0800 [thread overview]
Message-ID: <aT-iwMpOfSoRzkTF@infradead.org> (raw)
In-Reply-To: <aT1qEmxcOjuJEZH9@codewreck.org>
[Dave: netfs questions below, please read]
On Sat, Dec 13, 2025 at 10:28:50PM +0900, asmadeus@codewreck.org wrote:
> Christoph Hellwig wrote on Wed, Dec 10, 2025 at 12:32:41AM -0800:
> > > Looking at the implementation for iov_iter_extract_bvec_pages() it looks
> > > like it might not process all the way to the end, so we need to loop on
> > > calling iov_iter_extract_pages()? (I see networking code looping on
> > > "while (iter->count > 0)")
> >
> > Yes.
>
> Ok, I don't understand why the current code locks everything down and
> wants to use a single scatterlist shared for the whole channel (and
> capped to 128 pages?), it should only need to lock around the
> virtqueue_add_sg() call, I'll need to play with that some more.
What do you mean with "lock down"?
> Looking at other virtio drivers I could probably use a sg_table and
> have extract_iter_to_sg() do all the work for us...
Looking at the code I'm actually really confused. Both because I
actually though we were talking about the 9fs direct I/O code, but
that has actually been removed / converted to netfs a long time ago.
But even more so what the net/9p code is actually doing.. How do
we even end up with user addresses here at all?
Let me try to understand things:
- p9_virtio_zc_request is the only instances of the p9_trans_module
zc_request operation.
- zc_request only gets called by p9_client_zc_rpc
- p9_client_zc_rpc gets called by p9_client_read_once, p9_client_write,
p9_client_write_subreq and p9_client_readdir
Let's go through these:
- p9_client_write_subreq is entirely unused
- p9_client_readdir builds a local iov_iter_kvec
- p9_client_read_once is only called by p9_client_read, and really
should be marked static.
- p9_client_read is called by v9fs_issue_read on a netfs iov_iter
and by v9fs_dir_readdir and v9fs_fid_xattr_get on a local kvec iter
- p9_client_write is called with a iov_iter_kvec from
v9fs_fid_xattr_set, and with a netfs-issued iov_iter by
v9fs_issue_write
So right now except for netfs everything is on a kvec. Dave, what
kind of iov_iter does netfs send down to the file system? I had
a bit of a hard time reading through it, but I'd expect that any
page pinning would be done in netfs and not below it? Why are we
using iov_iters here and not something like a bio_vec? What is
the fs / transport supported to do with these iters?
Ignoring the rest of the mail for now, because I suspect the outcome
of the above might make it irrelevant, but I'll come back to it if
needed.
next prev parent reply other threads:[~2025-12-15 5:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-09 21:04 [PATCH] 9p/virtio: restrict page pinning to user_backed_iter() iovec Dominique Martinet via B4 Relay
2025-12-10 4:21 ` Matthew Wilcox
2025-12-10 6:04 ` Christoph Hellwig
2025-12-10 7:38 ` asmadeus
2025-12-10 8:32 ` Christoph Hellwig
2025-12-13 13:28 ` asmadeus
2025-12-15 5:55 ` Christoph Hellwig [this message]
2025-12-15 7:34 ` Dominique Martinet
2025-12-15 11:16 ` Christian Schoenebeck
2025-12-15 14:37 ` Christoph Hellwig
2025-12-10 13:33 ` Christian Schoenebeck
2025-12-17 13:41 ` Christian Schoenebeck
2025-12-17 21:49 ` asmadeus
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=aT-iwMpOfSoRzkTF@infradead.org \
--to=hch@infradead.org \
--cc=asmadeus@codewreck.org \
--cc=carges@cloudflare.com \
--cc=dhowells@redhat.com \
--cc=ericvh@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux_oss@crudebyte.com \
--cc=lucho@ionkov.net \
--cc=v9fs@lists.linux.dev \
--cc=willy@infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).