Re: [PATCH net-next 17/17] net: sched: unlock rules update API

2018-11-14 Thread Vlad Buslov
On Wed 14 Nov 2018 at 06:44, Jiri Pirko wrote: > Tue, Nov 13, 2018 at 02:46:54PM CET, vla...@mellanox.com wrote: >>On Mon 12 Nov 2018 at 17:30, David Miller wrote: >>> From: Vlad Buslov >>> Date: Mon, 12 Nov 2018 09:55:46 +0200 >>> >>>> Regi

Re: [PATCH net-next 16/17] net: sched: conditionally take rtnl lock on rules update path

2018-11-13 Thread Vlad Buslov
On Tue 13 Nov 2018 at 13:40, Stefano Brivio wrote: > On Tue, 13 Nov 2018 13:25:52 + > Vlad Buslov wrote: > >> On Tue 13 Nov 2018 at 09:40, Stefano Brivio wrote: >> > Hi Vlad, >> > >> > On Mon, 12 Nov 2018 09:55:45 +0200 >> > Vlad Busl

Re: [PATCH net-next 17/17] net: sched: unlock rules update API

2018-11-13 Thread Vlad Buslov
On Mon 12 Nov 2018 at 17:30, David Miller wrote: > From: Vlad Buslov > Date: Mon, 12 Nov 2018 09:55:46 +0200 > >> Register netlink protocol handlers for message types RTM_NEWTFILTER, >> RTM_DELTFILTER, RTM_GETTFILTER as unlocked. Set rtnl_held variable that >> tracks r

Re: [PATCH net-next 02/17] net: sched: protect block state with spinlock

2018-11-13 Thread Vlad Buslov
On Tue 13 Nov 2018 at 10:07, Stefano Brivio wrote: > Vlad, > > On Mon, 12 Nov 2018 09:28:59 -0800 (PST) > David Miller wrote: > >> From: Vlad Buslov >> Date: Mon, 12 Nov 2018 09:55:31 +0200 >> >&g

Re: [PATCH net-next 16/17] net: sched: conditionally take rtnl lock on rules update path

2018-11-13 Thread Vlad Buslov
On Tue 13 Nov 2018 at 09:40, Stefano Brivio wrote: > Hi Vlad, > > On Mon, 12 Nov 2018 09:55:45 +0200 > Vlad Buslov wrote: > >> @@ -179,9 +179,25 @@ static void tcf_proto_destroy_work(struct work_struct >> *work) >> rtnl_unlock(); >> } >> &

Re: [PATCH net-next 01/17] net: sched: refactor mini_qdisc_pair_swap() to use workqueue

2018-11-13 Thread Vlad Buslov
On Mon 12 Nov 2018 at 17:28, David Miller wrote: > From: Vlad Buslov > Date: Mon, 12 Nov 2018 09:55:30 +0200 > >> +void mini_qdisc_pair_swap(struct mini_Qdisc_pair *miniqp, >> + struct tcf_proto *tp_head) >> +{ >> +xchg(>tp_head, t

[PATCH net-next 00/17] Refactor classifier API to work with chain/classifiers without rtnl lock

2018-11-11 Thread Vlad Buslov
he status of rtnl lock, so their API is extended with additional 'rtnl_held' argument that is used to indicate that caller holds rtnl lock. Vlad Buslov (17): net: sched: refactor mini_qdisc_pair_swap() to use workqueue net: sched: protect block state with spinlock net: sched: refactor tc_

[PATCH net-next 08/17] net: sched: introduce reference counting for tcf proto

2018-11-11 Thread Vlad Buslov
lock for protection. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/sch_generic.h | 1 + net/sched/cls_api.c | 44 +--- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/include/net/sch_generic.h b/include/net

[PATCH net-next 10/17] net: sched: refactor tp insert/delete for concurrent execution

2018-11-11 Thread Vlad Buslov
rom concurrent modification instead of relying on rtnl mutex. Use it to protect 'deleting' flag. Add lockdep macros to validate that lock is held when accessing protected fields. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/sch_generic.h | 18 + net/sched/cls_api.c |

[PATCH net-next 13/17] net: sched: extend proto ops with 'put' callback

2018-11-11 Thread Vlad Buslov
t() only for classifiers that implement it. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/sch_generic.h | 1 + net/sched/cls_api.c | 12 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 10

[PATCH net-next 09/17] net: sched: traverse classifiers in chain with tcf_get_next_proto()

2018-11-11 Thread Vlad Buslov
tor classifier only and doesn't assume external synchronization of filters list. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/pkt_cls.h | 2 ++ net/sched/cls_api.c | 70 +++ net/sched/sch_api.c | 4 +-- 3 files changed,

[PATCH net-next 11/17] net: sched: prevent insertion of new classifiers during chain flush

2018-11-11 Thread Vlad Buslov
tc_new_tfilter() and lookup the chain/proto again. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/sch_generic.h | 1 + net/sched/cls_api.c | 35 ++- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/include/net/sch_generic.h b

[PATCH net-next 17/17] net: sched: unlock rules update API

2018-11-11 Thread Vlad Buslov
and qdisc to function __tcf_block_release() that is used internally by regular block release and by chain update function, which is not unlocked and doesn't need to release rtnl. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- net/sched/cls_api.c | 43 ++- 1

[PATCH net-next 16/17] net: sched: conditionally take rtnl lock on rules update path

2018-11-11 Thread Vlad Buslov
API, instead of new chains API. Add helper function tcf_require_rtnl() to only lock rtnl when specified condition is true and the lock hasn't been taken already. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- net/sched/cls_api.c | 74 + 1

[PATCH net-next 05/17] net: sched: traverse chains in block with tcf_get_next_chain()

2018-11-11 Thread Vlad Buslov
ume external synchronization of chain list. Don't take reference to all chains in block when flushing and use tcf_get_next_chain() to safely iterate over chain list instead. Remove tcf_block_put_all_chains() that is no longer used. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/

[PATCH net-next 15/17] net: sched: add flags to Qdisc class ops struct

2018-11-11 Thread Vlad Buslov
Extend Qdisc_class_ops with flags. Create enum to hold possible class ops flag values. Add first class ops flags value QDISC_CLASS_OPS_DOIT_UNLOCKED to indicate that class ops functions can be called without taking rtnl lock. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net

[PATCH net-next 02/17] net: sched: protect block state with spinlock

2018-11-11 Thread Vlad Buslov
rent users, second actually deallocates chain memory (and parent block, if applicable). Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/sch_generic.h | 4 ++ net/sched/cls_api.c | 93 +++ 2 files changed, 81 insertions(+), 16 deleti

[PATCH net-next 14/17] net: sched: extend proto ops to support unlocked classifiers

2018-11-11 Thread Vlad Buslov
to indicate that classifier doesn't require rtnl lock. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/sch_generic.h | 17 +++--- net/sched/cls_api.c | 85 --- net/sched/cls_basic.c | 12 --- net/sched/cls_bpf.c | 12

[PATCH net-next 04/17] net: sched: protect block->chain0 with block->lock

2018-11-11 Thread Vlad Buslov
In order to remove dependency on rtnl lock, use block->lock to protect chain0 struct from concurrent modification. Rearrange code in chain0 callback add and del functions to only access chain0 when block->lock is held. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- net/sched/cls

[PATCH net-next 06/17] net: sched: protect chain template accesses with block lock

2018-11-11 Thread Vlad Buslov
template values, instead of chains themselves. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- net/sched/cls_api.c | 73 + 1 file changed, 57 insertions(+), 16 deletions(-) diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index

[PATCH net-next 12/17] net: sched: track rtnl lock status when validating extensions

2018-11-11 Thread Vlad Buslov
which is passed to actions API. Add new 'rtnl_held' parameter to tcf_exts_validate() in cls API. No classifier is currently updated to support unlocked execution, so pass hardcoded 'true' flag parameter value. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/pkt_cls.h| 2

[PATCH net-next 01/17] net: sched: refactor mini_qdisc_pair_swap() to use workqueue

2018-11-11 Thread Vlad Buslov
as a chain_head_change callback for ingress and clsact Qdiscs, to use a workqueue. Signed-off-by: Vlad Buslov Suggested-by: Jiri Pirko Acked-by: Jiri Pirko --- include/net/sch_generic.h | 6 ++ net/sched/cls_api.c | 48 +-- net/sched

[PATCH net-next 07/17] net: sched: lock the chain when accessing filter_chain list

2018-11-11 Thread Vlad Buslov
necessary code while holding chain lock in order to prevent invalidation of chain_info structure by potential concurrent change. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/sch_generic.h | 17 net/sched/cls_api.c | 103

[PATCH net-next 03/17] net: sched: refactor tc_ctl_chain() to use block->lock

2018-11-11 Thread Vlad Buslov
In order to remove dependency on rtnl lock, modify chain API to use block->lock to protect chain from concurrent modification. Rearrange tc_ctl_chain() code to call tcf_chain_hold() while holding block->lock. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- net/sched/cls_api.

[PATCH iproute2-next] libnetlink: fix use-after-free of message buf

2018-10-08 Thread Vlad Buslov
ate return value, after memory which err points to has already been freed. Save error code in temporary variable and use the variable to generate return value. Signed-off-by: Vlad Buslov --- lib/libnetlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libnetlink.c b/

[PATCH iproute2-next v2] tc: flower: expose hardware offload count

2018-10-03 Thread Vlad Buslov
Recently flower classifier was updated to expose count of devices that filter is offloaded to. Add support to print this counter as 'in_hw_count'. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- Changes from V1 to V2: - Change print format string to "%u" tc/f_flower.c | 10 +++

Re: [PATCH iproute2-next] tc: flower: expose hardware offload count

2018-10-03 Thread Vlad Buslov
On Wed 03 Oct 2018 at 16:08, Davide Caratti wrote: > On Wed, 2018-10-03 at 18:29 +0300, Vlad Buslov wrote: >> Recently flower classifier was updated to expose count of devices that >> filter is offloaded to. Add support to print this counter as 'in_hw_count'. >> >>

[PATCH iproute2-next] tc: flower: expose hardware offload count

2018-10-03 Thread Vlad Buslov
Recently flower classifier was updated to expose count of devices that filter is offloaded to. Add support to print this counter as 'in_hw_count'. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- tc/f_flower.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tc

Re: [Patch net-next] net_sched: fix an extack message in tcf_block_find()

2018-09-30 Thread Vlad Buslov
On Fri 28 Sep 2018 at 17:03, Cong Wang wrote: > On Fri, Sep 28, 2018 at 4:36 AM Vlad Buslov wrote: >> >> On Thu 27 Sep 2018 at 20:42, Cong Wang wrote: >> > It is clearly a copy-n-paste. >> > >> > Signed-off-by: Cong Wang >> > --- >&

Re: [Patch net-next] net_sched: fix an extack message in tcf_block_find()

2018-09-28 Thread Vlad Buslov
On Thu 27 Sep 2018 at 20:42, Cong Wang wrote: > It is clearly a copy-n-paste. > > Signed-off-by: Cong Wang > --- > net/sched/cls_api.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c > index 3de47e99b788..8dd7f8af6d54 100644 >

[PATCH net-next v3 07/10] net: sched: implement functions to put and flush all chains

2018-09-24 Thread Vlad Buslov
Extract code that flushes and puts all chains on tcf block to two standalone function to be shared with functions that locklessly get/put reference to block. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- net/sched/cls_api.c | 55 + 1

[PATCH net-next v3 08/10] net: sched: protect block idr with spinlock

2018-09-24 Thread Vlad Buslov
Protect block idr access with spinlock, instead of relying on rtnl lock. Take tn->idr_lock spinlock during block insertion and removal. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- net/sched/cls_api.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --

[PATCH net-next v3 10/10] net: sched: use reference counting for tcf blocks on rules update

2018-09-24 Thread Vlad Buslov
users. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- net/sched/cls_api.c | 38 +- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 49e3c10532ad..3de47e99b788 100644 --- a/net/sched/cls_api.c

[PATCH net-next v3 09/10] net: sched: implement tcf_block_refcnt_{get|put}()

2018-09-24 Thread Vlad Buslov
patches in this set, instead of relying on global protection provided by rtnl lock. Extract code that is common with tcf_block_detach_ext() into common function __tcf_block_put(). Extend tcf_block with rcu to allow safe deallocation when it is accessed concurrently. Signed-off-by: Vlad Buslov

[PATCH net-next v3 03/10] net: sched: extend Qdisc with rcu

2018-09-24 Thread Vlad Buslov
() that is called without rtnl lock taken. This function only takes rtnl lock if Qdisc reference counter reached zero and is intended to be used as optimization. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/linux/rtnetlink.h | 5 + include/net/pkt_sched.h | 1 + include/net

[PATCH net-next v3 06/10] net: sched: change tcf block reference counter type to refcount_t

2018-09-24 Thread Vlad Buslov
ins to release, block must still be deallocated manually. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/sch_generic.h | 2 +- net/sched/cls_api.c | 59 --- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/include/

[PATCH net-next v3 02/10] net: sched: rename qdisc_destroy() to qdisc_put()

2018-09-24 Thread Vlad Buslov
code that deallocates Qdisc into new private qdisc_destroy() function. It is intended to be shared between regular qdisc_put() and its unlocked version that is introduced in next patch in this series. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/sch_generic.h | 2 +- net/sched

[PATCH net-next v3 04/10] net: sched: add helper function to take reference to Qdisc

2018-09-24 Thread Vlad Buslov
Implement function to take reference to Qdisc that relies on rcu read lock instead of rtnl mutex. Function only takes reference to Qdisc if reference counter isn't zero. Intended to be used by unlocked cls API. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/sch_generic.h | 13

[PATCH net-next v3 05/10] net: sched: use Qdisc rcu API instead of relying on rtnl lock

2018-09-24 Thread Vlad Buslov
, this function only releases Qdisc and it is extended in next patches in this series. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- net/sched/cls_api.c | 79 +++-- 1 file changed, 64 insertions(+), 15 deletions(-) diff --git a/net/sched/cls_api.c

[PATCH net-next v3 00/10] Refactor classifier API to work with Qdisc/blocks without rtnl lock

2018-09-24 Thread Vlad Buslov
on latest net-next. - Patch 8 - remove. - Patch 9 - fold into patch 11. - Patch 11: - Rename tcf_block_{get|put}() to tcf_block_refcnt_{get|put}(). - Patch 13 - remove. Vlad Buslov (10): net: core: netlink: add helper refcount dec and lock function net: sched: rename qdisc_destroy() to qdisc_put

[PATCH net-next v3 01/10] net: core: netlink: add helper refcount dec and lock function

2018-09-24 Thread Vlad Buslov
wrapper function around refcount_dec_and_lock that obtains rtnl lock if reference counter value reached 0. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/linux/rtnetlink.h | 2 ++ net/core/rtnetlink.c | 6 ++ 2 files changed, 8 insertions(+) diff --git a/include/linux

[PATCH net-next v3 00/10] Refactor classifier API to work with Qdisc/blocks without rtnl lock

2018-09-24 Thread Vlad Buslov
on latest net-next. - Patch 8 - remove. - Patch 9 - fold into patch 11. - Patch 11: - Rename tcf_block_{get|put}() to tcf_block_refcnt_{get|put}(). - Patch 13 - remove. Vlad Buslov (10): net: core: netlink: add helper refcount dec and lock function net: sched: rename qdisc_destroy() to qdisc_put

Re: [PATCH net-next v2 08/10] net: sched: protect block idr with spinlock

2018-09-20 Thread Vlad Buslov
On Wed 19 Sep 2018 at 22:09, Cong Wang wrote: > On Mon, Sep 17, 2018 at 12:19 AM Vlad Buslov wrote: >> @@ -482,16 +483,25 @@ static int tcf_block_insert(struct tcf_block *block, >> struct net *net, >> struct netlink_ext_ack *extack) >>

Re: [PATCH net-next v2 05/10] net: sched: use Qdisc rcu API instead of relying on rtnl lock

2018-09-20 Thread Vlad Buslov
On Wed 19 Sep 2018 at 22:04, Cong Wang wrote: > On Mon, Sep 17, 2018 at 12:19 AM Vlad Buslov wrote: >> +static void tcf_qdisc_put(struct Qdisc *q, bool rtnl_held) >> +{ >> + if (!q) >> + return; >> + >> + if (rtnl_held) >>

[PATCH net-next v2 04/10] net: sched: add helper function to take reference to Qdisc

2018-09-17 Thread Vlad Buslov
Implement function to take reference to Qdisc that relies on rcu read lock instead of rtnl mutex. Function only takes reference to Qdisc if reference counter isn't zero. Intended to be used by unlocked cls API. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/sch_generic.h | 13

[PATCH net-next v2 10/10] net: sched: use reference counting for tcf blocks on rules update

2018-09-17 Thread Vlad Buslov
users. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- net/sched/cls_api.c | 37 - 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 0a7a3ace2da9..6a3eec5dbdf1 100644 --- a/net/sched/cls_api.c

[PATCH net-next v2 07/10] net: sched: implement functions to put and flush all chains

2018-09-17 Thread Vlad Buslov
Extract code that flushes and puts all chains on tcf block to two standalone function to be shared with functions that locklessly get/put reference to block. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- net/sched/cls_api.c | 55 + 1

[PATCH net-next v2 01/10] net: core: netlink: add helper refcount dec and lock function

2018-09-17 Thread Vlad Buslov
wrapper function around refcount_dec_and_lock that obtains rtnl lock if reference counter value reached 0. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/linux/rtnetlink.h | 1 + net/core/rtnetlink.c | 6 ++ 2 files changed, 7 insertions(+) diff --git a/include/linux

[PATCH net-next v2 09/10] net: sched: implement tcf_block_refcnt_{get|put}()

2018-09-17 Thread Vlad Buslov
patches in this set, instead of relying on global protection provided by rtnl lock. Extract code that is common with tcf_block_detach_ext() into common function __tcf_block_put(). Extend tcf_block with rcu to allow safe deallocation when it is accessed concurrently. Signed-off-by: Vlad Buslov

[PATCH net-next v2 03/10] net: sched: extend Qdisc with rcu

2018-09-17 Thread Vlad Buslov
() that is called without rtnl lock taken. This function only takes rtnl lock if Qdisc reference counter reached zero and is intended to be used as optimization. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/linux/rtnetlink.h | 5 + include/net/pkt_sched.h | 1 + include/net

[PATCH net-next v2 05/10] net: sched: use Qdisc rcu API instead of relying on rtnl lock

2018-09-17 Thread Vlad Buslov
, this function only releases Qdisc and it is extended in next patches in this series. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- net/sched/cls_api.c | 88 - 1 file changed, 73 insertions(+), 15 deletions(-) diff --git a/net/sched/cls_api.c

[PATCH net-next v2 02/10] net: sched: rename qdisc_destroy() to qdisc_put()

2018-09-17 Thread Vlad Buslov
code that deallocates Qdisc into new private qdisc_destroy() function. It is intended to be shared between regular qdisc_put() and its unlocked version that is introduced in next patch in this series. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/sch_generic.h | 2 +- net/sched

[PATCH net-next v2 08/10] net: sched: protect block idr with spinlock

2018-09-17 Thread Vlad Buslov
Protect block idr access with spinlock, instead of relying on rtnl lock. Take tn->idr_lock spinlock during block insertion and removal. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- net/sched/cls_api.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --

[PATCH net-next v2 06/10] net: sched: change tcf block reference counter type to refcount_t

2018-09-17 Thread Vlad Buslov
ins to release, block must still be deallocated manually. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/sch_generic.h | 2 +- net/sched/cls_api.c | 59 --- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/include/

[PATCH net-next v2 00/10] Refactor classifier API to work with Qdisc/blocks without rtnl lock

2018-09-17 Thread Vlad Buslov
: - Rebase on latest net-next. - Patch 8 - remove. - Patch 9 - fold into patch 11. - Patch 11: - Rename tcf_block_{get|put}() to tcf_block_refcnt_{get|put}(). - Patch 13 - remove. Vlad Buslov (10): net: core: netlink: add helper refcount dec and lock function net: sched: rename qdisc_destroy

Re: [PATCH net-next v2] net: sched: change tcf_del_walker() to take idrinfo->lock

2018-09-14 Thread Vlad Buslov
On Thu 13 Sep 2018 at 17:13, Cong Wang wrote: > On Wed, Sep 12, 2018 at 1:51 AM Vlad Buslov wrote: >> >> >> On Fri 07 Sep 2018 at 19:12, Cong Wang wrote: >> > On Fri, Sep 7, 2018 at 6:52 AM Vlad Buslov wrote: >> >> >> >> Acti

Re: [PATCH net-next 08/13] net: sched: rename tcf_block_get{_ext}() and tcf_block_put{_ext}()

2018-09-14 Thread Vlad Buslov
On Thu 13 Sep 2018 at 17:21, Cong Wang wrote: > On Wed, Sep 12, 2018 at 1:24 AM Vlad Buslov wrote: >> >> >> On Fri 07 Sep 2018 at 20:09, Cong Wang wrote: >> > On Thu, Sep 6, 2018 at 12:59 AM Vlad Buslov wrote: >> >> >> >> Functions tc

Re: [PATCH net-next v2] net: sched: change tcf_del_walker() to take idrinfo->lock

2018-09-12 Thread Vlad Buslov
On Fri 07 Sep 2018 at 19:12, Cong Wang wrote: > On Fri, Sep 7, 2018 at 6:52 AM Vlad Buslov wrote: >> >> Action API was changed to work with actions and action_idr in concurrency >> safe manner, however tcf_del_walker() still uses actions without taking a >> refer

Re: [PATCH net-next 13/13] net: sched: add flags to Qdisc class ops struct

2018-09-12 Thread Vlad Buslov
On Fri 07 Sep 2018 at 19:50, Cong Wang wrote: > On Thu, Sep 6, 2018 at 12:59 AM Vlad Buslov wrote: >> >> Extend Qdisc_class_ops with flags. Create enum to hold possible class ops >> flag values. Add first class ops flags value QDISC_CLASS_OPS_DOIT_UNLOCKED >>

Re: [PATCH net-next 09/13] net: sched: extend tcf_block with rcu

2018-09-12 Thread Vlad Buslov
On Fri 07 Sep 2018 at 19:52, Cong Wang wrote: > On Thu, Sep 6, 2018 at 12:59 AM Vlad Buslov wrote: >> >> Extend tcf_block with rcu to allow safe deallocation when it is accessed >> concurrently. > > This sucks, please fold this patch into where you call rcu

Re: [PATCH net-next 08/13] net: sched: rename tcf_block_get{_ext}() and tcf_block_put{_ext}()

2018-09-12 Thread Vlad Buslov
On Fri 07 Sep 2018 at 20:09, Cong Wang wrote: > On Thu, Sep 6, 2018 at 12:59 AM Vlad Buslov wrote: >> >> Functions tcf_block_get{_ext}() and tcf_block_put{_ext}() actually >> attach/detach block to specific Qdisc besides just taking/putting >> reference. Rename them

[PATCH net-next v2] net: sched: cls_flower: dump offload count value

2018-09-07 Thread Vlad Buslov
Change flower in_hw_count type to fixed-size u32 and dump it as TCA_FLOWER_IN_HW_COUNT. This change is necessary to properly test shared blocks and re-offload functionality. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/sch_generic.h| 2 +- include/uapi/linux/pkt_cls.h

[PATCH net-next v2] net: sched: change tcf_del_walker() to take idrinfo->lock

2018-09-07 Thread Vlad Buslov
nfo->lock while iterating over actions and use new tcf_idr_release_unsafe() to release them while holding the lock. Signed-off-by: Vlad Buslov --- include/net/act_api.h | 1 + net/sched/act_api.c | 73 --- 2 files changed, 65 insertions(+), 9 del

Re: [PATCH net-next] net: sched: cls_flower: dump offload count value

2018-09-07 Thread Vlad Buslov
On Fri 07 Sep 2018 at 09:11, Jakub Kicinski wrote: > On Thu, 6 Sep 2018 18:37:23 +0300, Vlad Buslov wrote: >> Change flower in_hw_count type to fixed-size u32 and dump it as >> TCA_FLOWER_IN_HW_COUNT. This change is necessary to properly test shared >> blocks and re-

[PATCH net-next] net: sched: cls_flower: dump offload count value

2018-09-06 Thread Vlad Buslov
Change flower in_hw_count type to fixed-size u32 and dump it as TCA_FLOWER_IN_HW_COUNT. This change is necessary to properly test shared blocks and re-offload functionality. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/sch_generic.h| 2 +- include/uapi/linux/pkt_cls.h

Re: [PATCH net-next] net: sched: change tcf_del_walker() to use concurrent-safe delete

2018-09-06 Thread Vlad Buslov
On Wed 05 Sep 2018 at 20:32, Cong Wang wrote: > On Wed, Sep 5, 2018 at 12:05 AM Vlad Buslov wrote: >> >> >> On Tue 04 Sep 2018 at 22:41, Cong Wang wrote: >> > On Mon, Sep 3, 2018 at 1:33 PM Vlad Buslov wrote: >> >> >> >> >> >

Re: [PATCH net-next 03/13] net: sched: extend Qdisc with rcu

2018-09-06 Thread Vlad Buslov
On Thu 06 Sep 2018 at 08:39, Kirill Tkhai wrote: > On 06.09.2018 11:30, Eric Dumazet wrote: >> >> >> On 09/06/2018 12:58 AM, Vlad Buslov wrote: >> >> ... >> >>> diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h >>>

[PATCH net-next 06/13] net: sched: change tcf block reference counter type to refcount_t

2018-09-06 Thread Vlad Buslov
ins to release, block must still be deallocated manually. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/sch_generic.h | 2 +- net/sched/cls_api.c | 59 --- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/include/

[PATCH net-next 01/13] net: core: netlink: add helper refcount dec and lock function

2018-09-06 Thread Vlad Buslov
wrapper function around refcount_dec_and_lock that obtains rtnl lock if reference counter value reached 0. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/linux/rtnetlink.h | 1 + net/core/rtnetlink.c | 6 ++ 2 files changed, 7 insertions(+) diff --git a/include/linux

[PATCH net-next 04/13] net: sched: add helper function to take reference to Qdisc

2018-09-06 Thread Vlad Buslov
Implement function to take reference to Qdisc that relies on rcu read lock instead of rtnl mutex. Function only takes reference to Qdisc if reference counter isn't zero. Intended to be used by unlocked cls API. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/sch_generic.h | 13

[PATCH net-next 10/13] net: sched: protect block idr with spinlock

2018-09-06 Thread Vlad Buslov
Protect block idr access with spinlock, instead of relying on rtnl lock. Take tn->idr_lock spinlock during block insertion and removal. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- net/sched/cls_api.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --

[PATCH net-next 00/13] Refactor classifier API to work with Qdisc/blocks without rtnl lock

2018-09-06 Thread Vlad Buslov
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

[PATCH net-next 03/13] net: sched: extend Qdisc with rcu

2018-09-06 Thread Vlad Buslov
() that is called without rtnl lock taken. This function only takes rtnl lock if Qdisc reference counter reached zero and is intended to be used as optimization. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/linux/rtnetlink.h | 5 + include/net/pkt_sched.h | 1 + include/net

[PATCH net-next 07/13] net: sched: implement functions to put and flush all chains

2018-09-06 Thread Vlad Buslov
Extract code that flushes and puts all chains on tcf block to two standalone function to be shared with functions that locklessly get/put reference to block. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- net/sched/cls_api.c | 55 + 1

[PATCH net-next 11/13] net: sched: implement tcf_block_get() and tcf_block_put()

2018-09-06 Thread Vlad Buslov
patches in this set, instead of relying on global protection provided by rtnl lock. Extract code that is common with tcf_block_detach_ext() into common function __tcf_block_put(). Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- net/sched/cls_api.c | 70

[PATCH net-next 08/13] net: sched: rename tcf_block_get{_ext}() and tcf_block_put{_ext}()

2018-09-06 Thread Vlad Buslov
Functions tcf_block_get{_ext}() and tcf_block_put{_ext}() actually attach/detach block to specific Qdisc besides just taking/putting reference. Rename them according to their purpose. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/pkt_cls.h| 36

[PATCH net-next 02/13] net: sched: rename qdisc_destroy() to qdisc_put()

2018-09-06 Thread Vlad Buslov
code that deallocates Qdisc into new private qdisc_destroy() function. It is intended to be shared between regular qdisc_put() and its unlocked version that is introduced in next patch in this series. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/sch_generic.h | 2 +- net/sched

[PATCH net-next 13/13] net: sched: add flags to Qdisc class ops struct

2018-09-06 Thread Vlad Buslov
Extend Qdisc_class_ops with flags. Create enum to hold possible class ops flag values. Add first class ops flags value QDISC_CLASS_OPS_DOIT_UNLOCKED to indicate that class ops functions can be called without taking rtnl lock. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net

[PATCH net-next 12/13] net: sched: use reference counting for tcf blocks on rules update

2018-09-06 Thread Vlad Buslov
users. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- net/sched/cls_api.c | 37 - 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 5d9f91331d26..8808818a1d24 100644 --- a/net/sched/cls_api.c

[PATCH net-next 09/13] net: sched: extend tcf_block with rcu

2018-09-06 Thread Vlad Buslov
Extend tcf_block with rcu to allow safe deallocation when it is accessed concurrently. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- include/net/sch_generic.h | 1 + net/sched/cls_api.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/net

[PATCH net-next 05/13] net: sched: use Qdisc rcu API instead of relying on rtnl lock

2018-09-06 Thread Vlad Buslov
, this function only releases Qdisc and it is extended in next patches in this series. Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko --- net/sched/cls_api.c | 88 - 1 file changed, 73 insertions(+), 15 deletions(-) diff --git a/net/sched/cls_api.c

Re: [PATCH net-next] net: sched: change tcf_del_walker() to use concurrent-safe delete

2018-09-05 Thread Vlad Buslov
On Tue 04 Sep 2018 at 22:41, Cong Wang wrote: > On Mon, Sep 3, 2018 at 1:33 PM Vlad Buslov wrote: >> >> >> On Mon 03 Sep 2018 at 18:50, Cong Wang wrote: >> > On Mon, Sep 3, 2018 at 12:06 AM Vlad Buslov wrote: >> >> >> >> Acti

[PATCH net-next v2] net: sched: action_ife: take reference to meta module

2018-09-03 Thread Vlad Buslov
led at (6082): [] tcf_ife_cleanup+0x39/0x200 [act_ife] [ 646.878845] ---[ end trace b1b8c12ffe51e657 ]--- Fixes: 5ffe57da29b3 ("act_ife: fix a potential deadlock") Signed-off-by: Vlad Buslov --- Changes V1->V2: - fold constants into helper function net/sched/act_ife.c | 16 +++

Re: [PATCH net-next] net: sched: change tcf_del_walker() to use concurrent-safe delete

2018-09-03 Thread Vlad Buslov
On Mon 03 Sep 2018 at 18:50, Cong Wang wrote: > On Mon, Sep 3, 2018 at 12:06 AM Vlad Buslov wrote: >> >> Action API was changed to work with actions and action_idr in concurrency >> safe manner, however tcf_del_walker() still uses actions without taking >> referenc

Re: [PATCH net-next] net: sched: action_ife: take reference to meta module

2018-09-03 Thread Vlad Buslov
On Mon 03 Sep 2018 at 17:03, Cong Wang wrote: > On Mon, Sep 3, 2018 at 12:10 AM Vlad Buslov wrote: >> >> Recent refactoring of add_metainfo() caused use_all_metadata() to add >> metainfo to ife action metalist without taking reference to module. This >> causes warnin

[PATCH net-next] net: sched: action_ife: take reference to meta module

2018-09-03 Thread Vlad Buslov
led at (6082): [] tcf_ife_cleanup+0x39/0x200 [act_ife] [ 646.878845] ---[ end trace b1b8c12ffe51e657 ]--- Fixes: 5ffe57da29b3 ("act_ife: fix a potential deadlock") Signed-off-by: Vlad Buslov --- net/sched/act_ife.c | 18 +- 1 file changed, 17 insertions(+), 1 deletio

[PATCH net-next] net: sched: act_nat: remove dependency on rtnl lock

2018-09-03 Thread Vlad Buslov
According to the new locking rule, we have to take tcf_lock for both ->init() and ->dump(), as RTNL will be removed. Use tcf spinlock to protect private nat action data from concurrent modification during dump. (nat init already uses tcf spinlock when changing action state) Signed-off-by

[PATCH net-next] net: sched: act_skbedit: remove dependency on rtnl lock

2018-09-03 Thread Vlad Buslov
of tcf lock. (old params value is not used by init, so there is no need of standalone rcu dereference step) Remove rtnl lock assertion that is no longer required. Signed-off-by: Vlad Buslov --- net/sched/act_skbedit.c | 23 ++- 1 file changed, 14 insertions(+), 9 deletions(-)

[PATCH net-next] net: sched: change tcf_del_walker() to use concurrent-safe delete

2018-09-03 Thread Vlad Buslov
. Signed-off-by: Vlad Buslov --- net/sched/act_api.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 398c752ff529..d593114e7d2f 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -246,6 +246,8 @@ static int

[PATCH net-next] net: sched: null actions array pointer before releasing action

2018-09-03 Thread Vlad Buslov
08.014230] == [ 808.022108] Disabling lock debugging due to kernel taint Fixes: edfaf94fa705 ("net_sched: improve and refactor tcf_action_put_many()") Signed-off-by: Vlad Buslov --- net/sched/act_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sched/ac

Re: [Patch net-nnext] net_sched: add missing tcf_lock for act_connmark

2018-08-30 Thread Vlad Buslov
On Wed 29 Aug 2018 at 17:15, Cong Wang wrote: > According to the new locking rule, we have to take tcf_lock > for both ->init() and ->dump(), as RTNL will be removed. > However, it is missing for act_connmark. Thank you for finding and fixing this! > > Cc: Vlad Buslov

[PATCH net-next] net: sched: always disable bh when taking tcf_lock

2018-08-14 Thread Vlad Buslov
"net: sched: act_csum: remove dependency on rtnl lock") Fixes: 2142236b4584 ("net: sched: act_bpf: remove dependency on rtnl lock") Signed-off-by: Vlad Buslov --- net/sched/act_bpf.c| 10 +- net/sched/act_csum.c | 10 +- net/sched/act_gact

Re: [PATCH net-next] net: sched: act_ife: disable bh when taking ife_mod_lock

2018-08-14 Thread Vlad Buslov
On Mon 13 Aug 2018 at 23:18, Cong Wang wrote: > Hi, Vlad, > > Could you help to test my fixes? > > I just pushed them into my own git repo: > https://github.com/congwang/linux/commits/net-sched-fixes > > Particularly, this is the revert: >

[PATCH net-next] net: sched: act_ife: always release ife action on init error

2018-08-14 Thread Vlad Buslov
in case of overwrite. Fixes: 4e8ddd7f1758 ("net: sched: don't release reference on action overwrite") Reported-by: Cong Wang Signed-off-by: Vlad Buslov --- net/sched/act_ife.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/net/sched/act_ife.c b/net/sched

Re: [PATCH net-next v6 08/11] net: sched: don't release reference on action overwrite

2018-08-14 Thread Vlad Buslov
On Mon 13 Aug 2018 at 23:00, Cong Wang wrote: > On Thu, Jul 5, 2018 at 7:24 AM Vlad Buslov wrote: >> diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c >> index 89a761395c94..acea3feae762 100644 >> --- a/net/sched/act_ife.c >> +++ b/net/sched/act_ife.c > ... >

Re: [PATCH net-next] net: sched: act_ife: disable bh when taking ife_mod_lock

2018-08-13 Thread Vlad Buslov
On Mon 13 Aug 2018 at 17:23, Jamal Hadi Salim wrote: > On 2018-08-13 1:20 p.m., Vlad Buslov wrote: >> Lockdep reports deadlock for following locking scenario in ife action: >> >> Task one: >> 1) Executes ife action update. >> 2) Takes tcfa_lock. >> 3)

Re: [PATCH net-next] net: sched: act_ife: disable bh when taking ife_mod_lock

2018-08-13 Thread Vlad Buslov
Hi David, Is it okay to submit a fix for issue I uncovered when testing actions with estimators, or I should resubmit to net when net-next is moved? Thanks, Vlad

[PATCH net-next] net: sched: act_ife: disable bh when taking ife_mod_lock

2018-08-13 Thread Vlad Buslov
7902]do_syscall_64+0x7a/0x3f0 [ 509.342116]entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 509.349601] stack backtrace: [ 509.354663] CPU: 6 PID: 5460 Comm: tc Not tainted 4.18.0-rc8+ #646 [ 509.361216] Hardware name: Supermicro SYS-2028TP-DECR/X10DRT-P, BIOS 2.0b 03/30/2017

Re: [PATCH net-next v6 10/11] net: sched: atomically check-allocate action

2018-08-13 Thread Vlad Buslov
On Fri 10 Aug 2018 at 21:45, Cong Wang wrote: > On Fri, Aug 10, 2018 at 3:29 AM Vlad Buslov wrote: >> >> Approach you suggest is valid, but has its own trade-offs: >> >> - As you noted, lock granularity becomes coarse-grained due to per-netns >> scope. > &

[PATCH net-next v2 10/15] net: sched: act_tunnel_key: remove dependency on rtnl lock

2018-08-10 Thread Vlad Buslov
lock assertion that is no longer required. Signed-off-by: Vlad Buslov --- net/sched/act_tunnel_key.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c index d42d9e112789..ba2ae9f75ef5 100644

  1   2   3   >