Skip to content

block: let a stacking device inherit its members' DMA alignment - #1487

Open
ghost wants to merge 1 commit into
linus-master_basefrom
series/1191479=>linus-master
Open

ghost wants to merge 1 commit into
linus-master_basefrom
series/1191479=>linus-master

Conversation

@ghost

@ghost ghost commented Oct 22, 2026

Copy link
Copy Markdown

Pull request for series with
subject: block: let a stacking device inherit its members' DMA alignment
version: 1
url: https://patchwork.kernel.org/series/1191479/

@ghost

ghost commented Oct 22, 2026

Copy link
Copy Markdown
Author

Upstream branch: 7be4bc5
series: https://patchwork.kernel.org/series/1191479/
version: 1

@ghost
ghost force-pushed the linus-master_base branch from 435b194 to fd67522 Compare October 24, 2026 03:36
@ghost

ghost commented Oct 24, 2026

Copy link
Copy Markdown
Author

Upstream branch: 17bb0e2
series: https://patchwork.kernel.org/series/1191479/
version: 1

@ghost
ghost force-pushed the series/1191479=>linus-master branch from 5cedb41 to 569a027 Compare October 24, 2026 03:43
@ghost ghost added the V1-ci-pass label Oct 24, 2026
@ghost
ghost force-pushed the linus-master_base branch from fd67522 to 3b53a63 Compare October 26, 2026 01:52
@ghost

ghost commented Oct 26, 2026

Copy link
Copy Markdown
Author

Upstream branch: 21a7f44
series: https://patchwork.kernel.org/series/1191479/
version: 1

@ghost
ghost force-pushed the series/1191479=>linus-master branch from 569a027 to 1f2b784 Compare October 26, 2026 02:09
@ghost
ghost force-pushed the linus-master_base branch from 3b53a63 to 5d84576 Compare October 26, 2026 07:01
@ghost

ghost commented Oct 26, 2026

Copy link
Copy Markdown
Author

Upstream branch: 6b4b543
series: https://patchwork.kernel.org/series/1191479/
version: 1

@ghost
ghost force-pushed the series/1191479=>linus-master branch from 1f2b784 to 1b945ac Compare October 26, 2026 07:15
@ghost
ghost force-pushed the linus-master_base branch from 5d84576 to 6582ed2 Compare October 26, 2026 18:11
@ghost

ghost commented Oct 26, 2026

Copy link
Copy Markdown
Author

Upstream branch: fb2c3f4
series: https://patchwork.kernel.org/series/1191479/
version: 1

@ghost
ghost force-pushed the series/1191479=>linus-master branch from 1b945ac to 62acbb2 Compare October 26, 2026 18:19
@ghost
ghost force-pushed the linus-master_base branch from 6582ed2 to b3a1abc Compare October 26, 2026 23:55
@ghost

ghost commented Oct 27, 2026

Copy link
Copy Markdown
Author

Upstream branch: d135ab4
series: https://patchwork.kernel.org/series/1191479/
version: 1

@ghost
ghost force-pushed the series/1191479=>linus-master branch from 62acbb2 to 1c189ac Compare October 27, 2026 00:03
@ghost
ghost force-pushed the linus-master_base branch from b3a1abc to 712496f Compare October 28, 2026 23:34
@ghost

ghost commented Oct 28, 2026

Copy link
Copy Markdown
Author

Upstream branch: c339f40
series: https://patchwork.kernel.org/series/1191479/
version: 1

@ghost
ghost force-pushed the series/1191479=>linus-master branch from 1c189ac to b1e59c3 Compare October 28, 2026 23:42
@ghost
ghost force-pushed the linus-master_base branch from 712496f to a186880 Compare October 30, 2026 13:52
@ghost

ghost commented Oct 30, 2026

Copy link
Copy Markdown
Author

Upstream branch: d89e1d1
series: https://patchwork.kernel.org/series/1191479/
version: 1

@ghost
ghost force-pushed the series/1191479=>linus-master branch from b1e59c3 to ea8909f Compare October 30, 2026 14:12
@ghost
ghost force-pushed the linus-master_base branch from a186880 to 46206a3 Compare November 2, 2026 17:14
@ghost

ghost commented Nov 2, 2026

Copy link
Copy Markdown
Author

Upstream branch: 6628e7d
series: https://patchwork.kernel.org/series/1191479/
version: 1

@ghost
ghost force-pushed the series/1191479=>linus-master branch from ea8909f to 5b91e57 Compare November 2, 2026 17:51
@ghost
ghost force-pushed the linus-master_base branch from 46206a3 to 220bd96 Compare November 3, 2026 23:41
@ghost

ghost commented Nov 4, 2026

Copy link
Copy Markdown
Author

Upstream branch: 05441d6
series: https://patchwork.kernel.org/series/1191479/
version: 1

@ghost
ghost force-pushed the series/1191479=>linus-master branch from 5b91e57 to 95b5164 Compare November 4, 2026 00:05
@ghost
ghost force-pushed the linus-master_base branch from 220bd96 to 6c4625e Compare November 6, 2026 08:02
@ghost

ghost commented Nov 6, 2026

Copy link
Copy Markdown
Author

Upstream branch: f66469d
series: https://patchwork.kernel.org/series/1191479/
version: 1

@ghost
ghost force-pushed the series/1191479=>linus-master branch from 95b5164 to e1f51b4 Compare November 6, 2026 08:45
@ghost
ghost force-pushed the linus-master_base branch from 6c4625e to c7f678d Compare November 7, 2026 03:08
@ghost

ghost commented Nov 7, 2026

Copy link
Copy Markdown
Author

Upstream branch: d487237
series: https://patchwork.kernel.org/series/1191479/
version: 1

@ghost
ghost force-pushed the series/1191479=>linus-master branch from e1f51b4 to 541143a Compare November 7, 2026 03:42
@ghost
ghost force-pushed the linus-master_base branch from c7f678d to 6aa6cd1 Compare November 10, 2026 07:53
On Thu, Jul 09, 2026 at 09:15:17AM -0700, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
>
> All device mappers that want to override the dma_alignment do so.
> However, because the default stacking limit is set to 511, a device
> mapper couldn't make it smaller even if it is capable of handling
> finer grained alignment.
>
> Set the default dm stacking dma_alignment limit to 0 so that it can be
> stacked with any value a device mapper wants. If a mapper doesn't
> override the value, the initial 0 value will get changed to the original
> default 511 value when the limits are validated after the device
> stacking is complete.
>
> Signed-off-by: Keith Busch <kbusch@kernel.org>
> ---
>  drivers/md/dm-table.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
> index dc2eff6..80326f8096cb7 100644
> --- a/drivers/md/dm-table.c
> +++ b/drivers/md/dm-table.c
> @@ -591,6 +591,7 @@ static void dm_set_stacking_limits(struct queue_limits *limits)
>  {
>  	blk_set_stacking_limits(limits);
>  	limits->features |= BLK_FEAT_IO_STAT | BLK_FEAT_NOWAIT | BLK_FEAT_POLL;
> +	limits->dma_alignment = 0;
>  }
>
>  /*
> --
> 2.52.0
>

This isn't a DM-specific concern (just happens to be that you're
focused on dm-crypt in this patchset).  dm-crypt is still imposing a
too strict dma_alignment, and so that'll need fixing too (along with
other DM targets that aren't properly considering the underlying
devices' queue_limits provided dma_alignment).

But this is a proper fix that I needed to allow MD RAID0 to allow
O_DIRECT to NVMe devices beneath the MD device:

From: Mike Snitzer <snitzer@kernel.org>
Date: Fri, 9 Oct 2026 06:26:29 -0600
Subject: [PATCH] block: let a stacking device inherit its members' DMA alignment

blk_set_stacking_limits() initializes dma_alignment to SECTOR_SIZE - 1,
and blk_stack_limits() then takes the maximum of that and each member's
value.  As a result every MD array and device-mapper table requires
512-byte aligned memory regardless of what its members need: a raid0
of NVMe namespaces reports a dma_alignment of 511 while each member
reports 3.

Direct I/O from memory every member accepts is therefore rejected at
the stacking device, and callers that check the advertised alignment
(for instance through STATX_DIOALIGN) fall back to buffered I/O.

Leave dma_alignment at zero in blk_set_stacking_limits() so that the
stacked value is the strictest of the members'.  blk_validate_limits()
still applies the SECTOR_SIZE - 1 default when nothing was stacked,
such as for a table with no devices.  Targets that process the data
themselves and need logical-block-aligned memory already set
dma_alignment in their io_hints (dm-crypt, dm-integrity, dm-verity,
dm-log-writes), and NVMe multipath sets its own.

Assisted-by: LLM
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
@ghost

ghost commented Nov 10, 2026

Copy link
Copy Markdown
Author

Upstream branch: b3dfbde
series: https://patchwork.kernel.org/series/1191479/
version: 1

@ghost
ghost force-pushed the series/1191479=>linus-master branch from 541143a to 8481b31 Compare November 10, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants