WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] network hang trigger

To: Bin Ren <br260@xxxxxxxxx>
Subject: Re: [Xen-devel] network hang trigger
From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Date: Thu, 16 Sep 2004 08:33:47 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 16 Sep 2004 08:35:17 +0100
Envelope-to: steven.hand@xxxxxxxxxxxx
In-reply-to: Your message of "15 Sep 2004 23:11:13 BST." <Prayer.1.0.11.0409152311130.1102@xxxxxxxxxxxxxxxxxxxxxx>
List-archive: <http://sourceforge.net/mailarchive/forum.php?forum=xen-devel>
List-help: <mailto:xen-devel-request@lists.sourceforge.net?subject=help>
List-id: List for Xen developers <xen-devel.lists.sourceforge.net>
List-post: <mailto:xen-devel@lists.sourceforge.net>
List-subscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=subscribe>
List-unsubscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=unsubscribe>
Sender: xen-devel-admin@xxxxxxxxxxxxxxxxxxxxx
> in file net/core.c
> ======================================
> if (!dev->hard_start_xmit(skb, dev)) {
>         HARD_TX_UNLOCK_BH(dev);
>         goto out;
> }
> ...
> 
> out_kfree_skb:
>         kfree_skb(skb);
> out:
>         return rc;
> ======================================
> 
> Bingo, it doesn't. And take a look at other network driver source codes, 
> e.g. 8139too.c, 3c501.c etc, they all ***free skb*** upon error and 
> ***always return 0***. This is *hidden contract* between the caller and the 
> callee.

(1) See drivers like 3c59x.c. They do not free the skbuff when they
    return non-zero.

(2) Look again at the code fragment you've posted -- the body of the
    'if' statement is executed when hard_start_xmit returns zero. So
    the body corresponds to the NON-ERROR case! You'll see that the
    error case does in fact free the skbuff.

> So, skbuffs don't get freed until gc'ed.

No, there is no bug here. And if we were leaking skbuffs they would
never be freed. There is no automatic garbage collection within the
kernel.

 -- Keir


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel