From: Simon Horman <simon.horman@corigine.com>
To: renmingshuai <renmingshuai@huawei.com>
Cc: pctammela@mojatatu.com, caowangbao@huawei.com,
davem@davemloft.net, edumazet@google.com, jhs@mojatatu.com,
jiri@resnulli.us, kuba@kernel.org, liaichun@huawei.com,
linux-kernel@vger.kernel.org, liubo335@huawei.com,
netdev@vger.kernel.org, pabeni@redhat.com,
xiyou.wangcong@gmail.com, yanan@huawei.com
Subject: Re: [PATCH v3] net/sched: Set the flushing flags to false to prevent an infinite loop and add one test to tdc
Date: Fri, 9 Jun 2023 10:24:12 +0200 [thread overview]
Message-ID: <ZILhrPYdQ4qRVDg/@corigine.com> (raw)
In-Reply-To: <20230609033115.3738692-1-renmingshuai@huawei.com>
On Fri, Jun 09, 2023 at 11:31:15AM +0800, renmingshuai wrote:
> >On 08/06/2023 09:32, renmingshuai wrote:
> >>> On 07/06/2023 01:19, renmingshuai wrote:
> >>>>> On 06/06/2023 11:45, renmingshuai wrote:
> >>>>>> When a new chain is added by using tc, one soft lockup alarm will
> >>>>>> be
> >>>>>> generated after delete the prio 0 filter of the chain. To
> >>>>>> reproduce
> >>>>>> the problem, perform the following steps:
> >>>>>> (1) tc qdisc add dev eth0 root handle 1: htb default 1
> >>>>>> (2) tc chain add dev eth0
> >>>>>> (3) tc filter del dev eth0 chain 0 parent 1: prio 0
> >>>>>> (4) tc filter add dev eth0 chain 0 parent 1:
> >>>>>
> >>>>> This seems like it could be added to tdc or 3 and 4 must be run in
> >>>>> parallel?
> >>>> 3 and 4 do not need to be run inparallel. When a new chain is added
> >>>> by the
> >>>> way as step 1 and the step 3 is completed, this problem always
> >>>> occurs
> >>>> whenever step 4 is run.
> >>>
> >>> Got it,
> >>> The test still hangs with the provided patch.
> >>>
> >>> + tc qdisc add dev lo root handle 1: htb default 1
> >>> + tc chain add dev lo
> >>> + tc filter del dev lo chain 0 parent 1: prio 0
> >>> [ 68.790030][ T6704] [+]
> >>> [ 68.790060][ T6704] chain refcnt 2
> >>> [ 68.790951][ T6704] [-]
> >>> + tc filter add dev lo chain 0 parent 1:
> >>> <hangs>
> >>>
> >>> Also please add this test to tdc, it should be straightforward.
> >>>
> >> Sorry for not testing before. I forgot that the chain->refcnt was
> >> increased by 1 when tcf_chain_get() is called in tc_del_tfilter().
> >> The value of chain->refcnt is 2 after chain flush. The test
> >> result is as follows:
> >> [root@localhost ~]# tc qdisc add dev eth2 root handle 1: htb default 1
> >> [root@localhost ~]# tc chain add dev eth2
> >> [root@localhost ~]# tc filter del dev eth2 chain 0 parent 1: prio 0
> >> [root@localhost ~]# tc filter add dev eth2 chain 0 parent 1:
> >> Error: Filter kind and protocol must be specified.
> >> We have an error talking to the kernel
> >>
> >> And I have add this test to tdc:
> >> [root@localhost tc-testing]# ./tdc.py -f tc-tests/filters/tests.json
> >> ok 7 c2b4 - Adding a new fiter after deleting a filter in a chain does
> >> not cause an infinite loop
> >>
> >> Fixes: 726d061286ce ("net: sched: prevent insertion of new classifiers during chain flush")
> >> Signed-off-by: renmingshuai <renmingshuai@huawei.com>
> >
> >Please respin with the following applied:
> >
> >diff --git
> >a/tools/testing/selftests/tc-testing/tc-tests/filters/tests.json
> >b/tools/testing/selftests/tc-testing/tc-tests/filters/tests.json
> >index c759c3db9a37..361235ad574b 100644
> >--- a/tools/testing/selftests/tc-testing/tc-tests/filters/tests.json
> >+++ b/tools/testing/selftests/tc-testing/tc-tests/filters/tests.json
> >@@ -125,25 +125,5 @@
> > "teardown": [
> > "$TC qdisc del dev $DEV2 ingress"
> > ]
> >- },
> >- {
> >- "id": "c2b4",
> >- "name": "Adding a new fiter after deleting a filter in a chain
> >does not cause an infinite loop",
> >- "category": [
> >- "filter",
> >- "prio"
> >- ],
> >- "setup": [
> >- "$TC qdisc add dev $DEV1 root handle 1: htb default 1",
> >- "$TC chain add dev $DEV1"
> >- ],
> >- "cmdUnderTest": "$TC filter del dev $DEV1 chain 0 parent 1:
> >prio 0",
> >- "expExitCode": "0",
> >- "verifyCmd": "$TC filter add dev $DEV1 chain 0 parent 1:",
> >- "matchPattern": "Error: Filter kind and protocol must be
> >specified.",
> >- "matchCount": "1",
> >- "teardown": [
> >- "$TC qdisc del dev $DEV1 root handle 1: htb default 1"
> >- ]
> > }
> > ]
> >diff --git
> >a/tools/testing/selftests/tc-testing/tc-tests/infra/filters.json
> >b/tools/testing/selftests/tc-testing/tc-tests/infra/filters.
> >json
> >new file mode 100644
> >index 000000000000..55d6f209c388
> >--- /dev/null
> >+++ b/tools/testing/selftests/tc-testing/tc-tests/infra/filters.json
> >@@ -0,0 +1,24 @@
> >+[
> >+ {
> >+ "id": "c2b4",
> >+ "name": "Adding a new filter after flushing empty chain doesnt
> >cause an infinite loop",
> >+ "category": [
> >+ "filter",
> >+ "chain"
> >+ ],
> >+ "setup": [
> >+ "$IP link add dev $DUMMY type dummy || /bin/true",
> >+ "$TC qdisc add dev $DUMMY root handle 1: htb default 1",
> >+ "$TC chain add dev $DUMMY",
> >+ "$TC filter del dev $DUMMY chain 0 parent 1: prio 0"
> >+ ],
> >+ "cmdUnderTest": "$TC filter add dev $DUMMY chain 0 parent 1:",
> >+ "expExitCode": "2",
> >+ "verifyCmd": "$TC chain ls dev $DUMMY",
> >+ "matchPattern": "chain parent 1: chain 0",
> >+ "matchCount": "1",
> >+ "teardown": [
> >+ "$TC qdisc del dev $DUMMY root handle 1: htb default 1"
> >+ ]
> >+ }
> >+]
>
> Ok. The new test is passed.
> [root@localhost tc-testing]# ./tdc.py -f tc-tests/infra/filter.json
> Test c2b4: Adding a new filter after flushing empty chain doesn't cause an infinite loop
> All test results:
> 1..1
> ok 1 c2b4 - Adding a new filter after flushing empty chain doesn't cause an infinite loop
>
> Fixes: 726d061286ce ("net: sched: prevent insertion of new classifiers during chain flush")
> Signed-off-by: renmingshuai <renmingshuai@huawei.com>
Hi renmingshuai,
the above text, in it's entirety, does not meet the needs
of a patch submission for the Linux kernel. In particular:
* All the context from previous discussion (the bits prefixed by '>')
should be removed.
* The patch description should consist of just that, a description of
the patch. Any relevant test results are also welcome here.
* Information about changes from previous versions should be provided
in the form of a changelog, typically below the scissors (---).
A recent example is here:
- https://lore.kernel.org/all/20230607162353.3631199-1-mtottenh@akamai.com/
[PATCH v3] net/sched: act_pedit: Parse L3 Header for L4 offset
Also, please consider using spaces and capital letters
in your name in the from and signed-off parts of your submission.
e.g.: Mingshuai Ren <...> or Ren Mingshuai <...>
...
--
pw-bot: cr
prev parent reply other threads:[~2023-06-09 8:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-06 14:45 [PATCH] net/sched: Set the flushing flags to false to prevent an infinite loop renmingshuai
2023-06-06 16:59 ` Pedro Tammela
2023-06-07 4:19 ` renmingshuai
2023-06-07 15:02 ` Pedro Tammela
2023-06-08 12:32 ` [PATCH v2] net/sched: Set the flushing flags to false to prevent an infinite loop and add one test to tdc renmingshuai
2023-06-08 16:08 ` Pedro Tammela
2023-06-09 3:31 ` [PATCH v3] " renmingshuai
2023-06-09 8:24 ` Simon Horman [this message]
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=ZILhrPYdQ4qRVDg/@corigine.com \
--to=simon.horman@corigine.com \
--cc=caowangbao@huawei.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=liaichun@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liubo335@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pctammela@mojatatu.com \
--cc=renmingshuai@huawei.com \
--cc=xiyou.wangcong@gmail.com \
--cc=yanan@huawei.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).