From: Jiri Pirko <jiri@resnulli.us>
To: Vlad Buslov <vladbu@mellanox.com>
Cc: David Miller <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"jhs@mojatatu.com" <jhs@mojatatu.com>,
"xiyou.wangcong@gmail.com" <xiyou.wangcong@gmail.com>,
"ast@kernel.org" <ast@kernel.org>,
"daniel@iogearbox.net" <daniel@iogearbox.net>
Subject: Re: [PATCH net-next 17/17] net: sched: unlock rules update API
Date: Wed, 14 Nov 2018 07:44:53 +0100 [thread overview]
Message-ID: <20181114064453.GA2235@nanopsycho.orion> (raw)
In-Reply-To: <vbfftw5jdit.fsf@reg-r-vrt-018-180.mtr.labs.mlnx>
Tue, Nov 13, 2018 at 02:46:54PM CET, vladbu@mellanox.com wrote:
>On Mon 12 Nov 2018 at 17:30, David Miller <davem@davemloft.net> wrote:
>> From: Vlad Buslov <vladbu@mellanox.com>
>> 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 rtnl mutex state to be false by default.
>>
>> This whole conditional locking mechanism is really not clean and makes
>> this code so much harder to understand and audit.
>>
>> Please improve the code so that this kind of construct is not needed.
>>
>> Thank you.
>
>Hi David,
>
>I considered several approaches to this problem and decided that this
>one is most straightforward to implement. I understand your concern and
>agree that this code is not easiest to understand and can suggest
>several possible solutions that do not require this kind of elaborate
>locking mechanism in cls API, but have their own drawbacks:
>
>1. Convert all qdiscs and classifiers to support unlocked execution,
>like we did for actions. However, according to my experience with
>converting flower classifier, these require much more code than actions.
>I would estimate it to be more work than whole current unlocking effort
>(hundred+ patches). Also, authors of some of them might be unhappy with
>such intrusive changes. I don't think this approach is realistic.
>
>2. Somehow determine if rtnl is needed at the beginning of cls API rule
>update functions. Currently, this is not possible because locking
>requirements are determined by qdisc_class_ops and tcf_proto_ops 'flags'
>field, which requires code to first do whole ops lookup sequence.
>However, instead of class field I can put 'flags' in some kind of hash
>table or array that will map qdisc/classifier type string to flags, so
>it will be possible to determine locking requirements by just parsing
>netlink message and obtaining flags by qdisc/classifier type. I do not
>consider it pretty solution either, but maybe you have different
>opinion.
I think you will have to do 2. or some modification. Can't you just
check for cls ability to run unlocked early on in tc_new_tfilter()?
You would call tcf_proto_locking_check(nla_data(tca[TCA_KIND]), ...),
which would do tcf_proto_lookup_ops() for ops and check the flags?
>
>3. Anything you can suggest? I might be missing something simple that
>you would consider more elegant solution to this problem.
>
>Thanks,
>Vlad
>
next prev parent reply other threads:[~2018-11-14 16:53 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-12 7:55 [PATCH net-next 00/17] Refactor classifier API to work with chain/classifiers without rtnl lock Vlad Buslov
2018-11-12 7:55 ` [PATCH net-next 01/17] net: sched: refactor mini_qdisc_pair_swap() to use workqueue Vlad Buslov
2018-11-12 17:28 ` David Miller
2018-11-13 13:13 ` Vlad Buslov
2018-11-13 16:08 ` David Miller
2018-11-12 7:55 ` [PATCH net-next 02/17] net: sched: protect block state with spinlock Vlad Buslov
2018-11-12 17:28 ` David Miller
2018-11-13 10:07 ` Stefano Brivio
2018-11-13 13:28 ` Vlad Buslov
2018-11-12 7:55 ` [PATCH net-next 03/17] net: sched: refactor tc_ctl_chain() to use block->lock Vlad Buslov
2018-11-12 7:55 ` [PATCH net-next 04/17] net: sched: protect block->chain0 with block->lock Vlad Buslov
2018-11-12 7:55 ` [PATCH net-next 05/17] net: sched: traverse chains in block with tcf_get_next_chain() Vlad Buslov
2018-11-12 7:55 ` [PATCH net-next 06/17] net: sched: protect chain template accesses with block lock Vlad Buslov
2018-11-12 7:55 ` [PATCH net-next 07/17] net: sched: lock the chain when accessing filter_chain list Vlad Buslov
2018-11-12 7:55 ` [PATCH net-next 08/17] net: sched: introduce reference counting for tcf proto Vlad Buslov
2018-11-12 7:55 ` [PATCH net-next 09/17] net: sched: traverse classifiers in chain with tcf_get_next_proto() Vlad Buslov
2018-11-12 7:55 ` [PATCH net-next 10/17] net: sched: refactor tp insert/delete for concurrent execution Vlad Buslov
2018-11-12 7:55 ` [PATCH net-next 11/17] net: sched: prevent insertion of new classifiers during chain flush Vlad Buslov
2018-11-12 7:55 ` [PATCH net-next 12/17] net: sched: track rtnl lock status when validating extensions Vlad Buslov
2018-11-12 7:55 ` [PATCH net-next 13/17] net: sched: extend proto ops with 'put' callback Vlad Buslov
2018-11-12 7:55 ` [PATCH net-next 14/17] net: sched: extend proto ops to support unlocked classifiers Vlad Buslov
2018-11-12 7:55 ` [PATCH net-next 15/17] net: sched: add flags to Qdisc class ops struct Vlad Buslov
2018-11-12 7:55 ` [PATCH net-next 16/17] net: sched: conditionally take rtnl lock on rules update path Vlad Buslov
2018-11-13 9:40 ` Stefano Brivio
2018-11-13 13:25 ` Vlad Buslov
2018-11-13 13:40 ` Stefano Brivio
2018-11-13 13:58 ` Vlad Buslov
2018-11-13 15:53 ` Stefano Brivio
2018-11-13 16:57 ` Stefano Brivio
2018-11-12 7:55 ` [PATCH net-next 17/17] net: sched: unlock rules update API Vlad Buslov
2018-11-12 17:30 ` David Miller
2018-11-13 13:46 ` Vlad Buslov
2018-11-14 6:44 ` Jiri Pirko [this message]
2018-11-14 16:45 ` Vlad Buslov
2018-11-15 10:20 ` Jiri Pirko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181114064453.GA2235@nanopsycho.orion \
--to=jiri@resnulli.us \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=jhs@mojatatu.com \
--cc=netdev@vger.kernel.org \
--cc=vladbu@mellanox.com \
--cc=xiyou.wangcong@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).