* Re: [PATCH RFC] net/sched: taprio: fix RCU stall due to small schedule intervals
[not found] <98324f0c-b0de-46e4-9a0f-88cb22766568@gmail.com>
@ 2026-12-03 11:59 ` syzbot
0 siblings, 0 replies; only message in thread
From: syzbot @ 2026-12-03 11:59 UTC (permalink / raw)
To: krystianmkaniewski
Cc: krystianmkaniewski, syzbot, syzbot,
syzkaller-upstream-moderation, linux-kernel, syzkaller-bugs
> On 5/22/26 09:30, syzbot wrote:
>> The taprio qdisc allows configuring schedule intervals that are
>> physically valid for high-speed links but are far too small for the
>> software hrtimer subsystem to handle. For example, at 10 Gbps, the
>> minimum duration for a 60-byte frame is 48 nanoseconds. If a user
>> configures an interval of 255 nanoseconds, it passes the physical
>> validation check.
>>
>> However, the execution overhead of the hrtimer interrupt itself is
>> typically much larger than 255 nanoseconds. When the hrtimer fires,
>> advance_sched() calculates the next end_time by adding the interval to
>> the previous end_time. Because this advancement is smaller than the
>> interrupt overhead, the newly calculated end_time is still in the past.
>> When advance_sched() returns HRTIMER_RESTART, the hrtimer subsystem sees
>> the timer is already expired and executes it again immediately. The
>> timer never catches up to the current time, trapping the CPU in an
>> infinite hrtimer interrupt loop and causing an RCU stall.
>>
>> Fix this by introducing a two-fold solution. First, in advance_sched(),
>> introduce a loop to advance the schedule until the calculated end_time
>> is strictly in the future. This ensures that if the hrtimer fires late,
>> it will skip over schedule entries that are already in the past instead
>> of blindly advancing by a single entry. Second, in fill_sched_entry(),
>> enforce a minimum interval of 1 microsecond (NSEC_PER_USEC) when
>> software scheduling is used. This prevents users from configuring
>> schedules that the software cannot physically keep up with, avoiding
>> excessive CPU time spent in the interrupt handler.
>>
>> Fixes: 5a781ccbd19e ("tc: Add support for configuring the taprio scheduler")
>> Assisted-by: Gemini:gemini-3.1-pro-preview Gemini:gemini-3-flash-preview syzbot
>> Reported-by: syzbot+2e90866706ad999df132@syzkaller.appspotmail.com
>> Closes: https://syzkaller.appspot.com/bug?extid=2e90866706ad999df132
>> Link: https://syzkaller.appspot.com/ai_job?id=a76df798-c9cc-4943-937d-81102e228a11
>> To: "David S. Miller" <davem@davemloft.net>
>> To: "Eric Dumazet" <edumazet@google.com>
>> To: "Jamal Hadi Salim" <jhs@mojatatu.com>
>> To: "Jiri Pirko" <jiri@resnulli.us>
>> To: "Jakub Kicinski" <kuba@kernel.org>
>> To: <netdev@vger.kernel.org>
>> To: "Paolo Abeni" <pabeni@redhat.com>
>> To: "Vinicius Costa Gomes" <vinicius.gomes@intel.com>
>> Cc: "Simon Horman" <horms@kernel.org>
>> Cc: <linux-kernel@vger.kernel.org>
>>
>> ---
>> diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
>> index 45245157e..9e298b0cf 100644
>> --- a/net/sched/sch_taprio.c
>> +++ b/net/sched/sch_taprio.c
>> @@ -925,6 +925,7 @@ static enum hrtimer_restart advance_sched(struct hrtimer *timer)
>> struct sched_entry *entry, *next;
>> struct Qdisc *sch = q->root;
>> ktime_t end_time;
>> + ktime_t now;
>> int tc;
>>
>> spin_lock(&q->current_entry_lock);
>> @@ -951,36 +952,44 @@ static enum hrtimer_restart advance_sched(struct hrtimer *timer)
>> goto first_run;
>> }
>>
>> - if (should_restart_cycle(oper, entry)) {
>> - next = list_first_entry(&oper->entries, struct sched_entry,
>> - list);
>> - oper->cycle_end_time = ktime_add_ns(oper->cycle_end_time,
>> - oper->cycle_time);
>> - } else {
>> - next = list_next_entry(entry, list);
>> - }
>> + now = taprio_get_time(q);
>>
>> - end_time = ktime_add_ns(entry->end_time, next->interval);
>> - end_time = min_t(ktime_t, end_time, oper->cycle_end_time);
>> + do {
>> + if (should_restart_cycle(oper, entry)) {
>> + next = list_first_entry(&oper->entries,
>> + struct sched_entry, list);
>> + oper->cycle_end_time = ktime_add_ns(
>> + oper->cycle_end_time, oper->cycle_time);
>> + } else {
>> + next = list_next_entry(entry, list);
>> + }
>>
>> - for (tc = 0; tc < num_tc; tc++) {
>> - if (next->gate_duration[tc] == oper->cycle_time)
>> - next->gate_close_time[tc] = KTIME_MAX;
>> - else
>> - next->gate_close_time[tc] = ktime_add_ns(entry->end_time,
>> - next->gate_duration[tc]);
>> - }
>> + end_time = ktime_add_ns(entry->end_time, next->interval);
>> + end_time = min_t(ktime_t, end_time, oper->cycle_end_time);
>>
>> - if (should_change_schedules(admin, oper, end_time)) {
>> - switch_schedules(q, &admin, &oper);
>> - /* After changing schedules, the next entry is the first one
>> - * in the new schedule, with a pre-calculated end_time.
>> - */
>> - next = list_first_entry(&oper->entries, struct sched_entry, list);
>> - end_time = next->end_time;
>> - }
>> + for (tc = 0; tc < num_tc; tc++) {
>> + if (next->gate_duration[tc] == oper->cycle_time)
>> + next->gate_close_time[tc] = KTIME_MAX;
>> + else
>> + next->gate_close_time[tc] =
>> + ktime_add_ns(entry->end_time,
>> + next->gate_duration[tc]);
>> + }
>> +
>> + if (should_change_schedules(admin, oper, end_time)) {
>> + switch_schedules(q, &admin, &oper);
>> + /* After changing schedules, the next entry is the first one
>> + * in the new schedule, with a pre-calculated end_time.
>> + */
>> + next = list_first_entry(&oper->entries,
>> + struct sched_entry, list);
>> + end_time = next->end_time;
>> + }
>> +
>> + next->end_time = end_time;
>> + entry = next;
>> + } while (unlikely(ktime_compare(end_time, now) <= 0));
>>
>> - next->end_time = end_time;
>> taprio_set_budgets(q, oper, next);
>>
>> first_run:
>> @@ -1061,6 +1070,13 @@ static int fill_sched_entry(struct taprio_sched *q, struct nlattr **tb,
>> return -EINVAL;
>> }
>>
>> + /* hrtimers cannot keep up with very small intervals */
>> + if (!FULL_OFFLOAD_IS_ENABLED(q->flags) && interval < NSEC_PER_USEC) {
>> + NL_SET_ERR_MSG(extack,
>> + "Invalid interval for software schedule entry");
>> + return -EINVAL;
>> + }
>> +
>> entry->interval = interval;
>>
>> return 0;
>>
>>
>> base-commit: 5200f5f493f79f14bbdc349e402a40dfb32f23c8
> #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git 7a48731e43e33ee28cb714654e9fb180b19c18ee
Patch testing via #syz test is temporarily disabled.
See https://github.com/google/syzkaller/issues/8122 for details.
>
> --
> Krystian Kaniewski
>
> --
> You received this message because you are subscribed to the Google Groups "syzkaller-upstream-moderation" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-upstream-moderation+unsubscribe@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/syzkaller-upstream-moderation/98324f0c-b0de-46e4-9a0f-88cb22766568%40gmail.com.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-03 11:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <98324f0c-b0de-46e4-9a0f-88cb22766568@gmail.com>
2026-12-03 11:59 ` [PATCH RFC] net/sched: taprio: fix RCU stall due to small schedule intervals syzbot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®