Re: [PATCH 6.6.y v2 1/1] block: Fix bounce check logic in blk_queue_may_bounce()

From: Hardeep Sharma
Date: Thu Aug 14 2025 - 07:00:05 EST




On 8/14/2025 2:33 PM, Greg KH wrote:
On Thu, Aug 14, 2025 at 12:06:55PM +0530, Hardeep Sharma wrote:
Buffer bouncing is needed only when memory exists above the lowmem region,
i.e., when max_low_pfn < max_pfn. The previous check (max_low_pfn >=
max_pfn) was inverted and prevented bouncing when it could actually be
required.

Note that bouncing depends on CONFIG_HIGHMEM, which is typically enabled
on 32-bit ARM where not all memory is permanently mapped into the kernel’s
lowmem region.

Branch-Specific Note:

This fix is specific to this branch (6.6.y) only.
In the upstream “tip” kernel, bounce buffer support for highmem pages
was completely removed after kernel version 6.12. Therefore, this
modification is not possible or relevant in the tip branch.

Fixes: 9bb33f24abbd0 ("block: refactor the bounce buffering code")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Hardeep Sharma <quic_hardshar@xxxxxxxxxxx>

Why do you say this is only for 6.6.y, yet your Fixes: line is older
than that?
[Hardeep Sharma]::

Yes, the original commit was merged in kernel 5.13-rc1, as indicated by the Fixes: line. However, we are currently working with kernel 6.6, where we encountered the issue. While it could be merged into 6.12 and then backported to earlier versions, our focus is on addressing it in 6.6.y, where the problem was observed.


And why wasn't this ever found or noticed before?
[Hardeep Sharma] ::

This issue remained unnoticed likely because the bounce buffering logic is only triggered under specific hardware and configuration conditions—primarily on 32-bit ARM systems with CONFIG_HIGHMEM enabled and devices requiring DMA from lowmem. Many platforms either do not use highmem or have hardware that does not require bounce buffering, so the bug did not manifest widely.


Also, why can't we just remove all of the bounce buffering code in this
older kernel tree? What is wrong with doing that instead?

[Hardeep Sharma]::

it's too intrusive — I'd need to backport 40+ dependency patches, and I'm unsure about the instability this might introduce in block layer on kernel 6.6. Plus, we don't know if it'll work reliably on 32-bit with 1GB+ DDR and highmem enabled. So I'd prefer to push just this single tested patch on kernel 6.6 and older affected versions.

Removing bounce buffering code from older kernel trees is not feasible for all use cases. Some legacy platforms and drivers still rely on bounce buffering to support DMA operations with highmem pages, especially on 32-bit systems.


And finally, how was this tested?

[Hardeep Sharma]:

The patch was tested on a 32-bit ARM platform with CONFIG_HIGHMEM enabled and a storage device requiring DMA from lowmem.>
thanks,

greg k-h