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] [PATCH] netfront: Lockdep fixes

To: jeremy@xxxxxxxxxxxxx (Jeremy Fitzhardinge)
Subject: Re: [Xen-devel] [PATCH] netfront: Lockdep fixes
From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 13 Apr 2007 22:10:08 +1000
Cc: andrei@xxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx, Christian.Limpach@xxxxxxxxxxxxx
Delivery-date: Fri, 13 Apr 2007 05:09:10 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <461EB99A.10000@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Core
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: tin/1.7.4-20040225 ("Benbecula") (UNIX) (Linux/2.6.17-rc4 (i686))
Hi Jeremy:

Jeremy Fitzhardinge <jeremy@xxxxxxxxxxxxx> wrote:
> 
> @@ -1307,10 +1307,10 @@ static int netif_poll(struct net_device 
>        int pages_flipped = 0;
>        int err;
> 
> -       spin_lock(&np->rx_lock);
> +       spin_lock_bh(&np->rx_lock);

The ->poll method is guaranteed to be called with BH disabled so
this isn't necessary.

> @@ -1588,7 +1588,7 @@ static void netif_release_rx_bufs(struct
>        while ((skb = __skb_dequeue(&free_list)) != NULL)
>                dev_kfree_skb(skb);
> 
> -       spin_unlock(&np->rx_lock);
> +       spin_unlock_bh(&np->rx_lock);
> }

Just a minor nit.  This is normally called with BH disabled,
except from uninit so you could put a local_bh_disable there
instead.

> static int network_close(struct net_device *dev)
> @@ -1708,8 +1708,8 @@ static int network_connect(struct net_de
>        IPRINTK("device %s has %sing receive path.\n",
>                dev->name, np->copying_receiver ? "copy" : "flipp");
> 
> +       spin_lock_bh(&np->rx_lock);
>        spin_lock_irq(&np->tx_lock);
> -       spin_lock(&np->rx_lock);
> 
>        /*
>         * Recovery procedure:
> @@ -1761,7 +1761,7 @@ static int network_connect(struct net_de
>        network_tx_buf_gc(dev);
>        network_alloc_rx_buffers(dev);
> 
> -       spin_unlock(&np->rx_lock);
> +       spin_unlock_bh(&np->rx_lock);
>        spin_unlock_irq(&np->tx_lock);

You can't enable BH with IRQs disabled.  Besides, for the sake of
symmetry these two should be reversed.

 
> @@ -2033,10 +2033,10 @@ static void netif_disconnect_backend(str
> static void netif_disconnect_backend(struct netfront_info *info)
> {
>        /* Stop old i/f to prevent errors whilst we rebuild the state. */
> +       spin_lock_bh(&info->rx_lock);
>        spin_lock_irq(&info->tx_lock);
> -       spin_lock(&info->rx_lock);
>        netfront_carrier_off(info);
> -       spin_unlock(&info->rx_lock);
> +       spin_unlock_bh(&info->rx_lock);
>        spin_unlock_irq(&info->tx_lock);

Ditto.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel