Re: [PATCH net v2 2/2] net/sched: taprio: do not replay missed entries in advance_sched()

From: Krystian Kaniewski

Date: Mon Nov 02 2026 - 05:27:44 EST


On 10/14/26 22:51, Vinicius Costa Gomes wrote:
>>>> + struct sched_entry *entry, *found = NULL;
>>>> + ktime_t cycle_start = sched->start_time;
>>>> + s64 offset, entry_end = 0, elapsed = 0;
>>>> +
>>>> + if (ktime_after(now, cycle_start)) {
>>>> + s64 periods = div64_s64(ktime_sub(now, cycle_start),
>>>> + sched->period);
>>>> +
>>>> + cycle_start = ktime_add_ns(cycle_start,
>>>> + periods * sched->period);
>>>> + }
>>>> + offset = ktime_sub(now, cycle_start);
>>>> +
>>>> + /* The offset is less than one period, so an entry which ends after
>>>> + * @now is found at the latest at the entry which reaches the end of
>>>> + * the cycle, or at the last entry. A schedule has at least one entry,
>>>> + * so the loop always sets found.
>>>> + */
>>>> + list_for_each_entry(entry, &sched->entries, list) {
>>>> + entry_end = min_t(s64, elapsed + entry->interval,
>>>> + sched->cycle_time);
>>>> + if (offset < entry_end ||
>>>> + list_is_last(&entry->list, &sched->entries)) {
>>>> + found = entry;
>>>> + break;
>>>> + }
>>>> + elapsed = entry_end;
>>>> + }
>>>> +
>>>> + *start = ktime_add_ns(cycle_start, elapsed);
>>>> + *end = ktime_add_ns(cycle_start, entry_end);
>>>> + sched->cycle_end_time = ktime_add_ns(cycle_start,
>>>> sched->cycle_time);
>>>
>>> Having this side effect here was unexpected. I think this would make
>>> more sense outside this function.
>>>
>>
>> Agreed. I can make taprio_entry_at() return the cycle end through an
>> extra output argument and have advance_sched() store it explicitly in
>> oper->cycle_end_time. The helper could then take the schedule as const.
>>
>> I can wait for the rest of your review of this patch before sending v3
>>
>
> I am going to try and review this by end of this week.
>
>
> Cheers,

Hi Vinicius,

Just a gentle ping on patch 2/2. Did you have a chance to continue the
review?
--
Krystian Kaniewski