Re: rcar_sata DMA warnings on Salvator-X

2016-03-01 Thread Dirk Behme

Hi,

On 24.02.2016 13:42, Geert Uytterhoeven wrote:

With CONFIG_DMA_API_DEBUG=y, I sometimes get the below warning
on r8a7795/salvator-x. My tree is based on renesas-drivers-2016-02-23-v4.5-rc5.



Some weeks ago I've had a look at porting the eMMC support from the 
4.2 Renesas BSP to the 4.4 based renesas-drivers [1]. I never got it 
working, as it always crashed immediately at every kernel boot with 
various error messages. Often something like [2], but often something 
quite different, too.


As the MMC related patches I ported seem to work on the Renesas 4.2 
BSP, and the 4.4 renesas-drivers shouldn't be that different, I was 
hoping that the same code works on 4.2 and 4.4.  But it doesn't, even 
though I compared the resulting MMC code to be identical. As the 
crashes are often different ones, often in core parts of the kernel, I 
was suspecting a DMA related issue, too.


So maybe we have a 'general' DMA issue on Salvator-X? Somehow 
independent on the specific SATA and MMC code?


Just my $0.02. Maybe something to at least think about. Sorry if these 
are totally unrelated issues.


Best regards

Dirk

[1] 
https://github.com/dirkbehme/linux-renesas-rcar-gen3/commits/dirk/gen3-latest-update


[2]

...
ALSA device list:
  #0: rsnd-dai.0-ak4613-hifi
mmc0: MAN_BKOPS_EN bit is not set
mmc0: new HS200 MMC card at address 0001
mmcblk0: mmc0:0001 BGSD3R 29.1 GiB
mmcblk0boot0: mmc0:0001 BGSD3R partition 1 16.0 MiB
mmcblk0boot1: mmc0:0001 BGSD3R partition 2 16.0 MiB
mmcblk0rpmb: mmc0:0001 BGSD3R partition 3 4.00 MiB
[ cut here ]
kernel BUG at mm/vmalloc.c:460!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
Modules linked in:
CPU: 1 PID: 6 Comm: kworker/u16:0 Not tainted 4.4.0-rc3+ #1
Hardware name: Renesas Salvator-X board based on r8a7795 (DT)
Workqueue: kmmcd mmc_rescan
task: ffc5bc483700 ti: ffc5bc4bc000 task.ti: ffc5bc4bc000
PC is at alloc_vmap_area.isra.44+0x2d8/0x2fc
LR is at alloc_vmap_area.isra.44+0x23c/0x2fc
pc : [] lr : [] pstate: a045
sp : ffc5bc4bf740
x29: ffc5bc4bf740 x28: 0001
x27: 2000 x26: ffc0009d8410
x25: ff802000 x24: ffc0009d8410
x23: ff80 x22: 
x21: ffc000961980 x20: ffbdbfff
x19: ffc5bb443a00 x18: ffc000691000
x17: 0007 x16: 000e
x15: ffbdd8105020 x14: 0003
x13: ff80 x12: ffc0009c17b8
x11: ffc0009c17d8 x10: 0003
x9 : 0001 x8 : 0001
x7 :  x6 : 003f
x5 : ffbdbff78000 x4 : ffc5bc401618
x3 : ffc03299c718 x2 : ffc5bb443a30
x1 :  x0 : 

Process kworker/u16:0 (pid: 6, stack limit = 0xffc5bc4bc020)
Stack: (0xffc5bc4bf740 to 0xffc5bc4c)
f740: ffc5bc4bf7c0 ffc0001769b0 1000 ffc5bb443980
f760: 0022 0001 ffc0003075e4 024080c2
f780: ff80 ffbdbfff 00e80713 0003
f7a0: ff80 ffc5bb443a00  001bb5c0
f7c0: ffc5bc4bf820 ffc000177140 0400 0008
f7e0: ffc032958000 ffc5bc14  ffc0007fc470
f800: 024080c2 0001 ffc032958048 ffc032958000
f820: ffc5bc4bf890 ffc00017753c ffc5bb443900 0008
f840: ffc032958000 ffc5bc14 ffc0007fc4c8 ffc0007fc470
f860:  0001 ffc5bc14 ffc0007fc470
f880: ffc0003075e4 0001 ffc5bc4bf8a0 ffc0003075e4
f8a0: ffc5bc4bf8e0 ffc000306d0c ffc5bc14 ffc032958000
f8c0: ffc5bc14 ffc0007fc4f8 ffc0007fc4c8 00020001
f8e0: ffc5bc4bf940 ffc0001d6afc ffc5bc14 ffc032958000
f900:  ffc5bc140018  0001
f920:  0001 ffc5bc14 0003
f940: ffc5bc4bf9a0 ffc0001d6c34 ffc032958000 ffc032958070
f960:  ffc5bc14 ffc032960168 ffc032958080
f980: 0001 0001 ffc5bc4bf9b0 001bb2c4
f9a0: ffc5bc4bfa30 ffc0003048c8 ffc032958000 ffc032958070
f9c0: ffc03295800c ffc5bc14 ffc032960168 ffc032958080
f9e0: 0001 ffc032af0314 ffc00082c950 0003
fa00: ffc5bc4bfa10 ffc000303560 ffc5bc4bfa30 ffc0003048ac
fa20: ffc032958000 ffc032958070 ffc5bc4bfaa0 ffc0004ceab0
fa40: ffc032af0800 0003 ffc032af0be8 ffc032af
fa60: ffc032af0800 ffc032af0008 ffc032af0bb8 ffc5bc4bfad0
fa80: 0b30bc4bfa90 ffc8 ffc032af0800 ffc03295b00c
faa0: ffc5bc4bfad0 ffc0004cf098 ffc032af051c 0003
fac0: ffc032af2000 ffc032af ffc5bc4bfb50 ffc0004c257c
fae0: ffc032af0008 

Re: rcar_sata DMA warnings on Salvator-X

2016-03-01 Thread Tejun Heo
Hello,

On Mon, Feb 29, 2016 at 02:44:16PM +0100, Geert Uytterhoeven wrote:
> sata_rcar ee30.sata: DMA-API: cpu touching an active dma mapped
> cacheline [cln=0x0090ff40]
> [ cut here ]
> WARNING: at lib/dma-debug.c:604
> Modules linked in:
> 
> CPU: 2 PID: 329 Comm: udevd Not tainted
...
> [] debug_dma_assert_idle+0x180/0x1d0
> [] wp_page_copy.isra.109+0xfc/0x57c
> [] handle_mm_fault+0x125c/0x1300
> [] do_page_fault+0x184/0x328
> [] do_mem_abort+0x40/0x9c

So, somehow udev has mmapped a page which is dma mapped and trying to
falut that in?

> Mapped at:
>  [] dma_entry_alloc+0x98/0xac
>  [] debug_dma_alloc_coherent+0x48/0xe0
>  [] dmam_alloc_coherent+0xa8/0xf8
>  [] ata_bmdma_port_start+0x40/0x5c
>  [] ata_host_start+0xf8/0x19c

And that region was originally allocated by ata_bmdma_port_start()?
The only thing which gets allocated there is the PRD table which is
the scatter-gather list for the DMA engine and has no reason to be
ever accessed from userland.  Any chance you can find out what udev is
doing at that point?

Thanks.

-- 
tejun


Re: rcar_sata DMA warnings on Salvator-X

2016-02-29 Thread Geert Uytterhoeven
Hi Tejun,

On Fri, Feb 26, 2016 at 9:21 AM, Geert Uytterhoeven
 wrote:
> On Thu, Feb 25, 2016 at 10:42 PM, Tejun Heo  wrote:
>> On Thu, Feb 25, 2016 at 4:40 PM, Tejun Heo  wrote:
>>> Is this the problem fixed by the following patch from Harvey?
>>>
>>>  
>>> http://lkml.kernel.org/g/CAMuHMdU0=_TJVfy=-zxwhkfjswh_fjulbrl8j9t60qs48wb...@mail.gmail.com
>>
>> Oops, I meant
>>
>> http://lkml.kernel.org/g/1456327003-16295-1-git-send-email-harvey.h...@imgtec.com
>
> Thanks, looks plausible, I'll give it a try.
>
> Note that I couldn't reproduce this at will, so I'll just let you know if I
> see it again, despite this patch.

Unfortunately I've just got another one, with the above patch applied:

sata_rcar ee30.sata: DMA-API: cpu touching an active dma mapped
cacheline [cln=0x0090ff40]
[ cut here ]
WARNING: at lib/dma-debug.c:604
Modules linked in:

CPU: 2 PID: 329 Comm: udevd Not tainted
4.5.0-rc5-salvator-x-04739-gd9f979182e2877a4 #557
Hardware name: Renesas Salvator-X board based on r8a7795 (DT)
task: ffc6fa63a180 ti: ffc6fa7c4000 task.ti: ffc6fa7c4000
PC is at debug_dma_assert_idle+0x180/0x1d0
LR is at debug_dma_assert_idle+0x180/0x1d0
pc : [] lr : [] pstate: 6145
sp : ffc6fa7c7c20
x29: ffc6fa7c7c20 x28: 00e0487fafd3
x27: ffc03b010f40 x26: 
x25: ffc03b010f40 x24: 0140
x23: ff80047219b8 x22: ff80047a1000
x21: ff80046f1000 x20: ff8004721000
x19: ffc6fb03d600 x18: 007feb6bbf20
x17: 007fa0722650 x16: 00557d095af0
x15: 007fa07f2588 x14: 70616d20616d6420
x13: 657669746361206e x12: 6120676e69686375
x11: 6f7420757063203a x10: 4950412d414d4420
x9 : 3a617461732e3030 x8 : ff80047564d4
x7 :  x6 : 0004
x5 : 0016 x4 : 0066
x3 : 00ff x2 : dead4ead
x1 : 0140 x0 : 0066

---[ end trace 7f71ed044e72e67d ]---
Call trace:
Exception stack(0xffc6fa7c7a60 to 0xffc6fa7c7b80)
7a60: ffc6fb03d600 ff8004721000 ffc6fa7c7c20 ff8004222b00
7a80: ffc6fa7c7aa0 ff80040d1dcc ff8004703138 0004
7aa0: ffc6fa7c7ac0 ff80040d3a00 0002 0004
7ac0: ffc6fa7c7b60 ff80040d3bf4 ffc6fb03d600 ff8004721000
7ae0: ff80046f1000 ff80047a1000 ff80047219b8 0140
7b00: 0066 0140 dead4ead 00ff
7b20: 0066 0016 0004 
7b40: ff80047564d4 3a617461732e3030 4950412d414d4420 6f7420757063203a
7b60: 6120676e69686375 657669746361206e 70616d20616d6420 007fa07f2588
[] debug_dma_assert_idle+0x180/0x1d0
[] wp_page_copy.isra.109+0xfc/0x57c
[] handle_mm_fault+0x125c/0x1300
[] do_page_fault+0x184/0x328
[] do_mem_abort+0x40/0x9c
Exception stack(0xffc6fa7c7e30 to 0xffc6fa7c7f50)
7e20:    00557d0a6740
7e40:  007fa0722798 a000 0015
7e60: 011e 00d7 ffc6fa7c7e80 ff8004133120
7e80: ffc6fa7c7ec0 ff8004133140  
7ea0:  365c03fd  0001
7ec0:  ff80040854f0  0007
7ee0: 0038 0040 007feb6c0188 0002
7f00:  726f635f38766d72 003735615f786574 fefeff3634605e77
7f20: 7f7f7f7f7f7f7f7f 0101010101010101 0028 0010
7f40:  007fa07f2588
[] el0_da+0x18/0x1c
Mapped at:
 [] dma_entry_alloc+0x98/0xac
 [] debug_dma_alloc_coherent+0x48/0xe0
 [] dmam_alloc_coherent+0xa8/0xf8
 [] ata_bmdma_port_start+0x40/0x5c
 [] ata_host_start+0xf8/0x19c

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: rcar_sata DMA warnings on Salvator-X

2016-02-26 Thread Geert Uytterhoeven
Hi Tejun,

On Thu, Feb 25, 2016 at 10:42 PM, Tejun Heo  wrote:
> On Thu, Feb 25, 2016 at 4:40 PM, Tejun Heo  wrote:
>> Is this the problem fixed by the following patch from Harvey?
>>
>>  
>> http://lkml.kernel.org/g/CAMuHMdU0=_TJVfy=-zxwhkfjswh_fjulbrl8j9t60qs48wb...@mail.gmail.com
>
> Oops, I meant
>
> http://lkml.kernel.org/g/1456327003-16295-1-git-send-email-harvey.h...@imgtec.com

Thanks, looks plausible, I'll give it a try.

Note that I couldn't reproduce this at will, so I'll just let you know if I
see it again, despite this patch.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: rcar_sata DMA warnings on Salvator-X

2016-02-25 Thread Tejun Heo
On Thu, Feb 25, 2016 at 4:40 PM, Tejun Heo  wrote:
> Is this the problem fixed by the following patch from Harvey?
>
>  
> http://lkml.kernel.org/g/CAMuHMdU0=_TJVfy=-zxwhkfjswh_fjulbrl8j9t60qs48wb...@mail.gmail.com

Oops, I meant

http://lkml.kernel.org/g/1456327003-16295-1-git-send-email-harvey.h...@imgtec.com

Thanks.

-- 
tejun


Re: rcar_sata DMA warnings on Salvator-X

2016-02-25 Thread Tejun Heo
Hello,

cc'ing Harvey.

On Wed, Feb 24, 2016 at 01:42:33PM +0100, Geert Uytterhoeven wrote:
> With CONFIG_DMA_API_DEBUG=y, I sometimes get the below warning
> on r8a7795/salvator-x. My tree is based on 
> renesas-drivers-2016-02-23-v4.5-rc5.
> 
> sata_rcar ee30.sata: DMA-API: cpu touching an active dma mapped
> cacheline [cln=0x0090fba0]
> [ cut here ]
> WARNING: at lib/dma-debug.c:604
> Modules linked in:
> 
> CPU: 3 PID: 1619 Comm: bash Tainted: GW
> 4.5.0-rc5-salvator-x-04682-g420edda42525a16f-dirty #541
> Hardware name: Renesas Salvator-X board based on r8a7795 (DT)
> task: ffc03bb30200 ti: ffc03b17 task.ti: ffc03b17
> PC is at debug_dma_assert_idle+0x180/0x1d0

Is this the problem fixed by the following patch from Harvey?

 
http://lkml.kernel.org/g/CAMuHMdU0=_TJVfy=-zxwhkfjswh_fjulbrl8j9t60qs48wb...@mail.gmail.com

Thanks.

-- 
tejun