dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Pavel Begunkov <asml.silence@gmail.com>
Cc: <sashiko-reviews@lists.linux.dev>, <media-ci@linuxtv.org>,
	<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v6 01/13] dma-buf: introduce initial file I/O infrastructure
Date: Tue, 29 Sep 2026 23:54:32 -0700	[thread overview]
Message-ID: <aryyKMFpgK9JYQr0@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <17884261-52ab-484e-a39a-01e67f7a1d2e@gmail.com>

On Tue, Sep 22, 2026 at 10:08:38AM +0100, Pavel Begunkov wrote:
> On 9/21/26 14:53, sashiko-bot@kernel.org wrote:
> ...>>   }
> > [ ... ]
> > > +int dma_buf_io_init_map(struct dma_buf_io_ctx *ctx, struct dma_buf_io_map *map,
> > > +			struct sg_table *sgt)
> > > +{
> > > +	unsigned seg_shift = ~0U;
> > > +	struct scatterlist *sg;
> > > +	unsigned long tmp;
> > > +	int ret;
> > > +
> > > +	for_each_sgtable_dma_sg(sgt, sg, tmp)
> > > +		seg_shift = min(seg_shift, __ffs(sg_dma_len(sg)));
> > > +
> > > +	ret = percpu_ref_init(&map->refs, dma_buf_io_map_refs_release, 0,
> > > +			      GFP_KERNEL);
> > 
> > [Severity: High]
> > Does this GFP_KERNEL allocation violate DMA-buf locking rules?
> > 
> > dma_buf_io_create_map() calls ctx->dev_ops->map(ctx) while holding the
> > dmabuf->resv ww_mutex. If the driver then calls dma_buf_io_init_map() under
> > this lock, the GFP_KERNEL allocation could deadlock if memory reclaim
> > attempts to acquire dma_resv locks.
> 
> Most of these look trivial, going to fix them. This one, however,
> doesn't sound true AFAIU, I haven't heard about any blank ban on
> GFP_KERNEL allocation under resv lock.
> 

I can confirm this definitely not correct - see dma_resv_lockdep it
acquires dma_resv then fs_reclaim_acquire(GFP_KERNEL). Shrinker enter
direct reclaim and try to take dma-resv locks, but not block on the
lock.

Matt

> -- 
> Pavel Begunkov
> 

  reply	other threads:[~2026-09-30  6:54 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 13:38 [PATCH v6 00/13] Add dmabuf read/write via io_uring Pavel Begunkov
2026-09-21 13:38 ` [PATCH v6 01/13] dma-buf: introduce initial file I/O infrastructure Pavel Begunkov
2026-09-21 13:53   ` sashiko-bot
2026-09-22  9:08     ` Pavel Begunkov
2026-09-30  6:54       ` Matthew Brost [this message]
2026-09-30 10:03         ` Pavel Begunkov
2026-09-30  3:00   ` Matthew Brost
2026-09-30 10:08     ` Pavel Begunkov
2026-09-30 12:48       ` Pavel Begunkov
2026-09-30 19:43         ` Matthew Brost
2026-10-05 11:49           ` Pavel Begunkov
2026-09-21 13:38 ` [PATCH v6 02/13] iov_iter: add iterator type for dmabuf maps Pavel Begunkov
2026-09-21 13:53   ` sashiko-bot
2026-09-22  9:15     ` Pavel Begunkov
2026-09-21 13:38 ` [PATCH v6 03/13] block: always adjust bi_offset on bio_advance_iter Pavel Begunkov
2026-09-21 13:38 ` [PATCH v6 04/13] block: introduce dma map backed bio type Pavel Begunkov
     [not found]   ` <20260922131610.GA30468@lst.de>
2026-09-22 13:54     ` Pavel Begunkov
2026-09-21 13:38 ` [PATCH v6 05/13] block: add dma-buf support for raw bdev Pavel Begunkov
2026-09-21 13:50   ` sashiko-bot
2026-09-21 13:38 ` [PATCH v6 06/13] nvme-pci: implement dma-buf backed requests Pavel Begunkov
2026-09-21 13:58   ` sashiko-bot
     [not found]   ` <20260922132016.GA30684@lst.de>
2026-09-22 13:37     ` Pavel Begunkov
     [not found]       ` <20260923045505.GB26231@lst.de>
2026-09-24 15:53         ` Pavel Begunkov
2026-09-21 13:38 ` [PATCH v6 07/13] nvme-pci: rename nvme_pci_sgl_set_data to nvme_pci_dma_iter_set_sgl Pavel Begunkov
2026-09-21 13:38 ` [PATCH v6 08/13] nvme-pci: add SGL support for the dmabuf path Pavel Begunkov
2026-09-21 13:38 ` [PATCH v6 09/13] io_uring/rsrc: introduce buf registration structure Pavel Begunkov
2026-09-21 13:38 ` [PATCH v6 10/13] io_uring/rsrc: extend buffer update Pavel Begunkov
2026-09-21 13:38 ` [PATCH v6 11/13] io_uring/rsrc: add uncloneable regbuf flag Pavel Begunkov
2026-09-21 13:53   ` sashiko-bot
2026-09-21 13:38 ` [PATCH v6 12/13] io_uring/rsrc: add regbuf import flags Pavel Begunkov
2026-09-21 13:38 ` [PATCH v6 13/13] io_uring/rsrc: add dmabuf backed registered buffers Pavel Begunkov
2026-09-21 13:54   ` sashiko-bot

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=aryyKMFpgK9JYQr0@gsse-cloud1.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=asml.silence@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=media-ci@linuxtv.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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