Re: [RFC PATCH 2/3] dma-buf: add a warn-only mode to DMABUF_DEBUG

From: Jason Gunthorpe

Date: Fri Oct 09 2026 - 08:49:10 EST


On Mon, Oct 05, 2026 at 08:41:32AM +0200, Karl Mehltretter wrote:
> static inline struct page *sg_page(struct scatterlist *sg)
> {
> #ifdef CONFIG_DEBUG_SG
> BUG_ON(sg_is_chain(sg));
> #endif
> + sg_dmabuf_cpu_access_check(sg);
> return (struct page *)((sg)->page_link & ~SG_PAGE_LINK_MASK);
> }

I'm not sure I understand the overall intention here, I get what this
patch does, but no distro could turn this on by default when it
touches *everyone* using scatterlist in a performance sensitive spot,
and anyone doing testing can use the existing option - so what is the
point?

I certainly don't like this patch, and I don't like the word "DMABUF"
in the scatterlist at all. If we want to add something it should be a
general mechanism under DEBUG_SG that allows anyone to 'hide' the CPU
list from any future access.

Jason