* spi/spi-pl022: Query on working of DMA mode
@ 2011-08-03 11:32 viresh kumar
2011-08-03 14:58 ` Linus Walleij
0 siblings, 1 reply; 5+ messages in thread
From: viresh kumar @ 2011-08-03 11:32 UTC (permalink / raw)
To: linus.walleij@stericsson.com
Cc: Armando VISCONTI, spi-devel-general@lists.sourceforge.net,
viresh kumar, linux-arm-kernel@lists.infradead.org, Shiraz HASHIM
Hi Linus,
I am preparing few patches for spi-pl022 for "Allocating DMA channels as and when required".
And i found something strange.
When we have many transfers in a single message, following routines are called in
specified order:
tasklet_schedule(pump_transfers)
pump_transfers(unsigned long data)
configure_dma(pl022)
sg_alloc_table(&pl022->sgt_rx, pages, GFP_KERNEL);
Here, allocation is requested with GFP_KERNEL flag, from a tasklet.
Which gives following crash logs:
BUG: sleeping function called from invalid context at /data/csd_sw/spear/drives_os/vireshk/spear/kernel/linux-2.6/mm/slub.c:7
93
in_atomic(): 1, irqs_disabled(): 0, pid: 11, name: kworker/u:1
Backtrace:
[<8003dabc>] (dump_backtrace+0x0/0x10c) from [<803aa4ec>] (dump_stack+0x18/0x1c)
r6:00000001 r5:000000d0 r4:bf402200 r3:60000113
[<803aa4d4>] (dump_stack+0x0/0x1c) from [<8004f330>] (__might_sleep+0xec/0x10c)
[<8004f244>] (__might_sleep+0x0/0x10c) from [<800bbd2c>] (__kmalloc+0x74/0x110)
[<800bbcb8>] (__kmalloc+0x0/0x110) from [<8019f69c>] (sg_kmalloc+0x2c/0x30)
r8:80541b40 r7:00000001 r6:00000001 r5:00000100 r4:bf47f1e8
r3:00000000
[<8019f670>] (sg_kmalloc+0x0/0x30) from [<8019f710>] (__sg_alloc_table+0x70/0x118)
[<8019f6a0>] (__sg_alloc_table+0x0/0x118) from [<8019f7e0>] (sg_alloc_table+0x28/0x54)
[<8019f7b8>] (sg_alloc_table+0x0/0x54) from [<802649a0>] (configure_dma+0x230/0x3fc)
r5:bf47def8 r4:bf47f150
[<80264770>] (configure_dma+0x0/0x3fc) from [<8026509c>] (pump_transfers+0xcc/0x100)
[<80264fd0>] (pump_transfers+0x0/0x100) from [<8005ecb0>] (tasklet_action+0xb0/0x160)
r7:805203c4 r6:bf488000 r5:bf47f1a0 r4:bf47f19c
[<8005ec00>] (tasklet_action+0x0/0x160) from [<8005f104>] (__do_softirq+0xa4/0x13c)
[<8005f060>] (__do_softirq+0x0/0x13c) from [<8005f590>] (irq_exit+0x4c/0x54)
[<8005f544>] (irq_exit+0x0/0x54) from [<80034094>] (asm_do_IRQ+0x94/0xd0)
[<80034000>] (asm_do_IRQ+0x0/0xd0) from [<800396f4>] (__irq_svc+0x34/0xc0)
Exception stack(0xbf489e90 to 0xbf489ed8)
Now, i didn't get them earlier due to a mistake of mine. I have updated
pl022_ssp_controller.enable_dma = 1,
but didn't do pl022_config_chip.com_mode = DMA_TRANSFER
So, finally DMA channels are allocated but never used, as both above must have
been set.
Today only I came to know of this mistake, and found it is actually not
working, with above crash occurring.
Is DMA mode working in your case?
--
viresh
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: spi/spi-pl022: Query on working of DMA mode
2011-08-03 11:32 spi/spi-pl022: Query on working of DMA mode viresh kumar
@ 2011-08-03 14:58 ` Linus Walleij
2011-08-04 3:39 ` viresh kumar
0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2011-08-03 14:58 UTC (permalink / raw)
To: viresh kumar
Cc: linus.walleij@stericsson.com, Armando VISCONTI, Shiraz HASHIM,
viresh kumar, spi-devel-general@lists.sourceforge.net,
linux-arm-kernel@lists.infradead.org
On Wed, Aug 3, 2011 at 1:32 PM, viresh kumar <viresh.kumar@st.com> wrote:
> tasklet_schedule(pump_transfers)
> pump_transfers(unsigned long data)
> configure_dma(pl022)
> sg_alloc_table(&pl022->sgt_rx, pages, GFP_KERNEL);
>
> Here, allocation is requested with GFP_KERNEL flag, from a tasklet.
> Which gives following crash logs:
What happens if you replace it with GFP_NOWAIT?
That should work for everybody.
Or you could remove the tasklet allover and replace it with a workqueue.
> Is DMA mode working in your case?
Yes, magically :-/
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: spi/spi-pl022: Query on working of DMA mode
2011-08-03 14:58 ` Linus Walleij
@ 2011-08-04 3:39 ` viresh kumar
2011-08-04 10:16 ` Linus Walleij
0 siblings, 1 reply; 5+ messages in thread
From: viresh kumar @ 2011-08-04 3:39 UTC (permalink / raw)
To: Linus Walleij
Cc: Linus WALLEIJ, Armando VISCONTI, Shiraz HASHIM, viresh kumar,
spi-devel-general@lists.sourceforge.net,
linux-arm-kernel@lists.infradead.org
On 08/03/2011 08:28 PM, Linus Walleij wrote:
>> > Here, allocation is requested with GFP_KERNEL flag, from a tasklet.
>> > Which gives following crash logs:
> What happens if you replace it with GFP_NOWAIT?
>
> That should work for everybody.
>
> Or you could remove the tasklet allover and replace it with a workqueue.
>
Ok. I will fix this and include in my patchset.
>> > Is DMA mode working in your case?
> Yes, magically :-/
But how? Don't you have any message with more than one transfer in it?
--
viresh
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: spi/spi-pl022: Query on working of DMA mode
2011-08-04 3:39 ` viresh kumar
@ 2011-08-04 10:16 ` Linus Walleij
2011-08-04 10:22 ` viresh kumar
0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2011-08-04 10:16 UTC (permalink / raw)
To: viresh kumar
Cc: Linus WALLEIJ, Armando VISCONTI, Shiraz HASHIM, viresh kumar,
spi-devel-general@lists.sourceforge.net,
linux-arm-kernel@lists.infradead.org
On Thu, Aug 4, 2011 at 5:39 AM, viresh kumar <viresh.kumar@st.com> wrote:
>>> > Is DMA mode working in your case?
>> Yes, magically :-/
>
> But how? Don't you have any message with more than one transfer in it?
No maybe not, my test cases are for single messages, and on production
systems we mainly use IRQ-driven traffic. I need to have these
tests added I believe :-/
If you fix this up it will be much appreciated!
Thanks,
Linus Walleij
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: spi/spi-pl022: Query on working of DMA mode
2011-08-04 10:16 ` Linus Walleij
@ 2011-08-04 10:22 ` viresh kumar
0 siblings, 0 replies; 5+ messages in thread
From: viresh kumar @ 2011-08-04 10:22 UTC (permalink / raw)
To: Linus Walleij
Cc: Linus WALLEIJ, Armando VISCONTI, Shiraz HASHIM, viresh kumar,
spi-devel-general@lists.sourceforge.net,
linux-arm-kernel@lists.infradead.org
On 08/04/2011 03:46 PM, Linus Walleij wrote:
> No maybe not, my test cases are for single messages, and on production
> systems we mainly use IRQ-driven traffic. I need to have these
> tests added I believe :-/
>
> If you fix this up it will be much appreciated!
Ya I am fixing this up. I have resolved this yesterday only, with GFP_NOWAIT.
But it looks there are few more issues. Let me fix everything first
and then will send patchset with updates.
--
viresh
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-08-04 10:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-03 11:32 spi/spi-pl022: Query on working of DMA mode viresh kumar
2011-08-03 14:58 ` Linus Walleij
2011-08-04 3:39 ` viresh kumar
2011-08-04 10:16 ` Linus Walleij
2011-08-04 10:22 ` viresh kumar
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).