From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Tudor.Ambarus@microchip.com
Cc: vkoul@kernel.org, Nicolas.Ferre@microchip.com,
linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org,
linux-kernel@vger.kernel.org, Ludovic.Desroches@microchip.com
Subject: Re: [PATCH v1 1/2] at_hdmac: check and return DMA_PAUSED status when suitable
Date: Tue, 8 Nov 2022 14:18:45 +0200 [thread overview]
Message-ID: <Y2pJJb6KwwcAMZw8@smile.fi.intel.com> (raw)
In-Reply-To: <d3d93452-70e6-72e5-b28e-1b259d1e489c@microchip.com>
On Tue, Nov 08, 2022 at 11:50:19AM +0000, Tudor.Ambarus@microchip.com wrote:
> On 11/8/22 09:49, Andy Shevchenko wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >
> > device_tx_status() may return DMA_PAUSED status when driver supports it.
>
> Yeah, but you haven't described the why. And that's because dma_cookie_status()
> currently considers just DMA_COMPLETE and DMA_IN_PROGRESS for the status of the
> cookie, so the controller drivers are forced to query the DMA_PAUSED state
> themselves.
At last without this change it's inconvenient and requires a lot of additional
(unneeded) code to be written by the caller. Moreover, it's racy. If you query
status twice in a raw, it may be well changed (for example from PAUSED to
IN_PROGRESS or COMPETE).
I will add a word summarizing this.
> Also, I noticed that Vinod prefers that you use the full paragraph in the commit
> message, and not a continuation of the patch title, so you may want to reword
> the commit message.
Yes, I will fix that.
...
> > + if (!txstate) {
> > + if (test_bit(ATC_IS_PAUSED, &atchan->status))
>
> there's a helper function that you can use instead: atc_chan_is_paused()
Will use it.
> > + return DMA_PAUSED;
> > + return DMA_ERROR;
>
> return dma_status please
Will squash the patch.
> > + }
...
> > + if (test_bit(ATC_IS_PAUSED, &atchan->status))
>
> The status may change after spin_unlock_irqrestore(). Should the residue
> be in sync with the dma status? If yes, you should check the status while
> holding the lock.
You should tell me actually. Because I'm a bit puzzled why we need a spin lock
_and_ atomic bit operations together.
> > + dma_status = DMA_PAUSED;
...
Thank you for the review.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2022-11-08 12:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-08 7:49 [PATCH v1 1/2] at_hdmac: check and return DMA_PAUSED status when suitable Andy Shevchenko
2022-11-08 7:49 ` [PATCH v1 2/2] at_hdmac: return actual status when txstatus parameter is NULL Andy Shevchenko
2022-11-08 11:51 ` Tudor.Ambarus
2022-11-08 11:50 ` [PATCH v1 1/2] at_hdmac: check and return DMA_PAUSED status when suitable Tudor.Ambarus
2022-11-08 12:18 ` Andy Shevchenko [this message]
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=Y2pJJb6KwwcAMZw8@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=Ludovic.Desroches@microchip.com \
--cc=Nicolas.Ferre@microchip.com \
--cc=Tudor.Ambarus@microchip.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--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