🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25493

Re: [PATCH net-next v15 3/4] net/sched: cap the accounted backlog before it can wrap

#25493
From: Jamal Hadi Salim
Date: Tue, 01 Dec 2026 22:38
588 lines
35896 bytes
On Tue, Dec 1, 2026 at 2:43 PM <netdev-bot+sashiko@kernel.org> wrote:
>
> Thank you for your contribution! Sashiko AI review found 10 potential
> issue(s) to consider.
>
> Critical: 0 · High: 3 · Medium: 6 · Low: 1
>
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
>
> - [High] qdisc_ancestors_backlog_room() (net/sched/sch_api.c) now walks
>   past TCQ_F_NOPARENT and compares every non-offloaded ancestor's…
> - [High] The ceiling is skipped only while TCQ_F_OFFLOADED is set.
> - [High] net/sched: netem_enqueue() re-duplicates GSO corrupt segments
>   and wraps backlog

makes sense. v16 coming ..

pw-bot: cr

cheers,
jamal
> - [Medium] The commit message leaves out several user-visible behaviour
>   changes that the patch makes: (a) hhf_enqueue() and skbprio_enqueue()…
> - [Medium] The patch makes qstats_backlog_sub() and
>   qdisc_qstats_backlog_dec() saturate at 0.
> - [Medium] The new ceiling refusals in tbf_segment() and
>   dualpi2_qdisc_enqueue() free the skb_gso_segment() list with…
> - [Medium] TCQ_F_OFFLOADED now decides whether the enqueue path drops
>   packets, but qdisc_offload_dump_helper() still updates sch->flags with…
> - [Medium] net/sched: qdisc_ancestors_backlog_room() under-reserves when
>   orig_len > 1 MiB
> - [Medium] net/sched: taprio backlog still wraps via stale mirror across
>   NOPARENT
> - [Low] In this patch, cake_enqueue()'s CAKE_FLAG_SPLIT_GSO path books
>   the full segment sum with qstats_backlog_add(sch, slen) and calls…
>
> --
>
> net/sched: cap the accounted backlog before it can wrap
>
> This patch adds an enqueue-time check, qdisc_backlog_overflow(), to most
> qdiscs. Packets are dropped once sch->qstats.backlog gets close to
> wrapping its u32.
>
> The per-qdisc backlog decrements now saturate at 0, and the tree
> reconciliation becomes a signed modular apply. A new helper,
> qdisc_ancestors_backlog_room(), refuses GSO splits that would push an
> ancestor past the ceiling. taprio is reworked to mirror its children's
> accounting and to resync in ->dump().
>
> Closes: https://lore.kernel.org/netdev/20260818101130.16203-1-jhs@mojatatu.com/
> Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260818101130.16203-1-jhs@mojatatu.com
> Link: https://lore.kernel.org/netdev/CANn89iLfMJV7ancKH1Gjzzm7ZUG-gKcrczkJjJEWN5sCuWd-ug@mail.gmail.com/
> Link: https://lore.kernel.org/netdev/CANn89i+GOFH_8g+vSV0jUj0aBqLYVWuFOrHuDggZu9kPC_m6tQ@mail.gmail.com/
> Link: https://lore.kernel.org/netdev/87a4oottcj.fsf@toke.dk/
> Link: https://lore.kernel.org/netdev/87pkxks68f.fsf@toke.dk/
> Link: https://lore.kernel.org/netdev/179231932946.3135.7497478990186385688@kernel.org/
> Link: https://lore.kernel.org/netdev/179269577131.3135.3967915390403138015@kernel.org/
>
> [Severity: Medium]
> The commit message describes the backlog ceiling. The patch also makes
> several behaviour changes that the message does not mention.
>
> - hhf_enqueue() and skbprio_enqueue() now call qdisc_tree_reduce_backlog()
>   on the NET_XMIT_CN path. This fixes an older drift in the parent
>   backlog that has nothing to do with wrapping.
>
> - plug_enqueue() now compares qdisc_pkt_len() against the user configured
>   byte limit instead of skb->len. Stab overhead and GSO header
>   replication now count against the plug limit.
>
> - netem_enqueue() pre-books the original packet on itself and its
>   ancestors (qstats_backlog_add() plus qdisc_qlen_inc()) while the
>   duplicate re-enters the root. The duplicate sees netem's qlen one
>   higher, so near the limit it can hit sch->q.qlen >= sch->limit sooner.
>
> - taprio_enqueue_segmented() no longer calls qdisc_qstats_drop(sch) when
>   a child rejects a segment. slen now counts only the bytes that were
>   enqueued.
>
> - taprio's default children now get TCQ_F_NOPARENT. taprio_dump()
>   rebuilds qlen and backlog under qdisc_lock(), so a read path now
>   changes qdisc state. Only the text below the --- line mentions this.
>
> This is tagged Fixes: 175f9c1bba9b and is likely to be backported.
> Could these changes be described in the commit message, or split out?
>
> > diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
> > index 1acaadb3e2cf0..b195b2ee5ca38 100644
> > --- a/include/net/sch_generic.h
> > +++ b/include/net/sch_generic.h
>
> [ ... ]
>
> > @@ -991,13 +1018,28 @@ static inline void qdisc_bstats_update(struct Qdisc *sch,
> >
> >  static inline void qstats_backlog_sub(struct Qdisc *sch, u32 val)
> >  {
> > -     WRITE_ONCE(sch->qstats.backlog, sch->qstats.backlog - val);
> > +     u32 backlog = READ_ONCE(sch->qstats.backlog);
> > +
> > +     /* Saturate: an offload update can leave the counter short. */
> > +     WRITE_ONCE(sch->qstats.backlog, backlog > val ? backlog - val : 0);
> > +}
> > +
> > +/* Apply a signed net change: positive removes, negative grows. */
> > +static inline void qdisc_qstats_backlog_apply(struct Qdisc *sch, s64 delta)
> > +{
> > +     u32 backlog = READ_ONCE(sch->qstats.backlog);
> > +
> > +     WRITE_ONCE(sch->qstats.backlog, (u32)(backlog - delta));
> >  }
>
> [Severity: Medium]
> Is it safe to mix saturating and modular writers now that the guard fails
> closed?
>
> qstats_backlog_sub() and qdisc_qstats_backlog_dec() now clamp at 0.
> qdisc_qstats_backlog_apply() still wraps. qdisc_tree_reduce_backlog()
> applies it to every ancestor and has no TCQ_F_OFFLOADED exemption,
> unlike qdisc_backlog_overflow() and qdisc_ancestors_backlog_room().
>
> Suppose an ancestor's counter is lower than what a child later removes,
> for example an offloaded ancestor whose counter holds bytes written by
> the driver. The result wraps to near U32_MAX. From then on,
> qdisc_backlog_overflow() returns true for every packet:
>
>         if (likely(len <= QDISC_PKT_LEN_MAX))
>                 return backlog > QDISC_MAX_BACKLOG;
>
> The saturating dequeues cannot bring the counter back under the ceiling
> unless more than about 2 MiB of real packets is queued.
>
> Does the qdisc then drop every enqueue until it is reset? Before this
> patch, the same mismatch only produced a wrong statistic.
>
> I could not find a pure software path that leaves a booking ancestor
> short. The trigger I found needs a counter written from outside the
> qdisc code.
>
> >
> >  static inline void qdisc_qstats_backlog_dec(struct Qdisc *sch,
> >                                           const struct sk_buff *skb)
> >  {
> > -     qstats_backlog_sub(sch, qdisc_pkt_len(skb));
> > +     u32 backlog = READ_ONCE(sch->qstats.backlog);
> > +     u32 len = qdisc_pkt_len(skb);
> > +
> > +     /* An offload update can leave the counter short; saturate. */
> > +     WRITE_ONCE(sch->qstats.backlog, backlog > len ? backlog - len : 0);
> >  }
>
> [ ... ]
>
> > diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
> > index f36c41224bccf..09312d2f23862 100644
> > --- a/net/sched/sch_api.c
> > +++ b/net/sched/sch_api.c
>
> [ ... ]
>
> > +/* Room left for @extra bytes on every ancestor of @sch; a split's growth
> > + * reaches them without passing their own enqueue guard.
> > + */
> > +bool qdisc_ancestors_backlog_room(const struct Qdisc *sch, u64 extra)
> > +{
> > +     const struct Qdisc *p = sch;
> > +     u32 parentid;
> > +
> > +     if (!extra)
> > +             return true;
> > +
> > +     rcu_read_lock();
> > +     while ((parentid = p->parent)) {
> > +             if (parentid == TC_H_ROOT)
> > +                     break;
> > +
> > +             /* Cross NOPARENT: a mirror parent still books the child's
> > +              * growth.  A parent that does not book it cannot overflow.
> > +              */
> > +             p = qdisc_lookup_rcu(qdisc_dev(p), TC_H_MAJ(parentid));
> > +             if (!p)
> > +                     break;
> > +
> > +             /* Hardware bytes are not ours to bound. */
> > +             if (unlikely(READ_ONCE(p->flags) & TCQ_F_OFFLOADED))
> > +                     continue;
> > +
> > +             if (unlikely((u64)READ_ONCE(p->qstats.backlog) + extra >
> > +                          QDISC_MAX_BACKLOG)) {
> > +                     rcu_read_unlock();
> > +                     return false;
> > +             }
> > +     }
>
> [Severity: Medium]
> Can taprio's counter still wrap through this apply?
>
> qdisc_ancestors_backlog_room() crosses TCQ_F_NOPARENT to check
> taprio. However, taprio's qstats.backlog is only brought up to date
> here, after the outermost enqueue or the child's peek()/dequeue has
> returned. qdisc_tree_reduce_backlog() still stops at the NOPARENT
> child.
>
> Take netem as a taprio child with tbf, dualpi2 or cake below it. A
> single child->ops->peek() from taprio_dequeue_from_txq() runs
> netem_dequeue(). Its tfifo loop can move many expired GSO packets
> into q->qdisc in one call. Each split checks the room against the
> same pre-peek taprio value, and each admitted growth is added only
> to netem. If another TXQ is already close to QDISC_MAX_BACKLOG, the
> summed growth can exceed what taprio has left.
>
> taprio_mirror_child() then applies the whole delta through
> qdisc_qstats_backlog_apply(), which wraps instead of saturating.
> Once the counter has wrapped low, taprio_backlog_overflow() no longer
> sees an overflow. taprio_resync_backlog() is then not called until
> the next dump.
>
> The enqueue side is similar. While q->mirror_child == child, the
> re-entrant netem duplicate and its segments skip the mirror. The
> pre-booking in netem_enqueue() stops at NOPARENT. taprio's value
> therefore stays frozen for every room check inside that enqueue.
>
> Should taprio_mirror_child() saturate the way taprio_resync_backlog()
> does, so that a large delta at least forces a resync on the next
> enqueue? Or does the room walk need to account for the child's
> in-flight change when it crosses into a mirror parent?
>
> [Severity: Medium]
> Does this headroom account for a pre-split packet longer than
> QDISC_PKT_LEN_MAX?
>
> qdisc_backlog_overflow() admits a packet with len above
> QDISC_PKT_LEN_MAX on an ancestor as long as backlog + 2 * len stays
> within U32_MAX. The ancestor books len only after its child returns.
> So when tbf_segment(), dualpi2_qdisc_enqueue() or
> netem_split_over_ceiling() run, the ancestor still owes 2 * orig_len
> plus the split growth.
>
> The comparison against QDISC_MAX_BACKLOG only holds back
> 2 * QDISC_PKT_LEN_MAX for that unbooked packet. If orig_len is above
> 1 MiB and slen > orig_len, the check passes even though
> backlog + 2 * slen can exceed U32_MAX by up to
> 2 * (orig_len - QDISC_PKT_LEN_MAX).
>
> tbf_segment() hands the segments to q->qdisc before tbf or its
> ancestors book slen. A netem child that duplicates each small segment
> back into the root only meets the backlog > QDISC_MAX_BACKLOG test.
> The ancestor can fill to the ceiling and then wrap when the remaining
> bytes are booked on the way back up.
>
> Should the callers pass the full 2 * slen here? Alternatively, the
> helper could take the pre-split length and reserve
> 2 * max(orig_len, QDISC_PKT_LEN_MAX) on top of the growth.
>
> [Severity: High]
> The comment says a parent that does not book the growth cannot overflow.
> The loop never skips such parents, though. Can it refuse splits because
> of counters that are never decremented?
>
> multiq_enqueue() and multiq_dequeue() only touch q.qlen. multiq's
> children are not TCQ_F_NOPARENT. So multiq's qstats.backlog is just the
> running sum of the children's qdisc_tree_reduce_backlog() deltas,
> applied with the wrapping qdisc_qstats_backlog_apply().
>
> A child drop, such as fq_codel_drop() or a codel dequeue drop, passes a
> positive length. That wraps multiq's counter from about 0 to
> U32_MAX - dropped, which is above QDISC_MAX_BACKLOG whenever less than
> 2 MiB was dropped. Every tbf, dualpi2 or netem split also adds its
> growth, and nothing removes it.
>
> After that, every later split under multiq with growth > 0 is refused,
> and tbf_segment() drops the whole list:
>
>         consume_skb(skb);
>         qdisc_qstats_overlimit(sch);
>         return qdisc_drop_all(segs, sch, to_free);
>
> dualpi2_qdisc_enqueue() and netem_split_over_ceiling() behave the same
> way.
>
> A refused split adds no delta, and multiq never decrements. Does this
> state last until the qdisc is reset?
>
> mq has a similar problem. Its backlog is written only in
> mq_dump_common(), as a dump-time u32 sum over the TX queue children.
> mqprio_dump() does the same, and so does taprio_resync_backlog() for
> full-offload taprio.
>
> After one tc -s qdisc show records a high aggregate, would splits in any
> child be refused against that stale snapshot until the next dump?
>
> The commit message says the NOPARENT crossing exists for taprio's mirror
> parent. Should the walk stop at mq, mqprio and multiq, which do not book
> bytes?
>
> > +     rcu_read_unlock();
> > +
> > +     return true;
> > +}
> > +EXPORT_SYMBOL(qdisc_ancestors_backlog_room);
> > +
> >  int qdisc_offload_dump_helper(struct Qdisc *sch, enum tc_setup_type type,
> >                             void *type_data)
> >  {
> >       struct net_device *dev = qdisc_dev(sch);
> >       int err;
> >
> > -     sch->flags &= ~TCQ_F_OFFLOADED;
> > -     if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc)
> > +     if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc) {
> > +             sch->flags &= ~TCQ_F_OFFLOADED;
> >               return 0;
> > +     }
> >
> >       err = dev->netdev_ops->ndo_setup_tc(dev, type, type_data);
> > -     if (err == -EOPNOTSUPP)
> > -             return 0;
> > -
> > -     if (!err)
> > +     if (!err) {
> >               sch->flags |= TCQ_F_OFFLOADED;
>
> [Severity: Medium]
> TCQ_F_OFFLOADED now decides whether the datapath drops packets. This is
> still a plain read-modify-write of sch->flags, run from ->dump() under
> RTNL only. Can it race with the datapath writing the same word?
>
> qdisc_warn_nonwc() does qdisc->flags |= TCQ_F_WARN_NONWC from the
> parent's dequeue under the root lock. One example is
> ets_qdisc_dequeue() calling qdisc_peek_len() on an offloaded red or tbf
> child.
>
> If the two updates interleave, the OFFLOADED bit can be lost until the
> next dump. The ceiling then applies to a counter that holds hardware
> bytes.
>
> There is also an ordering gap. Inside ndo_setup_tc() the driver writes
> hardware bytes into sch->qstats.backlog before the flag is set here.
> Nothing orders those writes against the lockless READ_ONCE() in
> qdisc_backlog_overflow().
>
> The commit message says a dump in progress keeps the exemption. That
> seems to assume a stable flags word. Is that guaranteed?
>
> > +             return 0;
> > +     }
> >
> > -     return err;
> > +     /* Also the ceiling's offload exemption: clear only on failure, so a
> > +      * dump in progress keeps it.
> > +      */
> > +     sch->flags &= ~TCQ_F_OFFLOADED;
> > +     /* -EOPNOTSUPP means "no hardware stats", not a dump failure. */
> > +     return err == -EOPNOTSUPP ? 0 : err;
> >  }
>
> [Severity: High]
> What happens to the bytes the driver wrote once the exemption is dropped
> here?
>
> Drivers update qstats.backlog with modular arithmetic, for example:
>
> mlxsw_sp_qdisc_update_stats():
>         stats_ptr->qstats->backlog += mlxsw_sp_cells_bytes(mlxsw_sp, backlog);
>
> mlxsw_sp_qdisc_leaf_unoffload():
>         qstats->backlog -= backlog;
>
> nfp_abm_stats_calculate():
>         qstats->backlog += new->backlog_bytes - old->backlog_bytes;
>
> qdisc_reset() zeroes qdisc->qstats.backlog but leaves the driver's
> stats_base alone. The next stats read can then apply a negative delta and
> wrap the counter to about U32_MAX - cells(B).
>
> Then suppose offload stops while the kernel qdisc stays, as on mlxsw's
> replace-failure unoffload path. mlxsw_sp_qdisc_get_stats() returns
> -EOPNOTSUPP, and this code clears TCQ_F_OFFLOADED with the wrapped value
> still in place.
>
> qdisc_backlog_overflow() would then see backlog > QDISC_MAX_BACKLOG and
> drop every software enqueue on that port, including CPU-originated
> control traffic. Nothing is admitted, so nothing dequeues, and the
> counter never comes down.
>
> Would the qdisc keep black-holing traffic until it is reset? The commit
> message only covers the safe direction of the coarse exemption, where
> the flag is set but no hardware bytes are held.
>
> >  EXPORT_SYMBOL(qdisc_offload_dump_helper);
> >
> > diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
> > index 2bc0dac9123a9..25c7e20ec1239 100644
> > --- a/net/sched/sch_cake.c
> > +++ b/net/sched/sch_cake.c
> > @@ -1783,6 +1783,13 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch,
> >               return ret;
> >       }
> >
> > +     /* Drop before touching the hash or shaper state. */
> > +     if (unlikely(qdisc_backlog_overflow(sch, skb))) {
> > +             qdisc_qstats_overlimit(sch);
> > +             return qdisc_drop_reason(skb, sch, to_free,
> > +                                      QDISC_DROP_OVERLIMIT);
> > +     }
> > +
>
> [Severity: Low]
> The commit message says:
>
>   The ancestor-room check covers a split whose segments would grow an
>   ancestor past the room: tbf, dualpi2, netem's corrupt split and cake.
>
> At this commit, does the CAKE_FLAG_SPLIT_GSO path in cake_enqueue()
> actually get that check? It still books the segment sum with
> qstats_backlog_add(sch, slen) and calls
> qdisc_tree_reduce_backlog(sch, 1-numsegs, len-slen). It never calls
> qdisc_ancestors_backlog_room() or checks cake's own counter.
>
> The next patch in the series ("net/sched: cake: hash before segmenting
> and reject an overlong split") adds both checks, so the code is fixed by
> the end of the series. The commit message for this patch still does not
> match its code.
>
> >       /* choose flow to insert into */
> >       b = cake_select_tin(sch, skb);
> >       idx = cake_hash(b, skb, q->config->flow_mode, flow_override,
> > diff --git a/net/sched/sch_dualpi2.c b/net/sched/sch_dualpi2.c
> > index 4947def7c49ef..bebffc3965a64 100644
> > --- a/net/sched/sch_dualpi2.c
> > +++ b/net/sched/sch_dualpi2.c
>
> [ ... ]
>
> > @@ -467,6 +468,24 @@ static int dualpi2_qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch,
> >               cnt = 0;
> >               byte_len = 0;
> >               orig_len = qdisc_pkt_len(skb);
> > +             {
> > +                     struct sk_buff *seg;
> > +                     u64 slen = 0;
> > +                     u64 growth;
> > +
> > +                     skb_list_walk_safe(nskb, seg, next)
> > +                             slen += seg->len;
> > +
> > +                     /* A duplicate can book its clone twice; reserve two. */
> > +                     growth = slen > (u64)orig_len ?
> > +                              slen - orig_len : 0;
> > +                     if (growth &&
> > +                         !qdisc_ancestors_backlog_room(sch, 2 * growth)) {
> > +                             consume_skb(skb);
> > +                             qdisc_qstats_overlimit(sch);
> > +                             return qdisc_drop_all(nskb, sch, to_free);
>
> [Severity: Medium]
> Does this drop path report the right drop reason for the segments?
>
> qdisc_drop_all() sets no reason on the list. tc_skb_cb's drop_reason
> sits at cb offset 32, and SKB_GSO_CB_OFFSET is also 32. So
> __skb_gso_segment() leaves SKB_GSO_CB(skb)->mac_offset in that slot on
> every segment.
>
> __tcf_kfree_skb_list() reads tc_skb_cb(skb)->drop_reason and passes it
> to kfree_skb_reason(). drop_monitor and the tracepoints would then see an
> unrelated skb_drop_reason. A mac_offset of 0 would also trip the
> SKB_NOT_DROPPED_YET check.
>
> tbf_segment() uses the same pattern.
>
> netem's new refusal in this patch tags each segment with
> qdisc_drop_reason(..., QDISC_DROP_OVERLIMIT). The following cake patch
> fixes the same aliasing for cake. tbf and dualpi2 are still unchanged at
> the end of the series.
>
> tbf and dualpi2 also count one drop for the whole list, while netem
> counts one drop per segment.
>
> > +                     }
> > +             }
> >               skb_list_walk_safe(nskb, nskb, next) {
> >                       skb_mark_not_on_list(nskb);
> >
>
> [ ... ]
>
> > diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
> > --- a/net/sched/sch_netem.c
> > +++ b/net/sched/sch_netem.c
> > @@ -450,6 +450,25 @@ static struct sk_buff *netem_segment(struct sk_buff *skb, struct Qdisc *sch,
> >       return segs;
> >  }
> >
> > +/* The split replicates headers per segment, so the sum outgrows what the
> > + * guard admitted; refuse it if an ancestor has no room.
> > + */
> > +static bool netem_split_over_ceiling(struct Qdisc *sch,
> > +                                  const struct sk_buff *skb,
> > +                                  const struct sk_buff *segs,
> > +                                  unsigned int prev_len)
> > +{
> > +     const struct sk_buff *seg;
> > +     u64 slen;
> > +
> > +     slen = skb ? skb->len : 0;
> > +     for (seg = segs; seg; seg = seg->next)
> > +             slen += seg->len;
> > +
> > +     return slen > prev_len &&
> > +            !qdisc_ancestors_backlog_room(sch, 2 * (slen - prev_len));
> > +}
> > +
> >  /*
> >   * Insert one skb into qdisc.
> >   * Note: parent depends on return value to account for queue length.
>
> [Severity: High]
> Does the two-copy reservation here hold when netem both duplicates
> and corrupt-splits the same GSO packet?
>
> When q->duplicate fires, skb2 is cloned from the unsegmented GSO skb
> before netem_segment() runs, while skb->tc_depth is still 0. Only
> skb2->tc_depth is bumped, so segments 2..N in segs keep tc_depth 0.
>
> The pre-booking around rootq->enqueue(skb2) covers prev_len, not the
> segment sum, and it is undone before finish_segs. The finish_segs
> loop then feeds each trailing segment back through qdisc_enqueue()
> into netem_enqueue(). Each one passes the duplicate test again and
> sends its own clone to the root. At that point none of the outer
> packet's bytes are booked on the ancestors.
>
> One enqueue can then book close to 3 * slen on an ancestor: the full
> GSO duplicate, a second duplicate of segments 2..N, and the segments
> themselves. QDISC_MAX_BACKLOG and the 2 * (slen - prev_len) passed to
> qdisc_ancestors_backlog_room() both assume at most two copies.
> Unlike tbf_segment(), this path also never checks netem's own
> counter against 2 * slen.
>
> Under taprio, the q->mirror_child == child short-circuit skips the
> mirror for the recursive enqueues. taprio_mirror_child() then applies
> all of it at once afterwards.
>
> Near the ceiling this can still wrap an ancestor's qstats.backlog,
> which is the state the patch is meant to rule out. Should the
> trailing segments get a bumped tc_depth when a duplicate was already
> made? Or should the reservation cover the extra copy?
>
> --
> Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130183825.229246-1-jhs%40mojatatu.com
Technical Details
Message-ID: <CAM0EoMms7E+MTYBMuKAO4Mfr-YzihbNVJ64smhHJ5FgUqOSGhA@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375386-linux-kernel-netdev=dewy.ru
References: <20261130183825.229246-4-jhs@mojatatu.com> <179615420192.3146.6933310288273661430@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375386-linux-kernel-netdev=dewy.ru
From: jhs@mojatatu.com (Jamal Hadi Salim)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v15 3/4] net/sched: cap the accounted backlog
 before it can wrap
Date: Tue, 1 Dec 2026 17:38:15 -0500
Organization: Usenet Network
Message-ID: <CAM0EoMms7E+MTYBMuKAO4Mfr-YzihbNVJ64smhHJ5FgUqOSGhA@mail.gmail.com>
References: <20261130183825.229246-4-jhs@mojatatu.com> <179615420192.3146.6933310288273661430@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="1834276"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:wmj0gghE5Wi/WdQry62nIdnv49w= sha256:6kXpj7KalzmlvkI4P9eP29FAw/xK3hDcWJT0u0pTlzU=
	sha1:IBjUNnjU82NjArnYxexAn382468= sha256:yPYq/8lgbN+6zlyVh99yYklI7N6A+Vztb4aUYS4qACs=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 281F51174C3; Wed,  2 Dec 2026 01:38:58 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=mojatatu.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id yXHNy_35edaq;
	Wed,  2 Dec 2026 01:38:48 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-375386-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mojatatu.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 55FD41174C0; Wed,  2 Dec 2026 01:38:34 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 9F640266F6; Tue,  1 Dec 2026 22:38:30 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796164710;
	b=gSLkl/tKCuSwMjuvd6LMJoXCCwSBcDSk5kV1wv1UjhF6+d2nMXUDX0S4OSQhKLA8zTnq
	 LDQQdDQvN5afIY9ltGawcYamzOvb8HQKP2r+vb6/LMW09CFofsvY9/DttFZnvDWS37kVC
	 MzeKjd4AbiOpoB/lMulmnb0J+uve1idJAVTCx8aLrQSrxdsfwKOm1DpN+yocQv7siKQ7p
	 jaEj35bEPsPh4C46ey4jdSEAwbP3RXhVNvM+9qklcLimv4lBicT45VMtpQvrlUfeGWyRb
	 oVSn9D6QDvqXKwNUHrUxVuGAa2Tm4CZtm9PPtfFotI7umclkiTFXalwlbxRFx0guOGg==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796164710;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:References:
	 In-Reply-To:From:Date:X-Gm-Features:Message-ID:Subject:To:Cc:
	 Content-Type:Content-Transfer-Encoding;
	bh=ZaybB/OrhZaG9dHzg93tn9wlOZWXtOoG/pBqF4wdpX8=;
	b=5cCHEHNVDiNxKbFqhXPGtFhIpLo5rdwmAqE3p3Pb2IKwzk3Cg6D1uIcJ09hN/PONf4YN
	 NBx3Ei3XLZIqPLsGuwMKB7iEz+Vs46ArD+d+VQBn7Z05OhZbaJ2vjAxofBzoYfoin5tTv
	 Sg5p27oTq+hhvJyvQJ1QmxrXFbOPe1ILIfULO4cI6A38LFsjKf6Jhw8S6svoEIWRd8J3I
	 4LKcigBFNAc6xbwWOlRDUX0jrI7tMOeNecy4EX1JZtMQX+MwdBfFOGTTTBGjVcGnXcdV3
	 7PVL1+xdsKdg1VH0NVTMHPNj+DdZgI9FQV3kBNVXF7X971MsoYYKRnRS4hfXXhWkbNA==
X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; 
	dkim=pass header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b=hJ2vcF0z;
	dmarc=none header.from=mojatatu.com;
	spf=none smtp.mailfrom=mojatatu.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 777F7606A329;
	Tue,  1 Dec 2026 22:38:30 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b=hJ2vcF0z
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.210.170
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796164709;
	b=NyYhgCs/a5gIvzzkWwsPCyB+Lx2AR77RFeuG31fMSNoxc7HlkKhz183QvYG4rpHyUIUy
	 BphTSazu+0b9AbFH6sugyFph7TyV4I+Ef+NYY+vu/3H403usXbTyYP1pZnrGwi7q6NIkx
	 B/tOZCdTlO7JJnj8OqNG15CfD5vrSRGQ6mjgZG4jm8Yx34WkBQLgK2wqoLQLptBovyLyP
	 QjjnH5ix0he57R5r9/PUiU7Pz850Q9OerdzJmDCxerEIGNdI5MPfM0XfbjlnLN2Va7H4Q
	 rRzXyoBDNosXzxo2tjcu/PGgT33i4eo0dVGRqW8HpQUNo55r4kYDvYRgN87ES/5eU9w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796164709;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:MIME-Version:References:
	 In-Reply-To:From:Date:X-Gm-Features:Message-ID:Subject:To:Cc:
	 Content-Type:Content-Transfer-Encoding;
	bh=ZaybB/OrhZaG9dHzg93tn9wlOZWXtOoG/pBqF4wdpX8=;
	b=DaEtHVVqc2fd6HbG5qjWdNZQsZ7ut/O+nz8WuVUabkrAwCqCzPGsl3slw76EhBmJpIv1
	 EAC4srINmdO9lJCQ3VBnfK3/9EwjY/OFJ8+FstTG+AuKItlGLYWd9nd+u2o1pd/m/sn9I
	 NIoU0++0e6A0Aj67DCgvZi9ygCt37D37gSiIzGgNFomhwSuZKBwQejMC9aPcPdade/fCE
	 fmAYEs0Y9ZvFRB+ls7kjTJK+K4rKK4I1foL65hGiztvigVs3gt+gqZavkY2CYYWSLNEbo
	 GxEqAgaolQTO1isYF06Z/NKPdNlfuUXe60bg7In6EXGETvFNgeCmye5BNMXJxnYJoVA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=none header.from=mojatatu.com;
	spf=none smtp.mailfrom=mojatatu.com;
	dkim=pass header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b=hJ2vcF0z;
	arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.210.170
X-Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id BEC94606A31A
	for <netdev@vger.kernel.org>; Tue,  1 Dec 2026 22:38:28 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BEC94606A31A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mojatatu.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=mojatatu.com
X-Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-8d1aec63541so2293546b3a.3
        for <netdev@vger.kernel.org>; Tue, 01 Dec 2026 14:38:28 -0800 (PST)
X-ARC-Seal: i=1; a=rsa-sha256; t=1796164708; cv=none;
        d=google.com; s=arc-20260327;
        b=KqYS8AyonoKuU+k9zty/VLVB/ThYFn5FnMPnZdrDZ3DDC08+XWXhiD6kXQonXjg0a1
         X44snvlTDfqA20ciSz/qAaFFPO/Pnv4loFvnxfbhtUrJg1x/tSGaz/CFNvk/kQdVHa00
         FXAxYRJVQWqaO9p/PyseZ8Glq7Gt9i3ifiX7lJpG4HjzNZdeQL6xLQdMgK6+Ryg0a16+
         pDEGPuIIKvmxn5+0D+iDNxe4OfRYT9yfEsJRHmZW8dfS1XHJ2m41nvgJm1W09XcyOPzz
         P7b15Z4sv7BSNC81e4616V49BVKimrrWIxO47HsSTStT1RVlLPezx9vcXWve56paKCu8
         y3Iw==
X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327;
        h=content-transfer-encoding:cc:to:subject:message-id:date:from
         :in-reply-to:references:mime-version:dkim-signature;
        bh=ZaybB/OrhZaG9dHzg93tn9wlOZWXtOoG/pBqF4wdpX8=;
        fh=/JRo5etiqGp9Zy1NWi56ZZYX/xbM6ZRXnWa93KmCb24=;
        b=c/gQ2fReko+NQmCNDFeRiCRb9guo34DN9z+oSLRYzLG5Mgg8OyGzP1ZIUihgEhUCut
         uC3GNHprUH/CCM+EeO1KYpYe+slveO1jTdIeXZBSggydCGXvr+sJsqlTI02cOdWWAua1
         Cny/aPfaMwjWSONH+hi1MtKTt+OnJAi6IB8pTN+xpaZDNSsz7q/pacSjeiHfDlpHtFPr
         ksRCN0f91uTQ58KPHYG6gwUs/hM5yRMfudq69gp3qkmwSKhFOHDOCi1QYDw/RnvCsRqu
         vpEostSPkTE1JaCPTYhVPpzn7eTY4RoRmza5S8FCE+tMIOq3e7VSWQjH//erAQBIkJoC
         1CHQ==;
        darn=vger.kernel.org
X-ARC-Authentication-Results: i=1; mx.google.com; arc=none
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=mojatatu.com; s=google; t=1796164708; x=1796769508; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:cc:to:subject:message-id
         :date:from:in-reply-to:references:mime-version:from:to:cc:subject
         :date:message-id:reply-to:content-type;
        bh=ZaybB/OrhZaG9dHzg93tn9wlOZWXtOoG/pBqF4wdpX8=;
        b=hJ2vcF0z6geARYMOf44spu2f5HwLBKEvE6LACINxqSFDT/8PqU8bPf12GT++25f7kn
         X/L0gzQNqyoLK7RRK72D3uOE+wruQAT4+4p9Guu50JFy2AX31dxMKpwpN1B0x1+zJq/e
         2nTKM2dlyeWdGACisI8XD2rsrxo93OiSHbjnY=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1796164708; x=1796769508;
        h=content-transfer-encoding:content-type:cc:to:subject:message-id
         :date:from:in-reply-to:references:mime-version:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=ZaybB/OrhZaG9dHzg93tn9wlOZWXtOoG/pBqF4wdpX8=;
        b=qxD4YTnQd0BRBglKZvt79pvSG2vJr84TAga5QS4YNT3C0Wj27TIFrvissMlAof8HST
         g18L9PRhQkZdFIOmhCyI7FIur/ENKCo9uUmbXfMQHB4whRnVLQtvxDhCyJyt8n3RaUIG
         k1KXSCF8ufH1RZzaYYxS13Hk25E8QsNIHKNepgIajtxxVvMKVV2NbQY+T3BX9GOt2aRo
         hVU1Ns3ui9HY3QaRk2SLTMWRKXfoE4a1JehCkZH7nT21BAYEPaq0FGwSAWD84RbEDBFS
         +0s4oXjiwHuZ6pxSwGblKVFqzbiKQrHxiz4XUytNOhejcuAFRkiaQo7SkZ047ABn3Cyj
         Q3Qw==
X-Gm-Message-State: APuU4Z8sQNwKwIPStqsFZfPV+uLmZ6zLwMi/L92O562rftz+xU5OcwWJ
	8myyCW+lfRKa67MPlXZ5N3saaynYf8lSmcMQIxp5U4mQvlNIFG1Up4WCLnd11lHszips9e0XM/e
	8/KxaOCbbI55RnAZd4EKdGhTsKxXgoUX/LWHD6PW/
X-Gm-Gg: AZFdTZfXfsqH8Vtx60FG+sObaSoLv6bzUl3RzcIGIU5IdzkAAkfrFOoG5OHFJsU7km4
	wbmiH5+32dEdcYiZM1tz7XJU0Nmd8EqG8SQR6ATQfHeHhgkcXzTOXeTXdZgcIAVrZdNncDi36HM
	eNDUmDm//LE7uvNZ8LW6wP5CFk9HBp4rRUbkwqh0Ufc29LajSnRJvFGmsjcQO+m8loEYUC1uJaV
	QsFh+X8DniD9nF6tA6tpnnAQs2k9l6HmdaH0yO+jFDLXy/QGUTeJ9ZpcAyp6HXTgH/ar4gW7sn2
	k/1WPLA97/qP2BPKqY3ogeDzIqbHjFcmX5Cv2A8KoQWL7KKc4qxiI89WKwr2MD18b5+1D4pm88S
	B8OsNaO+wDjYZADG9QCYqsDe+Oxnur3GWU/COFJK+ACqoVq84zZ0NlMxQSz/x7TkusoUN2d4tsv
	neXY5WKgnMxIRYrmDPquzN94b0MWJHvq0wA4tkyaBdGILa086Z78umvMnDtnBAh4QNosZazDL2N
	D71++2SM8xWBVk2XQ4w+ouRAYws6wCgWVd1f70=
X-Received: by 2002:a05:6a20:c791:b0:3fa:162b:d209 with SMTP id
 adf61e73a8af0-4014ae820a3mr42560128637.15.1796164707585; Tue, 01 Dec 2026
 14:38:27 -0800 (PST)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <179615420192.3146.6933310288273661430@kernel.org>
X-Gm-Features: Aa3M54quXkjQHfTqJIiTlcwETLmUirg0AMfECz6AU1IxH7h2Z-8p3Mgv0gEKM8A
X-Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org, 
	kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, 
	jiri@resnulli.us, stephen@networkplumber.org, vinicius.gomes@intel.com, 
	toke@toke.dk, victor@mojatatu.com, bjorn@kernel.org, sashiko-bot@kernel.org