Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.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,
	Frank Li <Frank.Li@nxp.com>
Subject: Re: [PATCH v2 04/10] dmaengine: idxd: refuse a memcpy longer than the WQ max transfer size
Date: Thu, 3 Dec 2026 11:48:46 -0600	[thread overview]
Message-ID: <axGrfhjZ3tUwQ_JI@SMW015318> (raw)
In-Reply-To: <20261130194721.1900266-5-daniel1.byrne@intel.com>

On Mon, Nov 30, 2026 at 11:47:15AM -0800, Daniel Byrne wrote:
> idxd_dma_submit_memcpy() checks the length only against the device limit
> from GENCAP. Since commit d7aad5550eca ("dmaengine: idxd: add support
> for configurable max wq xfer size"), WQCFG is programmed with the work
> queue's own max_transfer_size instead, and that is the limit the
> hardware enforces. Since commit 92452a72ebdf ("dmaengine: idxd: set
> defaults for wq configs"), that limit defaults to 2 MiB.
>
> A copy longer than the work queue's limit is therefore accepted at prep
> time and then fails in hardware with DSA_COMP_XFER_ERANGE. A client that
> sets only tx->callback cannot see that error, so the copy looks
> complete. Also check the work queue's limit, so that prep returns NULL
> and the caller can fall back.
>
> On Granite Rapids DSA 2.0 with the default 2 MiB work queue limit and a
> device limit of 2 GiB, dmatest with norandom=1 and test_buf_size=4194304
> reports a data error for every copy on v7.2. The destination is never
> written, yet each copy completes. With this change the same test fails
> at prep, and copies of 1 MiB and 2 MiB pass as before.
>
> Fixes: d7aad5550eca ("dmaengine: idxd: add support for configurable max wq xfer size")
> Cc: stable@vger.kernel.org # 5.10+
> Signed-off-by: Daniel Byrne <daniel1.byrne@intel.com>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>

when respin, put your s-of-b last.

Frank

> ---
> v2: code unchanged; Reviewed-by from Frank Li added; the message names
> the test device as Granite Rapids DSA 2.0.
>
>  drivers/dma/idxd/dma.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/idxd/dma.c b/drivers/dma/idxd/dma.c
> index 9937b671f637..c116416e10e5 100644
> --- a/drivers/dma/idxd/dma.c
> +++ b/drivers/dma/idxd/dma.c
> @@ -115,7 +115,8 @@ idxd_dma_submit_memcpy(struct dma_chan *c, dma_addr_t dma_dest,
>  	if (wq->state != IDXD_WQ_ENABLED)
>  		return NULL;
>
> -	if (len > idxd->max_xfer_bytes)
> +	/* The work queue's configured limit is what the hardware enforces. */
> +	if (len > idxd->max_xfer_bytes || len > wq->max_xfer_bytes)
>  		return NULL;
>
>  	op_flag_setup(flags, &desc_flags);
> --
> 2.43.0
>

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

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261130194721.1900266-1-daniel1.byrne@intel.com>
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 [this message]
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
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

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=axGrfhjZ3tUwQ_JI@SMW015318 \
    --to=frank.li@oss.nxp.com \
    --cc=Frank.Li@kernel.org \
    --cc=Frank.Li@nxp.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