[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJL1qvE8ij_63efQA-jdH_nfR1zWwYGVromGf72HW1MJYBmt4Q@mail.gmail.com>
Date: Thu, 8 Sep 2016 16:18:49 +0300
From: Hadar Hen Zion <hadarh@....mellanox.co.il>
To: Cong Wang <xiyou.wangcong@...il.com>
Cc: Hadar Hen Zion <hadarh@...lanox.com>,
"David S. Miller" <davem@...emloft.net>,
Linux Kernel Network Developers <netdev@...r.kernel.org>,
Jiri Pirko <jiri@...lanox.com>, Jiri Benc <jbenc@...hat.com>,
Jamal Hadi Salim <jhs@...atatu.com>,
Shmulik Ladkani <shmulik.ladkani@...il.com>,
Tom Herbert <tom@...bertland.com>,
Eric Dumazet <edumazet@...gle.com>,
Amir Vadai <amirva@...lanox.com>,
Or Gerlitz <ogerlitz@...lanox.com>, Amir Vadai <amir@...ai.me>
Subject: Re: [PATCH net-next V6 4/4] net/sched: Introduce act_tunnel_key
On Wed, Sep 7, 2016 at 7:27 PM, Cong Wang <xiyou.wangcong@...il.com> wrote:
> On Wed, Sep 7, 2016 at 1:08 AM, Hadar Hen Zion <hadarh@...lanox.com> wrote:
>> +struct tcf_tunnel_key_params {
>> + struct rcu_head rcu;
>> + int tcft_action;
>> + int action;
>> + struct metadata_dst *tcft_enc_metadata;
>> +};
>> +
>> +struct tcf_tunnel_key {
>> + struct tc_action common;
>> + struct tcf_tunnel_key_params __rcu *params;
>> +};
>> +
> ...
>
> This is unnecessary if we make the tc action API aware of RCU.
>
>> +
>> +static void tunnel_key_release(struct tc_action *a, int bind)
>> +{
>> + struct tcf_tunnel_key *t = to_tunnel_key(a);
>> + struct tcf_tunnel_key_params *params;
>> +
>> + rcu_read_lock();
>> + params = rcu_dereference(t->params);
>> +
>> + if (params->tcft_action == TCA_TUNNEL_KEY_ACT_SET)
>> + dst_release(¶ms->tcft_enc_metadata->dst);
>> +
>> + rcu_read_unlock();
>> +
>
> So you allocate memory for t->params in ->init() but not
> release it here?
Right, I'll fix it in the next version.
>
> Also, ->cleanup() should be called with RTNL, no need to
> take read lock here.
RTNL lock isn't taken when cleanup is called.
>
> BTW, again you do NOT need to make it RCU, the whole
> tc action API should be, as my patchset does, I will take care
> of this as a part of my patchset. Eric is wasting your time on
> this, with no benefits, the code will be replaced soon.
Powered by blists - more mailing lists