From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@gmail.com>
Cc: dmaengine@vger.kernel.org, linux-sh@vger.kernel.org,
Magnus Damm <magnus.damm@gmail.com>,
Linux-ALSA <alsa-devel@alsa-project.org>
Subject: Re: [PATCH/RFC 0/5] R-Car Gen2 DMAC hardware descriptor list support
Date: Wed, 23 Jul 2014 10:28:47 +0000 [thread overview]
Message-ID: <3361994.F0HgAeJkR9@avalon> (raw)
In-Reply-To: <87d2cwvmxa.wl%kuninori.morimoto.gx@gmail.com>
Hi Morimoto-san,
On Tuesday 22 July 2014 19:17:23 Kuninori Morimoto wrote:
> Hi Laurent
>
> > The code has been tested by artificially lowering the maximum chunk size
> > to 4096 bytes and running dmatest, which completed sucessfully. Morimoto-
> > san, is there an easy way to test cyclic transfers with your audio driver
> > ?
>
> Thank you for your offer.
> I tested this patchset with audio DMAC (= cyclic transfer)
> but, it doesn't work for me.
>
> First of all, this sound driver which is using cyclic transfer
> was worked well in shdma-base driver.
> I had sent audio DMA support plafrom side patches before.
> But, of course I'm happy to update sound driver side.
>
> I will re-send my audio DMAC support patches after this email.
>
> My troubles are...
[snip]
> 2. cyclic transfer doesn't work
>
> I got attached error.
[snip]
I can reproduce that, but I have this error coming up before.
[ 16.207027] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:103
[ 16.215795] in_atomic(): 1, irqs_disabled(): 128, pid: 1319, name: aplay
[ 16.222636] CPU: 0 PID: 1319 Comm: aplay Not tainted 3.16.0-rc5-02821-g12a72a3 #2501
[ 16.230536] Backtrace:
[ 16.233056] [<c00121e4>] (dump_backtrace) from [<c0012598>] (show_stack+0x18/0x1c)
[ 16.240778] r6:ffffffff r5:c04aa7c0 r4:00000000 r3:00000000
[ 16.246593] [<c0012580>] (show_stack) from [<c032ea84>] (dump_stack+0x8c/0xc0)
[ 16.253967] [<c032e9f8>] (dump_stack) from [<c0049e98>] (__might_sleep+0xcc/0x108)
[ 16.261689] r4:e8dd2000 r3:00000093
[ 16.265357] [<c0049dcc>] (__might_sleep) from [<c0332134>] (mutex_lock+0x20/0x70)
[ 16.272990] r5:00000000 r4:e900fe00
[ 16.276657] [<c0332114>] (mutex_lock) from [<c01fa4dc>] (regmap_lock_mutex+0x10/0x14)
[ 16.284644] r4:e900fe00 r3:00000000
[ 16.288309] [<c01fa4cc>] (regmap_lock_mutex) from [<c01fb9dc>] (regmap_update_bits+0x2c/0x64)
[ 16.297009] [<c01fb9b0>] (regmap_update_bits) from [<c01fba90>] (regmap_fields_write+0x38/0x44)
[ 16.305883] r7:e8d9d990 r6:00000004 r5:00000040 r4:f0368200
[ 16.311701] [<c01fba58>] (regmap_fields_write) from [<bf0ec280>] (rsnd_write+0x30/0x4c [snd_soc_rcar])
[ 16.321195] r5:e93a4c00 r4:e8d1f898
[ 16.324866] [<bf0ec250>] (rsnd_write [snd_soc_rcar]) from [<bf0ec884>] (rsnd_src_set_convert_rate.isra.6+0xf8/0x144 [snd_soc_rcar])
[ 16.336940] [<bf0ec78c>] (rsnd_src_set_convert_rate.isra.6 [snd_soc_rcar]) from [<bf0ec8fc>] (rsnd_src_init_gen2+0x2c/0xc4 [snd_soc_rcar])
[ 16.349624] r6:00000004 r5:e8d9d810 r4:e8d1f898 r3:bf0ec8d0
[ 16.355438] [<bf0ec8d0>] (rsnd_src_init_gen2 [snd_soc_rcar]) from [<bf0ea640>] (rsnd_soc_dai_trigger+0x1cc/0x22c [snd_soc_rcar])
[ 16.367236] r5:e8d9d810 r4:e8d9d824
[ 16.370916] [<bf0ea474>] (rsnd_soc_dai_trigger [snd_soc_rcar]) from [<bf0c51ec>] (soc_pcm_trigger+0xa8/0xf8 [snd_soc_core])
[ 16.382271] r10:00002000 r9:00002000 r8:e9290d00 r7:e8d9d700 r6:00000001 r5:e99fb500
[ 16.390301] r4:e8ef3810
[ 16.392910] [<bf0c5144>] (soc_pcm_trigger [snd_soc_core]) from [<bf094704>] (snd_pcm_do_start+0x34/0x38 [snd_pcm])
[ 16.403467] r8:bf09e050 r7:00000000 r6:00000003 r5:e99fb500 r4:bf09e050 r3:bf0c5144
[ 16.411421] [<bf0946d0>] (snd_pcm_do_start [snd_pcm]) from [<bf0941f8>] (snd_pcm_action_single+0x40/0x80 [snd_pcm])
[ 16.422079] [<bf0941b8>] (snd_pcm_action_single [snd_pcm]) from [<bf09443c>] (snd_pcm_action+0xcc/0xd0 [snd_pcm])
[ 16.432547] r7:00000003 r6:e99fb5c8 r5:bf09e4c0 r4:e99fb500
[ 16.438366] [<bf094370>] (snd_pcm_action [snd_pcm]) from [<bf097098>] (snd_pcm_start+0x1c/0x24 [snd_pcm])
[ 16.448125] r8:00000000 r7:e8dd2000 r6:e93a4c00 r5:bf09e4c0 r4:e99fb500 r3:00002000
[ 16.456083] [<bf09707c>] (snd_pcm_start [snd_pcm]) from [<bf09b094>] (snd_pcm_lib_write1+0x40c/0x4f0 [snd_pcm])
[ 16.466391] [<bf09ac88>] (snd_pcm_lib_write1 [snd_pcm]) from [<bf09b244>] (snd_pcm_lib_write+0x64/0x78 [snd_pcm])
[ 16.476860] r10:be91ea4c r9:e8dd2000 r8:e8d66488 r7:00000000 r6:0002c780 r5:00000800
[ 16.484889] r4:e99fb500
[ 16.487494] [<bf09b1e0>] (snd_pcm_lib_write [snd_pcm]) from [<bf096c38>] (snd_pcm_playback_ioctl1+0x134/0x4c8 [snd_pcm])
[ 16.498583] r6:00000000 r5:be91ea4c r4:e99fb500
[ 16.503330] [<bf096b04>] (snd_pcm_playback_ioctl1 [snd_pcm]) from [<bf096ffc>] (snd_pcm_playback_ioctl+0x30/0x3c [snd_pcm])
[ 16.514685] r8:e8d66488 r7:be91ea4c r6:00000004 r5:e93d3880 r4:e93d3880
[ 16.521575] [<bf096fcc>] (snd_pcm_playback_ioctl [snd_pcm]) from [<c00d7c10>] (do_vfs_ioctl+0x80/0x5c8)
[ 16.531163] [<c00d7b90>] (do_vfs_ioctl) from [<c00d8194>] (SyS_ioctl+0x3c/0x60)
[ 16.538618] r10:00000000 r9:e8dd2000 r8:00000004 r7:be91ea4c r6:400c4150 r5:e93d3880
[ 16.546648] r4:e93d3880
[ 16.549243] [<c00d8158>] (SyS_ioctl) from [<c000f8a0>] (ret_fast_syscall+0x0/0x30)
[ 16.556964] r8:c000fa24 r7:00000036 r6:00000000 r5:0002c498 r4:0002c448 r3:be91ea4c
The rsnd_soc_dai_trigger() function takes a spinlock, making the context
atomic, which regmap doesn't like as it locks a mutex.
It might be possible to fix this by setting the fast_io field in both the
regmap_config and regmap_bus structures in sound/soc/sh/rcar/gen.c. regmap
will then use a spinlock instead of a mutex. However, even if I believe that
change makes sense and should be done, another atomic context issue will come
from the rcar-dmac driver which allocates memory in the prep_dma_cyclic
function, called by rsnd_dma_start() from rsnd_soc_dai_trigger() with the
spinlock help.
What context is the rsnd_soc_dai_trigger() function called in by the alsa
core ? If it's guaranteed to be a sleepable context, would it make sense to
replace the rsnd_priv spinlock with a mutex ?
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2014-07-23 10:28 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-22 12:33 [PATCH/RFC 0/5] R-Car Gen2 DMAC hardware descriptor list support Laurent Pinchart
2014-07-23 2:17 ` Kuninori Morimoto
2014-07-23 10:28 ` Laurent Pinchart [this message]
2014-07-23 11:07 ` DMA engine API issue (was: [PATCH/RFC 0/5] R-Car Gen2 DMAC hardware descriptor list support) Laurent Pinchart
2014-07-24 0:46 ` Kuninori Morimoto
2014-07-24 1:35 ` Kuninori Morimoto
2014-07-24 4:59 ` Vinod Koul
2014-07-24 4:58 ` Vinod Koul
2014-08-01 8:51 ` Laurent Pinchart
2014-08-01 14:30 ` Russell King - ARM Linux
2014-08-01 17:21 ` Vinod Koul
2014-08-04 13:47 ` Geert Uytterhoeven
2014-08-04 17:00 ` Laurent Pinchart
2014-08-04 17:54 ` Russell King - ARM Linux
2014-08-05 23:19 ` Laurent Pinchart
2014-08-06 7:17 ` Geert Uytterhoeven
2014-08-06 11:04 ` Arnd Bergmann
2014-08-01 17:19 ` Vinod Koul
2014-08-04 16:50 ` Laurent Pinchart
2014-08-04 18:03 ` DMA engine API issue Lars-Peter Clausen
2014-08-04 18:32 ` Russell King - ARM Linux
2014-08-04 23:12 ` Laurent Pinchart
2014-08-05 17:08 ` DMA engine API issue (was: [PATCH/RFC 0/5] R-Car Gen2 DMAC hardware descriptor list support) Vinod Koul
2014-07-24 12:29 ` [alsa-devel] DMA engine API issue Lars-Peter Clausen
2014-07-24 12:51 ` DMA engine API issue (was: [PATCH/RFC 0/5] R-Car Gen2 DMAC hardware descriptor list support) Russell King - ARM Linux
2014-08-01 9:24 ` Laurent Pinchart
2014-07-23 9:48 ` [PATCH/RFC 0/5] R-Car Gen2 DMAC hardware descriptor list support Laurent Pinchart
2014-07-23 23:56 ` Kuninori Morimoto
2014-07-24 0:12 ` Laurent Pinchart
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=3361994.F0HgAeJkR9@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=alsa-devel@alsa-project.org \
--cc=dmaengine@vger.kernel.org \
--cc=kuninori.morimoto.gx@gmail.com \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).