[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1410395038.7106.34.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Wed, 10 Sep 2014 17:23:58 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: John Fastabend <john.fastabend@...il.com>
Cc: xiyou.wangcong@...il.com, davem@...emloft.net, jhs@...atatu.com,
netdev@...r.kernel.org, paulmck@...ux.vnet.ibm.com,
brouer@...hat.com
Subject: Re: [net-next PATCH v4 01/16] net: qdisc: use rcu prefix and
silence sparse warnings
On Wed, 2014-09-10 at 08:47 -0700, John Fastabend wrote:
> Add __rcu notation to qdisc handling by doing this we can make
> smatch output more legible. And anyways some of the cases should
> be using rcu_dereference() see qdisc_all_tx_empty(),
> qdisc_tx_chainging(), and so on.
>
> Also *wake_queue() API is commonly called from driver timer routines
> without rcu lock or rtnl lock. So I added rcu_read_lock() blocks
> around netif_wake_subqueue and netif_tx_wake_queue.
>
> Signed-off-by: John Fastabend <john.r.fastabend@...el.com>
...
>
> @@ -416,10 +423,13 @@ static inline bool qdisc_all_tx_empty(const struct net_device *dev)
> static inline bool qdisc_tx_changing(const struct net_device *dev)
> {
> unsigned int i;
> +
> for (i = 0; i < dev->num_tx_queues; i++) {
> struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
> - if (txq->qdisc != txq->qdisc_sleeping)
> + if (rcu_access_pointer(txq->qdisc) != txq->qdisc_sleeping) {
> + rcu_read_unlock();
You forgot to remove this rcu_read_unlock();
> return true;
> + }
> }
> return false;
> }
> @@ -428,10 +438,13 @@ static inline bool qdisc_tx_changing(const struct net_device *dev)
> static inline bool qdisc_tx_is_noop(const struct net_device *dev)
> {
> unsigned int i;
> +
> for (i = 0; i < dev->num_tx_queues; i++) {
> struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
> - if (txq->qdisc != &noop_qdisc)
> + if (rcu_dereference(txq->qdisc) != &noop_qdisc) {
rcu_access_pointer()
> + rcu_read_unlock();
You forgot to remove this rcu_read_unlock();
> return false;
> + }
> }
> return true;
> }
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists