mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Logan Gunthorpe <logang@deltatee.com>
To: Hao-Qun Huang <alvinhuang0603@gmail.com>,
	Kelvin Cao <kelvin.cao@microchip.com>
Cc: Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
	George Ge <george.ge@microchip.com>,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dmaengine: switchtec-dma: preserve results for out-of-order completions
Date: Mon, 20 Jul 2026 09:48:37 -0600	[thread overview]
Message-ID: <fdb895ea-0c82-4569-b842-3f326a262059@deltatee.com> (raw)
In-Reply-To: <20260718223257.5662.alvinhuang0603@gmail.com>



On 2026-07-18 08:32, Hao-Qun Huang wrote:
> Switchtec completion entries can arrive out of submission order, and the
> driver handles that by marking the descriptor complete and deferring its
> callback until the ring tail catches up.  The problem is that the
> per-transfer result (status and residue) is only kept in a stack variable
> while the completion entry is being read.  Once the tail gap closes,
> cleanup retires the descriptor at the tail along with any already
> completed descriptors behind it, and hands the same stack result to every
> one of them.
> 
> So a transfer that failed out of order can be reported as successful (or
> the other way round) depending on which completion happened to close the
> gap, and the residue can end up coming from the wrong transfer too.
> 
> Keep the result in each descriptor instead of on the stack, and pass the
> descriptor's own saved result when it is retired.  Cookie ordering, the
> CID-to-descriptor mapping and the completion locking are unchanged; only
> the result handed to each callback is corrected.
> 
> Fixes: 30eba9df76ad ("dmaengine: switchtec-dma: Implement hardware initialization and cleanup")
> Assisted-by: Claude:claude-fable-5
> Signed-off-by: Hao-Qun Huang <alvinhuang0603@gmail.com>
This appears correct to me:

Reviewed-by: Logan Gunthorpe <logang@deltatee.com>

Thanks!

Logan

  reply	other threads:[~2026-07-20 15:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-18 14:32 Hao-Qun Huang
2026-07-20 15:48 ` Logan Gunthorpe [this message]
2026-10-16 16:08 ` Frank Li

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=fdb895ea-0c82-4569-b842-3f326a262059@deltatee.com \
    --to=logang@deltatee.com \
    --cc=Frank.Li@kernel.org \
    --cc=alvinhuang0603@gmail.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=george.ge@microchip.com \
    --cc=kelvin.cao@microchip.com \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®