[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54051FC1.6030106@gmail.com>
Date: Mon, 01 Sep 2014 18:39:13 -0700
From: John Fastabend <john.fastabend@...il.com>
To: David Miller <davem@...emloft.net>
CC: xiyou.wangcong@...il.com, jhs@...atatu.com, eric.dumazet@...il.com,
netdev@...r.kernel.org, paulmck@...ux.vnet.ibm.com,
brouer@...hat.com
Subject: Re: [net-next PATCH v2 02/15] net: rcu-ify tcf_proto
On 08/24/2014 10:31 PM, David Miller wrote:
> From: John Fastabend <john.fastabend@...il.com>
> Date: Sun, 24 Aug 2014 17:48:31 -0700
>
>> @@ -722,8 +724,9 @@ static void sfq_free(void *addr)
>> static void sfq_destroy(struct Qdisc *sch)
>> {
>> struct sfq_sched_data *q = qdisc_priv(sch);
>> + struct tcf_proto *fl = rtnl_dereference(q->filter_list);
>>
>> - tcf_destroy_chain(&q->filter_list);
>> + tcf_destroy_chain(&fl);
Sorry for the delayed reply...
>
> This will cause tcf_destroy_chain() to set the local variable
> 'fl' to NULL rather than q->filter_list.
>
> I don't see how this can be correct at all.
Right now (without these patches) nothing sets q->filter_list
to NULL and we only call this when the qdisc is being destroyed.
In all cases there is a rcu_assign_pointer() to detach the qdisc
from the netdev_queue followed by a synchronize_net().
dev_deactivate_many
[...]
dev_deactivate_queue
rcu_assign_pointer(dev_queue->qdisc, qdisc_default)
[...]
synchronize_net()
After the synchronize_net there should be no other references
to q->filter_list other then in the destroy path so I think it
works and the rtnl_dereference in my patch is there for annotation
to make sparse happy but doesn't change the logic.
Does that make sense?
>
> You need to make tcf_destroy_chain() take a pointer to an __rcu
> pointer, and do the proper dereferencing and RCU assignments in
> that chain destroy loop.
>
> This might be why you're getting annotation warnings.
>
The annotation warnings comes from the find_tcf blocks for example
here is the block in the sfq scheduler,
struct sfq_sched_data *q = qdisc_priv(sch);
if (cl)
return NULL;
return &q->filter_list;
This is called inside the rtnl lock but filter list is rcu protected
fixing the function types like this seems to resolve it,
static struct tcf_proto * __rcu *sfq_find_tcf(struct Qdisc *sch,
unsigned long cl)
and similarly the ops struct,
struct tcf_proto * __rcu * (*tcf_chain)(struct Qdisc *, unsigned long);
This fixes the sparse warnings and looks correct to me. I'll send
an update with these fixes.
Thanks!
John
--
John Fastabend Intel Corporation
--
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