From: Ming Lei <tom.leiming@gmail.com>
To: Keith Busch <kbusch@kernel.org>
Cc: Carlos Maiolino <cem@kernel.org>,
brauner@kernel.org, linux-block@vger.kernel.org
Subject: Re: [PATCH] iomap: enforce DIO alignment check in iomap]
Date: Wed, 10 Jun 2026 21:49:59 -0500 [thread overview]
Message-ID: <aioiV9_AgaIBB6cB@fedora> (raw)
In-Reply-To: <ainBCDneRqNvmMT_@kbusch-mbp>
On Wed, Jun 10, 2026 at 01:54:48PM -0600, Keith Busch wrote:
> On Wed, Jun 10, 2026 at 08:19:53PM +0200, Carlos Maiolino wrote:
> > On Wed, Jun 10, 2026 at 11:14:30AM -0600, Keith Busch wrote:
> > >
> > > It does require that someone calls the bio split-to-limits routine,
> > > which I had taken for granted as a given, but I realize that some
> > > drivers don't do that. What block device are you using for your test?
> >
> > In the PPC machine, it's a virtual scsi vdasd device from one of the
> > virtual nodes
> >
> > NAME HCTL TYPE VENDOR MODEL REV SERIAL TRAN
> > sda 0:0:1:0 disk AIX VDASD 0001 000a508a00007a0000000175dcba35ac.5
> >
> > ibmvfc 262144 0
> > ibmvscsi 196608 2
> >
> > For my x86 machine (remind I reduce the buffer size to 512 on x86), it's
> > a commodity sata samsung SSD:
>
> Okay, these are under blk-mq so always call __bio_split_to_limits.
> However, I see there's an optimization to skip the checks we're
> depending on if bio_may_need_split doesn't think it needs to be split,
> which is a problem for your observation. I don't think the current
> expecations can allow us to take this optimization anymore when page
> offsets are used.
>
> This should fix it:
>
> ---
> diff --git a/block/blk.h b/block/blk.h
> index 1a2d9101bba04..3731f3c5ed140 100644
> --- a/block/blk.h
> +++ b/block/blk.h
> @@ -404,7 +404,7 @@ static inline bool bio_may_need_split(struct bio *bio,
> bv = __bvec_iter_bvec(bio->bi_io_vec, bio->bi_iter);
> if (bio->bi_iter.bi_size > bv->bv_len - bio->bi_iter.bi_bvec_done)
> return true;
> - return bv->bv_len + bv->bv_offset > lim->max_fast_segment_size;
> + return bv.bv_offset || bv->bv_len > lim->max_fast_segment_size;
> }
This should work for the un-aligned DMA buffer, but might hurt perf for
any sub-page IO.
Given you have switched to validate dio buffer alignment to bio splitting, it
should be fine to check ->dma_alignment here by putting the three limits
fields into same cache line.
Thanks,
Ming
prev parent reply other threads:[~2026-06-11 2:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-10 15:27 [PATCH] iomap: enforce DIO alignment check in iomap] Carlos Maiolino
2026-06-10 15:37 ` Keith Busch
2026-06-10 16:58 ` Carlos Maiolino
2026-06-10 17:14 ` Keith Busch
2026-06-10 18:19 ` Carlos Maiolino
2026-06-10 19:54 ` Keith Busch
2026-06-11 2:49 ` Ming Lei [this message]
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=aioiV9_AgaIBB6cB@fedora \
--to=tom.leiming@gmail.com \
--cc=brauner@kernel.org \
--cc=cem@kernel.org \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.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