mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "yitian" <yitian.bu@tangramtek.com>
To: <vireshk@kernel.org>, <andriy.shevchenko@linux.intel.com>,
	<vinod.koul@intel.com>, <dan.j.williams@intel.com>
Cc: <dmaengine@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/1] dmaengine: dw: resolve recursion lock when audio playback
Date: Sat, 26 Sep 2015 20:38:47 +0800	[thread overview]
Message-ID: <025c01d0f858$4d19c790$e74d56b0$@tangramtek.com> (raw)

when audio playback is running, user space will call
snd_pcm_lib_write1() function, it will first get pcm stream lock,
after that it may call function snd_pcm_update_hw_ptr(), the call
stack will be as below:
  snd_pcm_lib_write1  <-- got pcm stream lock
   --> snd_pcm_update_hw_ptr
     --> dwc_tx_status
      --> dwc_scan_descriptors
       --> callback
        --> dmaengine_pcm_dma_complete
         --> snd_pcm_period_elapsed <-- get stream lock again
recursion lock occurs in snd_pcm_period_elapsed function.
remove dwc_scan_descriptors from dwc_tx_status can fix this issue.

Signed-off-by: Yitian Bu <yitian.bu@tangramtek.com>
---
 drivers/dma/dw/core.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
index cf1c87f..5341b44 100644
--- a/drivers/dma/dw/core.c
+++ b/drivers/dma/dw/core.c
@@ -1078,11 +1078,7 @@ dwc_tx_status(struct dma_chan *chan,
 	ret = dma_cookie_status(chan, cookie, txstate);
 	if (ret == DMA_COMPLETE)
 		return ret;
-
-	dwc_scan_descriptors(to_dw_dma(chan->device), dwc);
-
-	ret = dma_cookie_status(chan, cookie, txstate);
-	if (ret != DMA_COMPLETE)
+	else
 		dma_set_residue(txstate, dwc_get_residue(dwc));
 
 	if (dwc->paused && ret == DMA_IN_PROGRESS)
-- 
1.7.12.4



Yitian
Best Regards





             reply	other threads:[~2015-09-26 12:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-26 12:38 yitian [this message]
2015-09-28  3:23 ` Viresh Kumar
2015-09-28  7:05   ` Andy Shevchenko
2015-09-28  7:23     ` yitian
2015-09-28  8:46       ` Andy Shevchenko
2015-09-28  9:14         ` yitian

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='025c01d0f858$4d19c790$e74d56b0$@tangramtek.com' \
    --to=yitian.bu@tangramtek.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vinod.koul@intel.com \
    --cc=vireshk@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

Powered by JetHome