netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Claudiu Manoil <claudiu.manoil@freescale.com>
To: Kevin Hao <haokexin@gmail.com>, <netdev@vger.kernel.org>
Cc: David Miller <davem@davemloft.net>
Subject: Re: [PATCH net v2] gianfar: Fix dma check map error when DMA_API_DEBUG is enabled
Date: Thu, 11 Dec 2014 19:05:54 +0200	[thread overview]
Message-ID: <5489CEF2.5090208@freescale.com> (raw)
In-Reply-To: <1418278121-20209-1-git-send-email-haokexin@gmail.com>

On 12/11/2014 8:08 AM, Kevin Hao wrote:
> We need to use dma_mapping_error() to check the dma address returned
> by dma_map_single/page(). Otherwise we would get warning like this:
>    WARNING: at lib/dma-debug.c:1140
>    Modules linked in:
>    CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.18.0-rc2-next-20141029 #196
>    task: c0834300 ti: effe6000 task.ti: c0874000
>    NIP: c02b2c98 LR: c02b2c98 CTR: c030abc4
>    REGS: effe7d70 TRAP: 0700   Not tainted  (3.18.0-rc2-next-20141029)
>    MSR: 00021000 <CE,ME>  CR: 22044022  XER: 20000000
>
>    GPR00: c02b2c98 effe7e20 c0834300 00000098 00021000 00000000 c030b898 00000003
>    GPR08: 00000001 00000000 00000001 749eec9d 22044022 1001abe0 00000020 ef278678
>    GPR16: ef278670 ef278668 ef278660 070a8040 c087f99c c08cdc60 00029000 c0840d44
>    GPR24: c08be6e8 c0840000 effe7e78 ef041340 00000600 ef114e10 00000000 c08be6e0
>    NIP [c02b2c98] check_unmap+0x51c/0x9e4
>    LR [c02b2c98] check_unmap+0x51c/0x9e4
>    Call Trace:
>    [effe7e20] [c02b2c98] check_unmap+0x51c/0x9e4 (unreliable)
>    [effe7e70] [c02b31d8] debug_dma_unmap_page+0x78/0x8c
>    [effe7ed0] [c03d1640] gfar_clean_rx_ring+0x208/0x488
>    [effe7f40] [c03d1a9c] gfar_poll_rx_sq+0x3c/0xa8
>    [effe7f60] [c04f8714] net_rx_action+0xc0/0x178
>    [effe7f90] [c00435a0] __do_softirq+0x100/0x1fc
>    [effe7fe0] [c0043958] irq_exit+0xa4/0xc8
>    [effe7ff0] [c000d14c] call_do_irq+0x24/0x3c
>    [c0875e90] [c00048a0] do_IRQ+0x8c/0xf8
>    [c0875eb0] [c000ed10] ret_from_except+0x0/0x18
>
> For TX, we need to unmap the pages which has already been mapped and
> free the skb before return.
>
> For RX, move the dma mapping and error check to gfar_new_skb(). We
> would reuse the original skb in the rx ring when either allocating
> skb failure or dma mapping error.
>
> Signed-off-by: Kevin Hao <haokexin@gmail.com>
> ---
> v2: Just update the RX path to reuse the original skb when dma mapping error
>      occurs as suggested by David.
>

Very nice refactoring of gfar_new_skb(), removing gfar_new_rxbdp() in 
the process.  (Did not have the time to test it yet.)
Thanks.

Reviewed-by: Claudiu Manoil <claudiu.manoil@freescale.com>

  reply	other threads:[~2014-12-11 17:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-05 10:37 [PATCH 0/2] DMA API usage fixes in gianfar Arseny Solokha
2014-12-05 10:37 ` [PATCH 1/2] gianfar: handle map error in gfar_new_rxbdp() Arseny Solokha
2014-12-09 20:37   ` David Miller
2014-12-05 10:37 ` [PATCH 2/2] gianfar: handle map error in gfar_start_xmit() Arseny Solokha
2014-12-05 12:42   ` Denis Kirjanov
2014-12-05 14:51   ` Claudiu Manoil
2014-12-09 20:39   ` David Miller
2014-12-10 11:03     ` David Laight
2014-12-05 14:48 ` [PATCH 0/2] DMA API usage fixes in gianfar Claudiu Manoil
2014-12-09 14:24 ` [PATCH net] gianfar: Fix dma check map error when DMA_API_DEBUG is enabled Claudiu Manoil
2014-12-10 18:13   ` David Miller
2014-12-11  2:06     ` Kevin Hao
2014-12-11  6:08       ` [PATCH net v2] " Kevin Hao
2014-12-11 17:05         ` Claudiu Manoil [this message]
2014-12-11 19:27         ` David Miller

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=5489CEF2.5090208@freescale.com \
    --to=claudiu.manoil@freescale.com \
    --cc=davem@davemloft.net \
    --cc=haokexin@gmail.com \
    --cc=netdev@vger.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;
as well as URLs for NNTP newsgroup(s).