Skip to content
Commit f4b66cc7 authored by Quanyang Wang's avatar Quanyang Wang Committed by Liwei Song
Browse files

net: nemac: Fix dma different size error when enable DMA_API_DEBUG

commit c2e7dfcc

 from
https://github.com/axxia/linux-yocto.git v5.10/standard/axxia-dev/base.

Kernel will print error as below when enable DMA_API_DEBUG.
This is because that in nemac_xmit, "dma_map_single" use skb->len
as dma region length to map, but in nemac_tx_cleanup, "dma_unmap_single"
use desc_get_xferlen(desc) as dma region length to free, both of them
sometimes are different, so make dma_map/unmap_single use identical
length.

[ 478.441685] axxia-nemac 8080240000.ethernet: DMA-API: device driver frees DMA memory with different size [device address=0x00000003e1888c82] [map size=590 bytes] [unmap size=640 bytes]
[ 478.441716] ------------[ cut here ]------------
[ 478.441725] WARNING: CPU: 1 PID: 262 at kernel-source/lib/dma-debug.c:1108 check_unmap+0x49c/0x888
[ 478.441728] Modules linked in:
[ 478.441729]
[ 478.441734] CPU: 1 PID: 262 Comm: irq/10-nemac-dm Tainted: G W 4.8.22-WR9.0.0.8_cgl #1
[ 478.441736] Hardware name: AXM56xx Victoria (DT)
[ 478.441738] task: ffffffc3e1cbb880 task.stack: ffffffc3e1dd0000
[ 478.441741] PC is at check_unmap+0x49c/0x888
[ 478.441744] LR is at check_unmap+0x49c/0x888
[ 478.441746] pc : [<ffffff8008682e74>] lr : [<ffffff8008682e74>] pstate: 800001c5
[ 478.441748] sp : ffffffc3e1dd39f0
[ 478.441752] x29: ffffffc3e1dd39f0 x28: ffffffc3e1dc07c0
[ 478.441756] x27: ffffffc3e1c79e00 x26: ffffffc3e1c79fb0
[ 478.441760] x25: ffffff8009402000 x24: 00000000000001c0
[ 478.441763] x23: ffffff8009357000 x22: ffffff800a376000
[ 478.441766] x21: ffffff800a359080 x20: ffffffc3e1dd3a50
[ 478.441770] x19: ffffffc3eaf4ce80 x18: ffffffffffffffff
[ 478.441773] x17: 0000000000000007 x16: 000000000000429c
[ 478.441777] x15: ffffff8009355c08 x14: 69732070616d5b20
[ 478.441780] x13: 5d32386338383831 x12: 6533303030303030
[ 478.441783] x11: 3078303d73736572 x10: 6464612065636976
[ 478.441786] x9 : 65645b20657a6973 x8 : ffffff800a1708c8
[ 478.441790] x7 : 0000000000000001 x6 : ffffff80080f92d8
[ 478.441793] x5 : 0000000000000000 x4 : 0000000000000006
[ 478.441796] x3 : ffffff8009356000 x2 : 0000000000000104
[ 478.441800] x1 : ffffffc3e1cbb880 x0 : 00000000000000ac
[ 478.441801]
[ 478.441802] ---[ end trace 7238b2dcb3935fda ]---
[ 478.441804] Call trace:
[ 478.441807] Exception stack(0xffffffc3e1dd3810 to 0xffffffc3e1dd3940)
[ 478.441810] 3800: ffffffc3eaf4ce80 0000008000000000
[ 478.441813] 3820: ffffffc3e1dd39f0 ffffff8008682e74 00000000800001c5 000000000000003d
[ 478.441816] 3840: 00000000000000ac 0000000000000000 ffffffc3e1dd38f0 ffffff800811115c
[ 478.441819] 3860: ffffffc3e1dd3950 ffffff8008e76f90 ffffff800a359080 ffffff800a376000
[ 478.441821] 3880: ffffff8009357000 00000000000001c0 ffffff8009402000 ffffffc3e1c79fb0
[ 478.441824] 38a0: ffffffc3e1c79e00 ffffffc3e1dc07c0 ffffff800a169000 0000000000000000
[ 478.441826] 38c0: 00000000000000ac ffffffc3e1cbb880 0000000000000104 ffffff8009356000
[ 478.441829] 38e0: 0000000000000006 0000000000000000 ffffff80080f92d8 0000000000000001
[ 478.441831] 3900: ffffff800a1708c8 65645b20657a6973 6464612065636976 3078303d73736572
[ 478.441834] 3920: 6533303030303030 5d32386338383831 69732070616d5b20 ffffff8009355c08
[ 478.441837] [<ffffff8008682e74>] check_unmap+0x49c/0x888
[ 478.441840] [<ffffff80086832c8>] debug_dma_unmap_page+0x68/0x70
[ 478.441844] [<ffffff800888e110>] nemac_poll+0x328/0x530
[ 478.441848] [<ffffff8008a314a4>] net_rx_action+0x28c/0x538
[ 478.441851] [<ffffff8008081844>] __do_softirq+0xfc/0x6c4
[ 478.441855] [<ffffff80080a7124>] do_softirq.part.4+0x54/0x70
[ 478.441858] [<ffffff80080a7238>] __local_bh_enable_ip+0xf8/0x118
[ 478.441862] [<ffffff80081149b4>] irq_forced_thread_fn+0x7c/0x90
[ 478.441866] [<ffffff8008114d18>] irq_thread+0x140/0x200
[ 478.441869] [<ffffff80080c7998>] kthread+0xe8/0x100
[ 478.441872] [<ffffff80080833c0>] ret_from_fork+0x10/0x50
[ 478.441873] Mapped at:
[ 478.441879] [<ffffff80086817f0>] dma_entry_alloc+0x68/0xa8
[ 478.441883] [<ffffff80086836f4>] debug_dma_map_page+0x94/0x148
[ 478.441886] [<ffffff800888e480>] nemac_xmit+0x168/0x340
[ 478.441891] [<ffffff8008a32d64>] dev_hard_start_xmit+0x104/0x540
[ 478.441896] [<ffffff8008a5fbd4>] sch_direct_xmit+0x10c/0x1c0

Signed-off-by: default avatarQuanyang Wang <quanyang.wang@windriver.com>
Signed-off-by: default avatarLiwei Song <liwei.song@windriver.com>
parent 92f8326b
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment