All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] dm-crypt: set max_io_len as chunk_sectors of zoned device
@ 2024-11-25  5:58 韦龙平(Groot)
  2024-11-25  6:01 ` Christoph Hellwig
  2024-11-25  6:03 ` Damien Le Moal
  0 siblings, 2 replies; 12+ messages in thread
From: 韦龙平(Groot) @ 2024-11-25  5:58 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: dm-devel@lists.linux.dev, snitzer@redhat.com, dlemoal@kernel.org,
	bvanassche@acm.org, ebiggers@google.com

On Sun, 24 Nov 2024 21:00:52 -0800, Christoph Hellwig wrote:
> On Mon, Nov 25, 2024 at 11:22:51AM +0800, LongPing Wei wrote:
> > When dm level submit a bio with bi_size > max_sectors_kb of lower device,
> > blk_mq_submit_bio will split it into several ones with limited bi_size.
> > It may be a potential unordered issue as it breaks the ZWL design in dm
> > on 6.6.
> 
> What is ZWL?  And why mention 6.6?  And why do you care about ordering?
ZWL is Zone-Write-Locking and it was replaced by Zone-Write-Plugging on 6.12.

> There is no real ordering requirement in the block layer.
According to the design constraints of zoned device, write requests in the same
zone must be dispatched in order of address and there can be no holes in the middle

^ permalink raw reply	[flat|nested] 12+ messages in thread
* [PATCH] dm-crypt: set max_io_len as chunk_sectors of zoned device
@ 2024-11-25  3:22 LongPing Wei
  2024-11-25  5:00 ` Christoph Hellwig
  0 siblings, 1 reply; 12+ messages in thread
From: LongPing Wei @ 2024-11-25  3:22 UTC (permalink / raw)
  To: dm-devel, snitzer; +Cc: dlemoal, bvanassche, ebiggers, LongPing Wei

When dm level submit a bio with bi_size > max_sectors_kb of lower device,
blk_mq_submit_bio will split it into several ones with limited bi_size.
It may be a potential unordered issue as it breaks the ZWL design in dm
on 6.6.
It would be better to split bio by dm_split_and_process_bio in dm level.
Considering the design of __max_io_len in dm.c, setting max_io_len for the
target is needed to make __max_io_len return a len <= max_sectors.

Signed-off-by: LongPing Wei <weilongping@oppo.com>
---
A potential case is:
f2fs submit a bio to zoned device with 1024KiB size, and the max sectors is 1024(512KiB).

ZWL of dm will just re-submit it to the lower device, then the bios will be splited into two bios.

They would be submitted to differect software queue as the context may run on different cpus.

If the previous one is on CPU0 and the later one is on CPU1, then the software queue of CPU1 dispatch the request before CPU0, the issue will be triggered.

CPU0:                     CPU1:
f2fs_submit_bio[task x]
dm_submit_bio[task x]
blk_mq_split_bios[task x]
submit_bio_noacct[task x]
                          submit_bio_noacct[task x]
                          dispatch requrest in queue[kworker1]
dispatch requrest in queue[kworker0]
---
 drivers/md/dm-crypt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 1ae2c71bb383..9b487ccb1ebc 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -3417,6 +3417,8 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 		 */
 		DMDEBUG("Zone append operations will be emulated");
 		ti->emulate_zone_append = true;
+		WARN_ON(dm_set_target_max_io_len(ti,
+			cc->dev->bdev->bd_queue->limits.chunk_sectors));
 	}
 
 	if (crypt_integrity_aead(cc) || cc->integrity_iv_size) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-12-11  2:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-25  5:58 [PATCH] dm-crypt: set max_io_len as chunk_sectors of zoned device 韦龙平(Groot)
2024-11-25  6:01 ` Christoph Hellwig
2024-11-25  6:07   ` Damien Le Moal
2024-11-25  6:11     ` Christoph Hellwig
2024-11-25  7:49       ` LongPing Wei
2024-12-10 16:20         ` Mike Snitzer
2024-12-11  2:00           ` LongPing Wei
2024-11-25  7:43   ` [PATCH] " LongPing Wei
2024-11-25  6:03 ` Damien Le Moal
  -- strict thread matches above, loose matches on Subject: below --
2024-11-25  3:22 LongPing Wei
2024-11-25  5:00 ` Christoph Hellwig
2024-11-25  6:02   ` Damien Le Moal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.