DMA Engine development
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
To: Daniel Byrne <daniel1.byrne@intel.com>
Cc: Vinod Koul <vkoul@kernel.org>,
	dmaengine@vger.kernel.org,
	Vinicius Costa Gomes <vinicius.gomes@intel.com>,
	Dave Jiang <dave.jiang@intel.com>, Frank Li <Frank.Li@kernel.org>,
	Fenghua Yu <fenghuay@nvidia.com>, Dan Williams <djbw@kernel.org>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2 07/10] dmaengine: idxd: don't sleep for a descriptor in the prep callbacks
Date: Thu, 3 Dec 2026 11:49:48 -0600	[thread overview]
Message-ID: <axGrvOtnNUNBW8Yt@SMW015318> (raw)
In-Reply-To: <20261130194721.1900266-8-daniel1.byrne@intel.com>

On Mon, Nov 30, 2026 at 11:47:18AM -0800, Daniel Byrne wrote:
> The dmaengine prep callbacks may be called from atomic context, and
> ntb_transport calls idxd's memcpy prep from its receive tasklet and from
> ndo_start_xmit. Both idxd prep callbacks allocate their descriptor with
> IDXD_OP_BLOCK, which sleeps on the sbitmap wait queue while every slot
> of the work queue is in flight, so a queue pair that outruns the work
> queue schedules in atomic context.
>
> Allocate with IDXD_OP_NONBLOCK and return NULL on an exhausted pool, as
> ioat, plx_dma and mv_xor do when their rings are full. ntb_transport
> falls back to a CPU copy. A polled client needs this as well. Only its
> own query frees a polled descriptor's slot, so a prep that slept for a
> slot while that client held the whole pool would wait on itself.
>
> Clients that can sleep and do not fall back see the change. dmatest
> reports a prep error, sleeps 100 ms and counts a failure when
> threads_per_chan exceeds the queue's descriptor count, which is the size
> of a dedicated queue and the threshold of a shared one. It can also do
> so with exactly as many threads as descriptors, when a thread that its
> callback woke prepares again before the interrupt thread has freed that
> callback's slot. ntb_perf sleeps 10 ms each time it overruns the pool,
> which caps its reported bandwidth at about the pool size times the chunk
> size per 10 ms. iaa_crypto allocates outside the prep callbacks and
> keeps the blocking allocation.
>
> Fixes: 8f47d1a5e545 ("dmaengine: idxd: connect idxd to dmaengine subsystem")
> Fixes: 2112b8f4fb5c ("dmaengine: idxd: add missing callback function to support DMA_INTERRUPT")
> Cc: stable@vger.kernel.org # 5.6+
> Signed-off-by: Daniel Byrne <daniel1.byrne@intel.com>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> New in v2 (was carried by v1 of the polled-status series).
>
>  drivers/dma/idxd/dma.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/idxd/dma.c b/drivers/dma/idxd/dma.c
> index c116416e10e5..2f68fdad3f16 100644
> --- a/drivers/dma/idxd/dma.c
> +++ b/drivers/dma/idxd/dma.c
> @@ -93,7 +93,8 @@ idxd_dma_prep_interrupt(struct dma_chan *c, unsigned long flags)
>  		return NULL;
>
>  	op_flag_setup(flags, &desc_flags);
> -	desc = idxd_alloc_desc(wq, IDXD_OP_BLOCK);
> +	/* Prep may run in atomic context: fail rather than wait for a slot. */
> +	desc = idxd_alloc_desc(wq, IDXD_OP_NONBLOCK);
>  	if (IS_ERR(desc))
>  		return NULL;
>
> @@ -120,7 +121,8 @@ idxd_dma_submit_memcpy(struct dma_chan *c, dma_addr_t dma_dest,
>  		return NULL;
>
>  	op_flag_setup(flags, &desc_flags);
> -	desc = idxd_alloc_desc(wq, IDXD_OP_BLOCK);
> +	/* Prep may run in atomic context: fail rather than wait for a slot. */
> +	desc = idxd_alloc_desc(wq, IDXD_OP_NONBLOCK);
>  	if (IS_ERR(desc))
>  		return NULL;
>
> --
> 2.43.0
>

  reply	other threads:[~2026-12-03 17:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 19:47 [PATCH v2 00/10] dmaengine: idxd: event log, cdev and prep fixes Daniel Byrne
2026-11-30 19:47 ` [PATCH v2 01/10] dmaengine: idxd: don't queue EVL fault work for kernel WQs Daniel Byrne
2026-12-03 17:47   ` Frank Li
2026-11-30 19:47 ` [PATCH v2 02/10] dmaengine: idxd: detach the user fault workqueue under the event log lock Daniel Byrne
2026-12-03 17:47   ` Frank Li
2026-11-30 19:47 ` [PATCH v2 03/10] dmaengine: idxd: free the event log fault item when no record is copied Daniel Byrne
2026-12-03 17:47   ` Frank Li
2026-11-30 19:47 ` [PATCH v2 04/10] dmaengine: idxd: refuse a memcpy longer than the WQ max transfer size Daniel Byrne
2026-12-03 17:48   ` Frank Li
2026-11-30 19:47 ` [PATCH v2 05/10] dmaengine: idxd: take an mm_users reference for the completion record copy Daniel Byrne
2026-12-03 17:49   ` Frank Li
2026-11-30 19:47 ` [PATCH v2 06/10] dmaengine: idxd: read GENCFG before clearing the event log enable Daniel Byrne
2026-12-03 17:49   ` Frank Li
2026-11-30 19:47 ` [PATCH v2 07/10] dmaengine: idxd: don't sleep for a descriptor in the prep callbacks Daniel Byrne
2026-12-03 17:49   ` Frank Li [this message]
2026-11-30 19:47 ` [PATCH v2 08/10] dmaengine: idxd: read the event log size under its lock in the setup Daniel Byrne
2026-12-03 17:50   ` Frank Li
2026-11-30 19:47 ` [PATCH v2 09/10] dmaengine: idxd: free the queue interrupt when the percpu_ref setup fails Daniel Byrne
2026-12-03 17:44   ` Frank Li
2026-11-30 19:47 ` [PATCH v2 10/10] dmaengine: idxd: test a queue under its lock before quiescing it Daniel Byrne
2026-11-30 20:09   ` sashiko-bot
2026-11-30 21:06     ` Daniel Byrne

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=axGrvOtnNUNBW8Yt@SMW015318 \
    --to=frank.li@oss.nxp.com \
    --cc=Frank.Li@kernel.org \
    --cc=daniel1.byrne@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=djbw@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=fenghuay@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=vinicius.gomes@intel.com \
    --cc=vkoul@kernel.org \
    /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