netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net-next 0/5] act_bpf: remove spinlock in fast path
@ 2015-08-26  3:06 Alexei Starovoitov
  2015-08-26  3:06 ` [PATCH v2 net-next 1/5] net_sched: make tcf_hash_destroy() static Alexei Starovoitov
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Alexei Starovoitov @ 2015-08-26  3:06 UTC (permalink / raw)
  To: David S. Miller; +Cc: Eric Dumazet, Daniel Borkmann, netdev

v1 version had a race condition in cleanup path of bpf_prog.
I tried to fix it by adding new callback 'cleanup_rcu' to 'struct tcf_common'
and call it out of act_api cleanup path, but Daniel noticed
(thanks for the idea!) that most of the classifiers already do action cleanup
out of rcu callback.
So instead this set of patches converts tcindex and rsvp classifiers to call
tcf_exts_destroy() after rcu grace period and since action cleanup logic
in __tcf_hash_release() is only called when bind and refcnt goes to zero,
it's guaranteed that cleanup() callback is called from rcu callback.
More specifically:
patches 1 and 2 - simple fixes
patches 2 and 3 - convert tcf_exts_destroy in tcindex and rsvp to call_rcu
patch 5 - removes spin_lock from act_bpf

The cleanup of actions is now universally done after rcu grace period
and in the future we can drop (now unnecessary) call_rcu from tcf_hash_destroy()
patch 5 is using synchronize_rcu() in act_bpf replacement path, since it's
very rare and alternative of dynamically allocating 'struct tcf_bpf_cfg' just
to pass it to call_rcu looks even less appealing.

Alexei Starovoitov (5):
  net_sched: make tcf_hash_destroy() static
  net_sched: act_bpf: remove unnecessary copy
  net_sched: convert tcindex to call tcf_exts_destroy from rcu callback
  net_sched: convert rsvp to call tcf_exts_destroy from rcu callback
  net_sched: act_bpf: remove spinlock in fast path

 include/net/act_api.h       |    1 -
 include/net/tc_act/tc_bpf.h |    2 +-
 net/sched/act_api.c         |    3 +--
 net/sched/act_bpf.c         |   38 ++++++++++++++++++++------------------
 net/sched/cls_rsvp.h        |   18 ++++++++++++++----
 net/sched/cls_tcindex.c     |   29 +++++++++++++++++++++++++----
 6 files changed, 61 insertions(+), 30 deletions(-)

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-08-26 18:02 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-26  3:06 [PATCH v2 net-next 0/5] act_bpf: remove spinlock in fast path Alexei Starovoitov
2015-08-26  3:06 ` [PATCH v2 net-next 1/5] net_sched: make tcf_hash_destroy() static Alexei Starovoitov
2015-08-26  8:05   ` Daniel Borkmann
2015-08-26  3:06 ` [PATCH v2 net-next 2/5] net_sched: act_bpf: remove unnecessary copy Alexei Starovoitov
2015-08-26  8:08   ` Daniel Borkmann
2015-08-26  3:06 ` [PATCH v2 net-next 3/5] net_sched: convert tcindex to call tcf_exts_destroy from rcu callback Alexei Starovoitov
2015-08-26  8:09   ` Daniel Borkmann
2015-08-26  3:06 ` [PATCH v2 net-next 4/5] net_sched: convert rsvp " Alexei Starovoitov
2015-08-26  8:11   ` Daniel Borkmann
2015-08-26  3:06 ` [PATCH v2 net-next 5/5] net_sched: act_bpf: remove spinlock in fast path Alexei Starovoitov
2015-08-26  8:17   ` Daniel Borkmann
2015-08-26 18:02 ` [PATCH v2 net-next 0/5] " David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).