public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Igor Gnatenko <i.gnatenko.brain@gmail.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: Francois Romieu <romieu@fr.zoreil.com>,
	David Miller <davem@davemloft.net>,
	stephen@networkplumber.org, netdev@vger.kernel.org
Subject: Re: [PATCH] skge: fix broken driver
Date: Fri, 20 Sep 2013 19:35:55 +0400	[thread overview]
Message-ID: <1379691355.2358.1.camel@ThinkPad-X230.localdomain> (raw)
In-Reply-To: <alpine.LRH.2.02.1309201030420.30821@file01.intranet.prod.int.rdu2.redhat.com>

On Fri, 2013-09-20 at 10:32 -0400, Mikulas Patocka wrote:
> 
> 
> On Thu, 19 Sep 2013, Francois Romieu wrote:
> 
> > Mikulas Patocka <mpatocka@redhat.com> :
> > [...]
> > > I see. My patch is a bit simpler - it doesn't allocate the structure 
> > > skge_element on the stack.
> > 
> > Both patches don't behave exactly the same wrt pci_unmap_single.
> > 
> > -- 
> > Ueimor
> 
> I see, my patch passes a wrong value to pci_unmap_single. So I made this 
> change to make it pass the correct value. Do you agree with this patch?
> 
> ---
> 
> skge: fix invalid value passed to pci_unmap_sigle
> 
> In my patch c194992cbe71c20bb3623a566af8d11b0bfaa721 I didn't fix the skge
> bug correctly. The value of the new mapping (not old) was passed to
> pci_unmap_single.
> 
> If we enable CONFIG_DMA_API_DEBUG, it results in this warning:
> WARNING: CPU: 0 PID: 0 at lib/dma-debug.c:986 check_sync+0x4c4/0x580()
> skge 0000:02:07.0: DMA-API: device driver tries to sync DMA memory it has
> not allocated [device address=0x000000023a0096c0] [size=1536 bytes]
> 
> This patch makes the skge driver pass the correct value to
> pci_unmap_single and fixes the warning. It copies the old descriptor to
> on-stack variable "ee" and unmaps it if mapping of the new descriptor
> succeeded.
> 
> This patch should be backported to 3.11-stable.
> 
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> Reported-by: Francois Romieu <romieu@fr.zoreil.com>
> Tested-by: Mikulas Patocka <mpatocka@redhat.com>
> 
> ---
>  drivers/net/ethernet/marvell/skge.c |    9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> Index: linux-3.11.1-fast/drivers/net/ethernet/marvell/skge.c
> ===================================================================
> --- linux-3.11.1-fast.orig/drivers/net/ethernet/marvell/skge.c  2013-09-20 16:13:24.000000000 +0200
> +++ linux-3.11.1-fast/drivers/net/ethernet/marvell/skge.c       2013-09-20 16:18:13.000000000 +0200
> @@ -3086,13 +3086,16 @@ static struct sk_buff *skge_rx_get(struc
>                                                PCI_DMA_FROMDEVICE);
>                 skge_rx_reuse(e, skge->rx_buf_size);
>         } else {
> +               struct skge_element ee;
>                 struct sk_buff *nskb;
>  
>                 nskb = netdev_alloc_skb_ip_align(dev, skge->rx_buf_size);
>                 if (!nskb)
>                         goto resubmit;
>  
> -               skb = e->skb;
> +               ee = *e;
> +
> +               skb = ee.skb;
>                 prefetch(skb->data);
>  
>                 if (skge_rx_setup(skge, e, nskb, skge->rx_buf_size) < 0) {
> @@ -3101,8 +3104,8 @@ static struct sk_buff *skge_rx_get(struc
>                 }
>  
>                 pci_unmap_single(skge->hw->pdev,
> -                                dma_unmap_addr(e, mapaddr),
> -                                dma_unmap_len(e, maplen),
> +                                dma_unmap_addr(&ee, mapaddr),
> +                                dma_unmap_len(&ee, maplen),
>                                  PCI_DMA_FROMDEVICE);
>         }
>  

Mikulas, I think you should send this patch separate..
-- 
Igor Gnatenko
Fedora release 20 (Heisenbug)
Linux 3.11.1-300.fc20.x86_64

  reply	other threads:[~2013-09-20 15:36 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-19 16:33 [PATCH] skge: fix broken driver Mikulas Patocka
2013-09-19 17:56 ` David Miller
2013-09-19 18:04   ` Mikulas Patocka
2013-09-19 18:07     ` David Miller
2013-09-19 18:16     ` Igor Gnatenko
2013-09-19 18:29       ` Mikulas Patocka
2013-09-19 21:32         ` Francois Romieu
2013-09-20 14:32           ` Mikulas Patocka
2013-09-20 15:35             ` Igor Gnatenko [this message]
2013-09-20 21:38             ` Francois Romieu
2013-09-23 14:58               ` Mikulas Patocka
2013-09-19 18:31     ` [PATCH] stable_kernel_rules.txt: Exclude networking from stable rules Joe Perches
2013-09-19 21:32       ` Francois Romieu
2013-09-19 21:45         ` Joe Perches
2013-09-19 22:37           ` Francois Romieu
2013-09-20 14:54       ` Joe Perches
2013-09-20 15:59         ` David Miller
2013-09-22 18:51       ` Christoph Hellwig
2013-09-23 20:34         ` Joe Perches
2013-09-24  8:48           ` Christoph Hellwig

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=1379691355.2358.1.camel@ThinkPad-X230.localdomain \
    --to=i.gnatenko.brain@gmail.com \
    --cc=davem@davemloft.net \
    --cc=mpatocka@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=romieu@fr.zoreil.com \
    --cc=stephen@networkplumber.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