Subject: Re: [RFC PATCH 01/15] net: qdisc: use rcu prefix and silence sparse warnings

From: John Fastabend <[email-masked]>
Date: Wed, 30 Apr 2014 15:25:31 -0700

On 04/30/2014 10:00 AM, Eric Dumazet wrote:
> On Wed, 2014-04-30 at 09:35 -0700, John Fastabend wrote:
>
>>   static inline struct Qdisc *qdisc_root(const struct Qdisc *qdisc)
>>   {
>> -	return qdisc->dev_queue->qdisc;
>> +	struct Qdisc *q = rcu_dereference(qdisc->dev_queue->qdisc);
>> +
>> +	return q;
>>   }
>>
>
> Hmm... I am pretty sure this can be called without rcu_read_lock()
>
> rcu_dereference_rtnl() would be more appropriate here I think.
>
>

It looks like it except for qdisc_watchdog() which needs an
rcu_read_lock() if I'm not mistaken/

static enum hrtimer_restart qdisc_watchdog(struct hrtimer *timer)
{
	struct qdisc_watchdog *wd = container_of(timer, struct 		
						 qdisc_watchdog,
						 timer);

	rcu_read_lock();
	qdisc_unthrottled(wd->qdisc);
	__netif_schedule(qdisc_root(wd->qdisc));
	rcu_read_unlock();

	return HRTIMER_NORESTART;
}

-- 
John Fastabend         Intel Corporation