lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu,  6 Sep 2018 10:58:49 +0300
From:   Vlad Buslov <>
Cc:,,,,,,,,,,,,,,,,, Vlad Buslov <>
Subject: [PATCH net-next 00/13] Refactor classifier API to work with Qdisc/blocks without rtnl lock

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 third 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
classifiers API that prevent its 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 by modifying code in cls API that works with Qdiscs and
blocks. Following patch set does the same for chains and classifiers.

The goal of this change is to refactor tcf_block_find() and its
dependencies to allow concurrent execution:
- Extend Qdisc API with rcu to lookup and take reference to Qdisc
  without relying on rtnl lock.
- Extend tcf_block with atomic reference counting and rcu.
- Always take reference to tcf_block while working with it.
- Implement tcf_block_release() to release resources obtained by
- Create infrastructure to allow registering Qdiscs with class ops that
  do not require the caller to hold rtnl lock.

All three netlink rule update handlers use tcf_block_find() to lookup
Qdisc and block, and this patch set introduces additional means of
synchronization to substitute rtnl lock in cls API.

Some functions in cls and sch APIs have historic names that no longer
clearly describe their intent. In order not make this code even more
confusing when introducing their concurrency-friendly versions, rename
these functions to describe actual implementation.

Vlad Buslov (13):
  net: core: netlink: add helper refcount dec and lock function
  net: sched: rename qdisc_destroy() to qdisc_put()
  net: sched: extend Qdisc with rcu
  net: sched: add helper function to take reference to Qdisc
  net: sched: use Qdisc rcu API instead of relying on rtnl lock
  net: sched: change tcf block reference counter type to refcount_t
  net: sched: implement functions to put and flush all chains
  net: sched: rename tcf_block_get{_ext}() and tcf_block_put{_ext}()
  net: sched: extend tcf_block with rcu
  net: sched: protect block idr with spinlock
  net: sched: implement tcf_block_get() and tcf_block_put()
  net: sched: use reference counting for tcf blocks on rules update
  net: sched: add flags to Qdisc class ops struct

 include/linux/rtnetlink.h |   6 +
 include/net/pkt_cls.h     |  36 +++---
 include/net/pkt_sched.h   |   1 +
 include/net/sch_generic.h |  28 ++++-
 net/core/rtnetlink.c      |   6 +
 net/sched/cls_api.c       | 281 ++++++++++++++++++++++++++++++++--------------
 net/sched/sch_api.c       |  24 +++-
 net/sched/sch_atm.c       |  14 +--
 net/sched/sch_cake.c      |   4 +-
 net/sched/sch_cbq.c       |  15 +--
 net/sched/sch_cbs.c       |   2 +-
 net/sched/sch_drr.c       |   8 +-
 net/sched/sch_dsmark.c    |   6 +-
 net/sched/sch_fifo.c      |   2 +-
 net/sched/sch_fq_codel.c  |   4 +-
 net/sched/sch_generic.c   |  48 ++++++--
 net/sched/sch_hfsc.c      |  13 ++-
 net/sched/sch_htb.c       |  17 +--
 net/sched/sch_ingress.c   |  15 +--
 net/sched/sch_mq.c        |   4 +-
 net/sched/sch_mqprio.c    |   4 +-
 net/sched/sch_multiq.c    |  10 +-
 net/sched/sch_netem.c     |   2 +-
 net/sched/sch_prio.c      |  10 +-
 net/sched/sch_qfq.c       |   8 +-
 net/sched/sch_red.c       |   4 +-
 net/sched/sch_sfb.c       |   8 +-
 net/sched/sch_sfq.c       |   4 +-
 net/sched/sch_tbf.c       |   4 +-
 29 files changed, 394 insertions(+), 194 deletions(-)


Powered by blists - more mailing lists