From: Al Viro <viro@zeniv.linux.org.uk>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-fsdevel@vger.kernel.org, torvalds@linux-foundation.org,
brauner@kernel.org
Subject: Re: [PATCH 3/3] iov_iter: import single vector iovecs as ITER_UBUF
Date: Tue, 28 Mar 2023 01:25:09 +0100 [thread overview]
Message-ID: <20230328002509.GK3390869@ZenIV> (raw)
In-Reply-To: <20230328000811.GJ3390869@ZenIV>
On Tue, Mar 28, 2023 at 01:08:11AM +0100, Al Viro wrote:
> On Mon, Mar 27, 2023 at 05:27:13PM -0600, Jens Axboe wrote:
> > Add a special case to __import_iovec(), which imports a single segment
> > iovec as an ITER_UBUF rather than an ITER_IOVEC. ITER_UBUF is cheaper
> > to iterate than ITER_IOVEC, and for a single segment iovec, there's no
> > point in using a segmented iterator.
>
> Won't that enforce the "single-segment readv() is always identical to
> read()"? We'd been through that before - some of infinibarf drvivers
> have two different command sets, one reached via read(), another - via
> readv(). It's a userland ABI. Misdesigned one, but that's infinibarf
> for you.
>
> Does anyone really need this particular microoptimization?
static ssize_t qib_write_iter(struct kiocb *iocb, struct iov_iter *from)
{
struct qib_filedata *fp = iocb->ki_filp->private_data;
struct qib_ctxtdata *rcd = ctxt_fp(iocb->ki_filp);
struct qib_user_sdma_queue *pq = fp->pq;
if (!iter_is_iovec(from) || !from->nr_segs || !pq)
return -EINVAL;
return qib_user_sdma_writev(rcd, pq, from->iov, from->nr_segs);
}
Hit this with single-segment writev() and you've got yourself -EINVAL.
Sure, that could be adjusted for (check for user_backed_iter(), then
if it's ubuf form an iovec and pass that to qib_user_sdma_writev()),
but that's a clear regression.
Found by simple grepping for iter_is_iovec()...
next prev parent reply other threads:[~2023-03-28 0:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-27 23:27 [PATCHSET v3 0/4] Turn single segment imports into ITER_UBUF Jens Axboe
2023-03-27 23:27 ` [PATCH 1/3] iov_iter: teach iov_iter_iovec() to deal with ITER_UBUF Jens Axboe
2023-03-27 23:27 ` [PATCH 2/3] iov_iter: convert import_single_range() to ITER_UBUF Jens Axboe
2023-03-27 23:27 ` [PATCH 3/3] iov_iter: import single vector iovecs as ITER_UBUF Jens Axboe
2023-03-28 0:08 ` Al Viro
2023-03-28 0:25 ` Al Viro [this message]
2023-03-28 1:20 ` Jens Axboe
2023-03-28 13:20 ` Jens Axboe
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=20230328002509.GK3390869@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=torvalds@linux-foundation.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).