From mboxrd@z Thu Jan 1 00:00:00 1970 From: Amir Vadai Subject: Re: [PATCH net-next V3 4/4] net/sched: Introduce act_tunnel_key Date: Tue, 30 Aug 2016 16:17:54 +0300 Message-ID: <20160830131754.GA11446@office.localdomain> References: <1472141627-27339-1-git-send-email-hadarh@mellanox.com> <1472141627-27339-5-git-send-email-hadarh@mellanox.com> <1472147334.14381.149.camel@edumazet-glaptop3.roam.corp.google.com> <1472238975.14381.192.camel@edumazet-glaptop3.roam.corp.google.com> <20160830110308.GA7141@office.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Cong Wang , Eric Dumazet , Hadar Hen Zion , "David S. Miller" , Linux Kernel Network Developers , Jiri Pirko , Jiri Benc , Shmulik Ladkani , Tom Herbert , Or Gerlitz , Amir Vadai To: Jamal Hadi Salim Return-path: Received: from mail-wm0-f68.google.com ([74.125.82.68]:36801 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751527AbcH3NSD (ORCPT ); Tue, 30 Aug 2016 09:18:03 -0400 Received: by mail-wm0-f68.google.com with SMTP id i138so3131441wmf.3 for ; Tue, 30 Aug 2016 06:18:02 -0700 (PDT) Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Tue, Aug 30, 2016 at 08:05:03AM -0400, Jamal Hadi Salim wrote: > On 16-08-30 07:03 AM, Amir Vadai wrote: > > On Sun, Aug 28, 2016 at 10:04:21PM -0700, Cong Wang wrote: > > > On Fri, Aug 26, 2016 at 12:16 PM, Eric Dumazet wrote: > > > > On Fri, 2016-08-26 at 11:26 -0700, Cong Wang wrote: > > > > Regarding the specific action in this patchset, correct me if I'm wrong, > > but I think that the lock could be removed safely. > > > > From what Eric suggested (refer to my posting on skbmod), > this becomes: > > +struct tcf_tunnel_key_p { > + int tcft_action; > + struct metadata_dst *tcft_enc_metadata; > +}; > > /* rcu protected */ > +struct tcf_tunnel_key { > + struct tc_action common; > + struct tcf_tunnel_key_p *p; > +}; > > At init() - always alloc struct tcf_tunnel_key_p, new > > old = rtnl_dereference(mykey->p); > if (ovr) > spin_lock_bh(&mykey->tcf_lock); Thanks for the detailed example :) what are we protecting with this spin lock here? isn't concurrent init() calls are protected by the rtnl lock? > ... update all params here .. > rcu_assign_pointer(mykey->p, new); > if (ovr) { > spin_unlock_bh(&mykey->tcf_lock); > synchronize_rcu(); > } > > kfree(old); > > at act(): > > rcu_read_lock(); > struct tcf_tunnel_key_p *p = rcu_dereference(mykey->p); > ... use p here ... > rcu_read_unlock(); > > Cong was looking to do something more generic for all actions. > > cheers, > jamal