From: Jamal Hadi Salim <jhs@mojatatu.com>
To: netdev@vger.kernel.org
Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
Jiri Pirko <jiri@resnulli.us>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Willem de Bruijn <willemb@google.com>,
Simon Horman <horms@kernel.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Clark Williams <clrkwllms@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Alexei Starovoitov <alexei.starovoitov@gmail.com>,
linux-rt-devel@lists.linux.dev,
Victor Nogueira <victor@mojatatu.com>,
Edward Adam Davis <eadavis@qq.com>, Po Liu <Po.Liu@nxp.com>,
Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org, stable@vger.kernel.org,
syzbot+0054fed3dc9085390f51@syzkaller.appspotmail.com,
shaos <shawnq1@163.com>,
sashiko-bot@kernel.org
Subject: [PATCH net v4 0/3] net/sched: act_gate: bound the cycle time and refuse schedule entries shorter than 10 us
Date: Tue, 24 Nov 2026 09:12:07 -0500 [thread overview]
Message-ID: <ACT-WEXM.v4.r0.20261124074514@mojatatu.com> (raw)
An act_gate schedule is armed from TCA_GATE_BASE_TIME and
TCA_GATE_CYCLE_TIME, both unchecked u64 attributes that are read into a
signed ktime_t. A cycle time above S64_MAX turns negative on that read
and the cycle arithmetic that follows wraps.
That arms the timer in the past. Every expiry then recomputes the same
past time, so the timer softirq never finishes and the task that
installed the action spins until the watchdog reports a soft lockup.
A schedule entry of a few nanoseconds reaches the same state from the
other direction: the entry interval is the period the hrtimer runs at, so
the handler is always behind its own next expiry and the action holds a
core for as long as it exists.
1/3 cap base_time and cycle_time at KTIME_MAX, and make every
start-time computation saturate instead of wrapping.
2/3 require at least 10 us per schedule entry.
3/3 cover the refusals, the largest accepted base time and cycle time,
and both sides of the interval boundary in the tdc action tests.
Edward Adam Davis posted a v3 that capped cycle_time at S64_MAX and moved
the attribute to NLA_S64. That refuses the reported value but leaves the
invariant to the wrap: base_time is read the same way into the same
arithmetic and stays unbounded, so an accepted pair can still compute a
start the timer was never meant to take. The type change is also
unnecessary; S64_MAX is a fine range for NLA_U64.
Alexei Starovoitov traced the stall to this action on the syzbot thread
and sketched the saturating arithmetic used here:
https://lore.kernel.org/netdev/DN37NBGPJJG9.2DSVDCKS3UYTV@gmail.com/
This series keeps NLA_U64 for both attributes and bounds the computed
start time rather than one input's value. cycle_time = 0 stays accepted:
it means "derive the cycle from the entry intervals".
The 10 us entry floor comes from the measured cost of one expiry rather
than a device's frame time, and 2/3 states the margin it leaves. The
100 us floor proposed for taprio was withdrawn for narrowing working uAPI
and for a margin it never explained; this floor answers both.
Changes in v4:
- Reworked as a three-patch series on the current net tree.
- Bound base_time and cycle_time at KTIME_MAX, keeping NLA_U64.
- Saturating start-time arithmetic, shared with the catch-up path.
- Minimum entry interval, with its measured cost and its tdc coverage.
v1 -> v2: reject an out-of-range cycletime instead of clamping it.
v2 -> v3: move the range check into the netlink policy.
Jamal Hadi Salim (3):
net/sched: act_gate: bound the cycle time and start time arithmetic
net/sched: act_gate: refuse schedule entries shorter than 10 us
selftests: tc-testing: act_gate: cover the new cycle time and interval
limits
net/sched/act_gate.c | 45 +++--
.../tc-testing/tc-tests/actions/gate.json | 189 ++++++++++++++++++
2 files changed, 217 insertions(+), 17 deletions(-)
--
2.43.0
next reply other threads:[~2026-11-24 14:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 14:12 Jamal Hadi Salim [this message]
2026-11-24 14:12 ` [PATCH net v4 1/3] net/sched: act_gate: bound the cycle time and start time arithmetic Jamal Hadi Salim
2026-11-24 19:56 ` Alexei Starovoitov
2026-11-24 14:12 ` [PATCH net v4 2/3] net/sched: act_gate: refuse schedule entries shorter than 10 us Jamal Hadi Salim
2026-11-24 16:12 ` Sebastian Andrzej Siewior
2026-11-24 16:58 ` Jamal Hadi Salim
2026-11-24 17:11 ` Jamal Hadi Salim
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=ACT-WEXM.v4.r0.20261124074514@mojatatu.com \
--to=jhs@mojatatu.com \
--cc=Po.Liu@nxp.com \
--cc=alexei.starovoitov@gmail.com \
--cc=bigeasy@linutronix.de \
--cc=clrkwllms@kernel.org \
--cc=davem@davemloft.net \
--cc=eadavis@qq.com \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rostedt@goodmis.org \
--cc=sashiko-bot@kernel.org \
--cc=shawnq1@163.com \
--cc=shuah@kernel.org \
--cc=stable@vger.kernel.org \
--cc=syzbot+0054fed3dc9085390f51@syzkaller.appspotmail.com \
--cc=victor@mojatatu.com \
--cc=willemb@google.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