netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: sched: ingress: set 'unlocked' flag for Qdisc ops
@ 2019-06-12  7:14 Vlad Buslov
  2019-06-12 16:28 ` David Miller
  2019-06-12 16:33 ` Daniel Borkmann
  0 siblings, 2 replies; 5+ messages in thread
From: Vlad Buslov @ 2019-06-12  7:14 UTC (permalink / raw)
  To: netdev; +Cc: jhs, xiyou.wangcong, jiri, davem, Vlad Buslov

To remove rtnl lock dependency in tc filter update API when using ingress
Qdisc, set QDISC_CLASS_OPS_DOIT_UNLOCKED flag in ingress Qdisc_class_ops.

Ingress Qdisc ops don't require any modifications to be used without rtnl
lock on tc filter update path. Ingress implementation never changes its
q->block and only releases it when Qdisc is being destroyed. This means it
is enough for RTM_{NEWTFILTER|DELTFILTER|GETTFILTER} message handlers to
hold ingress Qdisc reference while using it without relying on rtnl lock
protection. Unlocked Qdisc ops support is already implemented in filter
update path by unlocked cls API patch set.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
---
 net/sched/sch_ingress.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
index 0f65f617756b..d5382554e281 100644
--- a/net/sched/sch_ingress.c
+++ b/net/sched/sch_ingress.c
@@ -114,6 +114,7 @@ static int ingress_dump(struct Qdisc *sch, struct sk_buff *skb)
 }
 
 static const struct Qdisc_class_ops ingress_class_ops = {
+	.flags		=	QDISC_CLASS_OPS_DOIT_UNLOCKED,
 	.leaf		=	ingress_leaf,
 	.find		=	ingress_find,
 	.walk		=	ingress_walk,
-- 
2.21.0


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

* Re: [PATCH net-next] net: sched: ingress: set 'unlocked' flag for Qdisc ops
  2019-06-12  7:14 [PATCH net-next] net: sched: ingress: set 'unlocked' flag for Qdisc ops Vlad Buslov
@ 2019-06-12 16:28 ` David Miller
  2019-06-12 16:33 ` Daniel Borkmann
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2019-06-12 16:28 UTC (permalink / raw)
  To: vladbu; +Cc: netdev, jhs, xiyou.wangcong, jiri

From: Vlad Buslov <vladbu@mellanox.com>
Date: Wed, 12 Jun 2019 10:14:35 +0300

> To remove rtnl lock dependency in tc filter update API when using ingress
> Qdisc, set QDISC_CLASS_OPS_DOIT_UNLOCKED flag in ingress Qdisc_class_ops.
> 
> Ingress Qdisc ops don't require any modifications to be used without rtnl
> lock on tc filter update path. Ingress implementation never changes its
> q->block and only releases it when Qdisc is being destroyed. This means it
> is enough for RTM_{NEWTFILTER|DELTFILTER|GETTFILTER} message handlers to
> hold ingress Qdisc reference while using it without relying on rtnl lock
> protection. Unlocked Qdisc ops support is already implemented in filter
> update path by unlocked cls API patch set.
> 
> Signed-off-by: Vlad Buslov <vladbu@mellanox.com>

Applied.

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

* Re: [PATCH net-next] net: sched: ingress: set 'unlocked' flag for Qdisc ops
  2019-06-12  7:14 [PATCH net-next] net: sched: ingress: set 'unlocked' flag for Qdisc ops Vlad Buslov
  2019-06-12 16:28 ` David Miller
@ 2019-06-12 16:33 ` Daniel Borkmann
  2019-06-13  7:06   ` Vlad Buslov
  1 sibling, 1 reply; 5+ messages in thread
From: Daniel Borkmann @ 2019-06-12 16:33 UTC (permalink / raw)
  To: Vlad Buslov, netdev; +Cc: jhs, xiyou.wangcong, jiri, davem, alexei.starovoitov

On 06/12/2019 09:14 AM, Vlad Buslov wrote:
> To remove rtnl lock dependency in tc filter update API when using ingress
> Qdisc, set QDISC_CLASS_OPS_DOIT_UNLOCKED flag in ingress Qdisc_class_ops.
> 
> Ingress Qdisc ops don't require any modifications to be used without rtnl
> lock on tc filter update path. Ingress implementation never changes its
> q->block and only releases it when Qdisc is being destroyed. This means it
> is enough for RTM_{NEWTFILTER|DELTFILTER|GETTFILTER} message handlers to
> hold ingress Qdisc reference while using it without relying on rtnl lock
> protection. Unlocked Qdisc ops support is already implemented in filter
> update path by unlocked cls API patch set.
> 
> Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
> ---
>  net/sched/sch_ingress.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
> index 0f65f617756b..d5382554e281 100644
> --- a/net/sched/sch_ingress.c
> +++ b/net/sched/sch_ingress.c
> @@ -114,6 +114,7 @@ static int ingress_dump(struct Qdisc *sch, struct sk_buff *skb)
>  }
>  
>  static const struct Qdisc_class_ops ingress_class_ops = {
> +	.flags		=	QDISC_CLASS_OPS_DOIT_UNLOCKED,
>  	.leaf		=	ingress_leaf,
>  	.find		=	ingress_find,
>  	.walk		=	ingress_walk,
> 

Vlad, why is clsact_class_ops not updated here? Please elaborate!

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

* Re: [PATCH net-next] net: sched: ingress: set 'unlocked' flag for Qdisc ops
  2019-06-12 16:33 ` Daniel Borkmann
@ 2019-06-13  7:06   ` Vlad Buslov
  2019-06-13  8:27     ` Daniel Borkmann
  0 siblings, 1 reply; 5+ messages in thread
From: Vlad Buslov @ 2019-06-13  7:06 UTC (permalink / raw)
  To: Daniel Borkmann
  Cc: Vlad Buslov, netdev, jhs, xiyou.wangcong, jiri, davem,
	alexei.starovoitov


On Wed 12 Jun 2019 at 19:33, Daniel Borkmann <daniel@iogearbox.net> wrote:
> On 06/12/2019 09:14 AM, Vlad Buslov wrote:
>> To remove rtnl lock dependency in tc filter update API when using ingress
>> Qdisc, set QDISC_CLASS_OPS_DOIT_UNLOCKED flag in ingress Qdisc_class_ops.
>>
>> Ingress Qdisc ops don't require any modifications to be used without rtnl
>> lock on tc filter update path. Ingress implementation never changes its
>> q->block and only releases it when Qdisc is being destroyed. This means it
>> is enough for RTM_{NEWTFILTER|DELTFILTER|GETTFILTER} message handlers to
>> hold ingress Qdisc reference while using it without relying on rtnl lock
>> protection. Unlocked Qdisc ops support is already implemented in filter
>> update path by unlocked cls API patch set.
>>
>> Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
>> ---
>>  net/sched/sch_ingress.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
>> index 0f65f617756b..d5382554e281 100644
>> --- a/net/sched/sch_ingress.c
>> +++ b/net/sched/sch_ingress.c
>> @@ -114,6 +114,7 @@ static int ingress_dump(struct Qdisc *sch, struct sk_buff *skb)
>>  }
>>
>>  static const struct Qdisc_class_ops ingress_class_ops = {
>> +	.flags		=	QDISC_CLASS_OPS_DOIT_UNLOCKED,
>>  	.leaf		=	ingress_leaf,
>>  	.find		=	ingress_find,
>>  	.walk		=	ingress_walk,
>>
>
> Vlad, why is clsact_class_ops not updated here? Please elaborate!

Daniel, no particular reason to not enable unlocked execution for
clsact. I set the unlocked flag for ingress because that was the Qdisc
that I tested all my parallel tc changes on. However, ingress and clsact
implementations are quite similar, so I can send a followup patch that
updates clsact_class_ops, if you want.

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

* Re: [PATCH net-next] net: sched: ingress: set 'unlocked' flag for Qdisc ops
  2019-06-13  7:06   ` Vlad Buslov
@ 2019-06-13  8:27     ` Daniel Borkmann
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Borkmann @ 2019-06-13  8:27 UTC (permalink / raw)
  To: Vlad Buslov; +Cc: netdev, jhs, xiyou.wangcong, jiri, davem, alexei.starovoitov

On 06/13/2019 09:06 AM, Vlad Buslov wrote:
> On Wed 12 Jun 2019 at 19:33, Daniel Borkmann <daniel@iogearbox.net> wrote:
>> On 06/12/2019 09:14 AM, Vlad Buslov wrote:
>>> To remove rtnl lock dependency in tc filter update API when using ingress
>>> Qdisc, set QDISC_CLASS_OPS_DOIT_UNLOCKED flag in ingress Qdisc_class_ops.
>>>
>>> Ingress Qdisc ops don't require any modifications to be used without rtnl
>>> lock on tc filter update path. Ingress implementation never changes its
>>> q->block and only releases it when Qdisc is being destroyed. This means it
>>> is enough for RTM_{NEWTFILTER|DELTFILTER|GETTFILTER} message handlers to
>>> hold ingress Qdisc reference while using it without relying on rtnl lock
>>> protection. Unlocked Qdisc ops support is already implemented in filter
>>> update path by unlocked cls API patch set.
>>>
>>> Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
>>> ---
>>>  net/sched/sch_ingress.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
>>> index 0f65f617756b..d5382554e281 100644
>>> --- a/net/sched/sch_ingress.c
>>> +++ b/net/sched/sch_ingress.c
>>> @@ -114,6 +114,7 @@ static int ingress_dump(struct Qdisc *sch, struct sk_buff *skb)
>>>  }
>>>
>>>  static const struct Qdisc_class_ops ingress_class_ops = {
>>> +	.flags		=	QDISC_CLASS_OPS_DOIT_UNLOCKED,
>>>  	.leaf		=	ingress_leaf,
>>>  	.find		=	ingress_find,
>>>  	.walk		=	ingress_walk,
>>>
>>
>> Vlad, why is clsact_class_ops not updated here? Please elaborate!
> 
> Daniel, no particular reason to not enable unlocked execution for
> clsact. I set the unlocked flag for ingress because that was the Qdisc
> that I tested all my parallel tc changes on. However, ingress and clsact
> implementations are quite similar, so I can send a followup patch that
> updates clsact_class_ops, if you want.

Yes, please do, they are pretty much the same except that clsact supersedes
ingress in that it also offers an egress hook.

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

end of thread, other threads:[~2019-06-13 16:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-12  7:14 [PATCH net-next] net: sched: ingress: set 'unlocked' flag for Qdisc ops Vlad Buslov
2019-06-12 16:28 ` David Miller
2019-06-12 16:33 ` Daniel Borkmann
2019-06-13  7:06   ` Vlad Buslov
2019-06-13  8:27     ` Daniel Borkmann

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).