Subject: Re: [PATCH net-next v2] net/sched: sch_dualpi2: annotate lockless stats reads in dump path

From: Breno Leitao <[email-masked]>
Date: Fri, 8 May 2026 02:26:12 -0700

On Fri, May 08, 2026 at 12:59:18PM +0530, Vineet Agarwal wrote:
> No WRITE_ONCE() annotations are added because these statistics are
> maintained as best-effort counters

Adding READ_ONCE() on the dumper side without matching WRITE_ONCE() on
the writer side does prevent torn stores, and also not actually silence
KCSAN, last time I checked.

> , and the update paths already use simple non-synchronized increments
> consistent with existing qdisc statistics patterns. The intent of this
> change is only to make the lockless read semantics explicit.

I am not sure READ_ONCE() does that. Usually data_race is best used for
this.

> diff --git a/net/sched/sch_dualpi2.c b/net/sched/sch_dualpi2.c index
> 241e6a46bd00..40035f70db80 100644 --- a/net/sched/sch_dualpi2.c +++
> b/net/sched/sch_dualpi2.c @@ -1046,14 +1046,14 @@ static int
> dualpi2_dump_stats(struct Qdisc *sch, struct gnet_dump *d) struct
> dualpi2_sched_data *q = qdisc_priv(sch); struct tc_dualpi2_xstats st
> = { .prob			= READ_ONCE(q->pi2_prob),
...
> +		.credit                 = q->c_protection_credit,

Why this is unnanotated. isn't it uupdated locklessly in
dualpi2_qdisc_dequeue()?

Also, you have spaces other than tab for this instance.