Netdev List
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Vineet Agarwal <agarwal.vineet2006@gmail.com>
Cc: netdev@vger.kernel.org, jhs@mojatatu.com, jiri@resnulli.us,
	 davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com,  horms@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2] net/sched: sch_dualpi2: annotate lockless stats reads in dump path
Date: Fri, 8 May 2026 02:26:12 -0700	[thread overview]
Message-ID: <af2rSnp-8Bhw-GHI@gmail.com> (raw)
In-Reply-To: <20260508072918.324797-1-agarwal.vineet2006@gmail.com>

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.

  reply	other threads:[~2026-05-08  9:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08  7:29 [PATCH net-next v2] net/sched: sch_dualpi2: annotate lockless stats reads in dump path Vineet Agarwal
2026-05-08  9:26 ` Breno Leitao [this message]
2026-05-08 23:08 ` Jakub Kicinski

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=af2rSnp-8Bhw-GHI@gmail.com \
    --to=leitao@debian.org \
    --cc=agarwal.vineet2006@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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