mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: James Hilliard <james.hilliard1@gmail.com>
Cc: "Viresh Kumar" <vireshk@kernel.org>,
	"Vinod Koul" <vkoul@kernel.org>, "Frank Li" <Frank.Li@kernel.org>,
	"Dan Williams" <djbw@kernel.org>,
	"Serge Semin" <fancer.lancer@gmail.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	dmaengine@vger.kernel.org, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org, Sashiko <sashiko-bot@kernel.org>,
	"Lars-Peter Clausen" <lars@metafoo.de>
Subject: Re: [PATCH v10 4/7] dmaengine: dw: use virt-dma for descriptor and callback ownership
Date: Thu, 19 Nov 2026 12:29:32 +0200	[thread overview]
Message-ID: <av7PjEXWiWpp1LR6@ashevche-desk.local> (raw)
In-Reply-To: <20261119-submit-dw-dma-synchronize-v1-v10-4-3a737597a0d1@gmail.com>

On Thu, Nov 19, 2026 at 03:01:38AM -0700, James Hilliard wrote:
> The status getter can invoke a client's completion callback while polling
> the hardware. An 8250 RX timeout calls it with the port lock held, and the
> callback takes that same lock. Termination also lacks a synchronization
> hook to wait for callbacks already detached from the channel's queues.
> 
> Use virt-dma for transaction queues, cookie completion and callback
> delivery. Keep the active transaction and hardware state under vc.lock.
> Polling still processes RAW.XFER and advances software-LLP blocks, so
> clients such as catpt can complete transfers with the controller interrupt
> masked. Client callbacks run only from the per-channel virt-dma tasklet.
> 
> An 8250 RX timeout consumes the transfer length minus the reported
> residue. On a bus error, source reads do not establish how many bytes
> reached the destination. Credit only whole blocks whose completion the
> driver observed while advancing a software-linked transfer. For a
> hardware-linked transfer, treat the whole buffer as unconfirmed.
> 
> Report the abort and the same residue to result callbacks and status
> pollers, even after another transfer completes. Reserve the error record
> during preparation, when clients can still handle allocation failure.
> Use the normal virt-dma submission path; neither submission nor fault
> reporting needs to allocate. Keep only failed cookies after descriptor
> release, until the cookie is reused or the channel is released.
> 
> Submit only the first block of each transaction to virt-dma. Its child
> LLIs remain on the driver's hardware-chain list and are freed together
> after the callback returns. Keep the controller tasklet for hardware
> event processing and error recovery.
> 
> Complete cookies under vc.lock before handing descriptors to the callback
> tasklet. Complete terminated cookies in submission order without invoking
> their callbacks, so a concurrent termination cannot advance the completed
> cookie past an older completion that later moves it backwards. Newly
> submitted transactions become eligible to start when issue_pending()
> moves them to the issued queue.
> 
> Implement device_synchronize with vchan_synchronize(), which drains only
> the selected channel's callbacks. DMAengine calls it before releasing
> channel resources. Exclude the controller tasklet while clearing channel
> configuration and powering down, and let a pending run return without
> register access after the last channel has been released.
> 
> This implements the callback deferral proposed by Serge Semin using the
> shared infrastructure suggested by Andy Shevchenko.

...

> Link: https://lore.kernel.org/r/20240911184710.4207-3-fancer.lancer@gmail.com
> Link: https://lore.kernel.org/r/avrHOJ-fVZOO32bI@ashevche-desk.local

Same issue. And I think I have told you about it a few times before.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-11-19 10:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 10:01 [PATCH v10 0/7] dmaengine: dw: serialize completion and termination James Hilliard
2026-11-19 10:01 ` [PATCH v10 1/7] dmaengine: dw: Fix XFER bit set, but channel not idle error James Hilliard
2026-11-19 10:01 ` [PATCH v10 2/7] dmaengine: dw: serialize error recovery with channel termination James Hilliard
2026-11-19 10:01 ` [PATCH v10 3/7] dmaengine: dw: embed a virt-dma channel James Hilliard
2026-11-19 10:25   ` Andy Shevchenko
2026-11-19 10:01 ` [PATCH v10 4/7] dmaengine: dw: use virt-dma for descriptor and callback ownership James Hilliard
2026-11-19 10:29   ` Andy Shevchenko [this message]
2026-11-19 10:01 ` [PATCH v10 5/7] dmaengine: dw: extract hardware-LLP residue calculation James Hilliard
2026-11-19 10:01 ` [PATCH v10 6/7] dmaengine: dw: calculate residue in the status getter James Hilliard
2026-11-19 10:01 ` [PATCH v10 7/7] dmaengine: dw: report residue for queued transfers James Hilliard

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=av7PjEXWiWpp1LR6@ashevche-desk.local \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Frank.Li@kernel.org \
    --cc=djbw@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=fancer.lancer@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=james.hilliard1@gmail.com \
    --cc=jirislaby@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=sashiko-bot@kernel.org \
    --cc=vireshk@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®