From: Xin Xie <xiexinet@gmail.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
liuhangbin@gmail.com, Simon Horman <horms@kernel.org>
Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
andrew+netdev@lunn.ch, shuah@kernel.org, kees@kernel.org,
petr.wozniak@gmail.com, qingfang.deng@linux.dev,
fmaurer@redhat.com, luka.gejak@linux.dev,
xiaoliang.yang_1@nxp.com, skhawaja@google.com,
stable@vger.kernel.org, sdf.kernel@gmail.com,
syzbot+fbf74291c3b7e753b481@syzkaller.appspotmail.com
Subject: Re: [PATCH net v7 2/4] net: hsr: preserve submission order without a forwarding lock
Date: Wed, 14 Oct 2026 16:48:55 +0200 [thread overview]
Message-ID: <003d3e2a-3568-44f6-a9cc-3202de60da58@gmail.com> (raw)
In-Reply-To: <20261014134718.YGcKmfB9@linutronix.de>
> What are stacked HSR devices? Looking from the setup in the referenced
> report this is a bridge device attached to a HSR ring.
> An announce frame is sent and this goes to hsr_dev_xmit(). This does not
> look like a normal setup. Is this something you use or is this something
> the bot came up with?
It is the setup from the syzbot report, not something we use. In that
report the slave port of one HSR device is a bridge, and one bridge
port is a second HSR device. The announce frame of the first device
holds its seqnr_lock, goes through the bridge, and ends in
hsr_dev_xmit() of the second device, which takes its own seqnr_lock.
Lockdep sees the same lock class twice and reports it. With two
devices this is not a real deadlock. It only becomes one when the
transmit path comes back to the same device.
> This looks very complex and I am not a big fan of it. I would prefer to
> break lock chain early assuming the setup is valid/ sane (see above).
I understand. The queue exists only for the ordering you pointed out
in v6: frame N must reach every lower device before frame N+1 gets its
number, otherwise a receiver without the bitmap discard (aae9d6b616b5)
drops N as stale. In our test an unpatched HSRv0 peer received 19128
of 20000 frames with the narrowed lock, and all 20000 with the queue.
> The ID by itself can be assigned with an atomic_inc() but then you don't
> have the transmit ordering. So you introduce the workqueue for the
> ordering which is ugh. I'm not sure how this works if you get
> submissions from two CPUs given the lock is gone and the workqueue is
> per-CPU.
The FIFO and the owner flag are protected by fwd_lock. Only one
context owns the consumer at a time: either the CPU that found it idle
and processes its own frame, or the single work item of this HSR
device. A frame submitted from another CPU meanwhile is appended to
the FIFO and processed after the current frame, in that order. The
work item is one work_struct per device, so the per-CPU workqueue
cannot run it twice at the same time. But I agree it is a lot of code
for this, and it also serializes all forwarding of one device, like the
lock does today.
So for v8 I see two simple options:
(a) Keep seqnr_lock across the submission like today and only break
the re-entry: a frame that enters HSR transmit while this CPU is
already inside HSR forwarding is dropped and counted. Ordering is
kept, but all forwarding of one device stays serialized.
(b) Narrow the lock to the counter update, as in v6 and in Hangbin's
patch [1]. Several CPUs can forward in parallel. A receiver without
the bitmap discard can drop a reordered frame, so the patch would
carry "Cc: <stable@vger.kernel.org> # aae9d6b616b5: ..." as Simon
suggested there, and the TX statistics move to per-CPU counters.
I would prefer (b) because of the parallel forwarding, if the old
receiver limitation is acceptable to you. Otherwise (a).
Hangbin, Simon, your view is welcome too.
Patch 3 works with both: it segments before the lock, and each
segment is numbered and submitted under the lock.
[1] https://lore.kernel.org/netdev/20260805-hsr_deadlock-v1-1-d8a6f06fc5a8@kylinos.cn/
--
Xin
next prev parent reply other threads:[~2026-10-14 14:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 20:13 [PATCH net v7 0/4] net: hsr: fix super-packet forwarding and ordering Xin Xie
2026-10-09 20:13 ` [PATCH net v7 1/4] net: hsr: keep GRO disabled on HSR/PRP ports Xin Xie
2026-10-10 20:19 ` netdev-bot+sashiko
2026-10-14 13:20 ` Sebastian Andrzej Siewior
2026-10-14 14:04 ` Xin Xie
2026-10-09 20:13 ` [PATCH net v7 2/4] net: hsr: preserve submission order without a forwarding lock Xin Xie
2026-10-10 16:51 ` Xin Xie
2026-10-10 20:19 ` netdev-bot+sashiko
2026-10-14 13:47 ` Sebastian Andrzej Siewior
2026-10-14 14:48 ` Xin Xie [this message]
2026-10-14 15:18 ` Sebastian Andrzej Siewior
2026-10-09 20:13 ` [PATCH net v7 3/4] net: hsr: segment GSO before per-frame forwarding Xin Xie
2026-10-14 14:00 ` Sebastian Andrzej Siewior
2026-10-14 14:53 ` Xin Xie
2026-10-09 20:13 ` [PATCH net v7 4/4] selftests: net: hsr: verify GRO policy and ordered forwarding Xin Xie
2026-10-10 20:19 ` netdev-bot+sashiko
2026-10-11 18:58 ` Xin Xie
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=003d3e2a-3568-44f6-a9cc-3202de60da58@gmail.com \
--to=xiexinet@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=bigeasy@linutronix.de \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fmaurer@redhat.com \
--cc=horms@kernel.org \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=liuhangbin@gmail.com \
--cc=luka.gejak@linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petr.wozniak@gmail.com \
--cc=qingfang.deng@linux.dev \
--cc=sdf.kernel@gmail.com \
--cc=shuah@kernel.org \
--cc=skhawaja@google.com \
--cc=stable@vger.kernel.org \
--cc=syzbot+fbf74291c3b7e753b481@syzkaller.appspotmail.com \
--cc=xiaoliang.yang_1@nxp.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