Currently, all netlink protocol handlers for updating rules, actions and qdiscs are protected with single global rtnl lock which removes any possibility for parallelism. This patch set is a second step to remove rtnl lock dependency from TC rules update path.
Recently, new rtnl registration flag RTNL_FLAG_DOIT_UNLOCKED was added. Handlers registered with this flag are called without RTNL taken. End goal is to have rule update handlers(RTM_NEWTFILTER, RTM_DELTFILTER, etc.) to be registered with UNLOCKED flag to allow parallel execution. However, there is no intention to completely remove or split rtnl lock itself. This patch set addresses specific problems in implementation of tc actions that prevent their control path from being executed concurrently. Additional changes are required to refactor classifiers API and individual classifiers for parallel execution. This patch set lays groundwork to eventually register rule update handlers as rtnl-unlocked. Action API is already prepared for parallel execution with previous patch set, which means that action ops that use action API for their implementation do not require additional modifications. (delete, search, etc.) Action API implements concurrency-safe reference counting and guarantees that cleanup/delete is called only once, after last reference to action is released. The goal of this change is to update specific actions APIs that access action private state directly, in order to be independent from external locking. General approach is to re-use existing tcf_lock spinlock (used by some action implementation to synchronize control path with data path) to protect action private state from concurrent modification. If action has rcu-protected pointer, tcf spinlock is used to protect its update code, instead of relying on rtnl lock. Some actions need to determine rtnl mutex status in order to release it. For example, ife action can load additional kernel modules(meta ops) and must make sure that no locks are held during module load. In such cases 'rtnl_held' argument is used to conditionally release rtnl mutex. Vlad Buslov (14): net: sched: act_bpf: remove dependency on rtnl lock net: sched: act_csum: remove dependency on rtnl lock net: sched: act_gact: remove dependency on rtnl lock net: sched: act_ife: remove dependency on rtnl lock net: sched: act_ipt: remove dependency on rtnl lock net: sched: act_pedit: remove dependency on rtnl lock net: sched: act_sample: remove dependency on rtnl lock net: sched: act_simple: remove dependency on rtnl lock net: sched: act_skbmod: remove dependency on rtnl lock net: sched: act_tunnel_key: remove dependency on rtnl lock net: sched: act_vlan: remove dependency on rtnl lock net: sched: act_mirred: remove dependency on rtnl lock net: core: add new/replace rate estimator lock parameter net: sched: act_police: remove dependency on rtnl lock include/net/gen_stats.h | 2 + include/net/tc_act/tc_mirred.h | 5 +++ include/net/tc_act/tc_tunnel_key.h | 33 ++++++++++++--- net/core/gen_estimator.c | 58 ++++++++++++++++++++------- net/netfilter/xt_RATEEST.c | 2 +- net/sched/act_api.c | 2 +- net/sched/act_bpf.c | 10 +++-- net/sched/act_csum.c | 24 ++++++----- net/sched/act_gact.c | 10 ++++- net/sched/act_ife.c | 40 ++++++++++++------- net/sched/act_ipt.c | 3 ++ net/sched/act_mirred.c | 82 +++++++++++++++++++++++++------------- net/sched/act_pedit.c | 40 +++++++++---------- net/sched/act_police.c | 10 +++-- net/sched/act_sample.c | 12 +++++- net/sched/act_simple.c | 6 ++- net/sched/act_skbmod.c | 14 ++++--- net/sched/act_tunnel_key.c | 26 ++++++------ net/sched/act_vlan.c | 27 +++++++------ net/sched/cls_api.c | 1 + net/sched/sch_api.c | 2 + net/sched/sch_cbq.c | 4 +- net/sched/sch_drr.c | 4 +- net/sched/sch_hfsc.c | 4 +- net/sched/sch_htb.c | 4 +- net/sched/sch_qfq.c | 4 +- 26 files changed, 285 insertions(+), 144 deletions(-) -- 2.7.5