netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Aleksandrov <nikolay@redhat.com>
To: John Fastabend <john.fastabend@gmail.com>,
	xiyou.wangcong@gmail.com, jhs@mojatatu.com,
	eric.dumazet@gmail.com
Cc: netdev@vger.kernel.org, paulmck@linux.vnet.ibm.com, brouer@redhat.com
Subject: Re: [net-next PATCH v1 01/15] net: qdisc: use rcu prefix and silence sparse warnings
Date: Mon, 28 Jul 2014 01:46:36 +0200	[thread overview]
Message-ID: <53D58F5C.3030200@redhat.com> (raw)
In-Reply-To: <20140726042529.21036.62010.stgit@nitbit.x32>

On 07/26/2014 06:25 AM, 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@intel.com>
> ---
<<snip>>
> @@ -416,11 +423,16 @@ 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;
> +
> +	rcu_read_lock();
>  	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_dereference(txq->qdisc) != txq->qdisc_sleeping) {
Since there's going to be a v2 perhaps it'd be better to use
rcu_access_pointer() here ?
I don't think the depend barrier is necessary.

> +			rcu_read_unlock();
>  			return true;
> +		}
>  	}
> +	rcu_read_unlock();
>  	return false;
>  }
>  
<<snip>>
> @@ -157,9 +160,9 @@ teql_destroy(struct Qdisc *sch)
>  						txq = netdev_get_tx_queue(master->dev, 0);
>  						master->slaves = NULL;
>  
> -						root_lock = qdisc_root_sleeping_lock(txq->qdisc);
> +						root_lock = qdisc_root_sleeping_lock(rtnl_dereference(txq->qdisc));
>  						spin_lock_bh(root_lock);
> -						qdisc_reset(txq->qdisc);
> +						qdisc_reset(rtnl_dereference(txq->qdisc));
>  						spin_unlock_bh(root_lock);
>  					}
>  				}
> @@ -266,7 +269,7 @@ static inline int teql_resolve(struct sk_buff *skb,
>  	struct dst_entry *dst = skb_dst(skb);
>  	int res;
>  
> -	if (txq->qdisc == &noop_qdisc)
> +	if (rcu_dereference_bh(txq->qdisc) == &noop_qdisc)
Same here. Perhaps rcu_access_pointer() ?

Cheers,
 Nik

  reply	other threads:[~2014-07-27 23:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-26  4:25 [net-next PATCH v1 00/15] RCU sched classifiers John Fastabend
2014-07-26  4:25 ` [net-next PATCH v1 01/15] net: qdisc: use rcu prefix and silence sparse warnings John Fastabend
2014-07-27 23:46   ` Nikolay Aleksandrov [this message]
2014-07-26  4:25 ` [net-next PATCH v1 02/15] net: rcu-ify tcf_proto John Fastabend
2014-07-26  4:26 ` [net-next PATCH v1 03/15] net: sched: cls_basic use RCU John Fastabend
2014-07-26  4:27 ` [net-next PATCH v1 04/15] net: sched: cls_cgroup " John Fastabend
2014-07-26  4:27 ` [net-next PATCH v1 05/15] net: sched: cls_flow " John Fastabend
2014-07-26  4:28 ` [net-next PATCH v1 06/15] net: sched: fw " John Fastabend
2014-07-26  4:28 ` [net-next PATCH v1 07/15] net: sched: RCU cls_route John Fastabend
2014-07-26  4:29 ` [net-next PATCH v1 08/15] net: sched: RCU cls_tcindex John Fastabend
2014-07-27 19:15   ` Cong Wang
2014-07-27 22:01     ` John Fastabend
2014-07-26  4:29 ` [net-next PATCH v1 09/15] net: sched: make cls_u32 lockless John Fastabend
2014-07-26  4:30 ` [net-next PATCH v1 10/15] net: sched: rcu'ify cls_rsvp John Fastabend
2014-07-26  4:30 ` [net-next PATCH v1 11/15] net: sched: rcu'ify cls_bpf John Fastabend
2014-07-26  4:31 ` [net-next PATCH v1 12/15] net: sched: make tc_action safe to walk under RCU John Fastabend
2014-07-26  4:31 ` [net-next PATCH v1 13/15] net: sched: make bstats per cpu and estimator RCU safe John Fastabend
2014-07-26  4:32 ` [net-next PATCH v1 14/15] net: sched: make qstats per cpu John Fastabend
2014-07-26  4:32 ` [net-next PATCH v1 15/15] net: sched: drop ingress qdisc lock John Fastabend

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=53D58F5C.3030200@redhat.com \
    --to=nikolay@redhat.com \
    --cc=brouer@redhat.com \
    --cc=eric.dumazet@gmail.com \
    --cc=jhs@mojatatu.com \
    --cc=john.fastabend@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=xiyou.wangcong@gmail.com \
    /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).