From: sashiko-bot@kernel.org
To: "Runyu Xiao" <runyu.xiao@seu.edu.cn>
Cc: linux-rt-devel@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: gen_estimator: protect seqcount updates from hardirq readers
Date: Thu, 24 Sep 2026 03:29:50 +0000 [thread overview]
Message-ID: <20260924032950.C2A351F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260923032936.2020902-1-runyu.xiao@seu.edu.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] net: gen_estimator: unnecessary irq disable for non-existent hardirq reader
--
commit 9722f5db0aef7c6cb33fd991daa5c91e6188c2bb
Author: Runyu Xiao <runyu.xiao@seu.edu.cn>
net: gen_estimator: protect seqcount updates from hardirq readers
This commit modifies est_timer() to disable local interrupts instead of
just disabling preemption when updating the estimator sequence counter.
The commit message notes this is to prevent a spinning hardirq reader,
reproducing a lockdep warning via a test-only hardirq injection.
> diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
> index c34e58c6c3e66..6aba5916d7959 100644
> --- a/net/core/gen_estimator.c
> +++ b/net/core/gen_estimator.c
[ ... ]
> @@ -90,12 +91,12 @@ static void est_timer(struct timer_list *t)
> rate = (b_packets - est->last_packets) << (10 - est->intvl_log);
> rate = (rate >> est->ewma_log) - (est->avpps >> est->ewma_log);
>
> - preempt_disable_nested();
> + local_irq_save(flags);
[Severity: Medium]
Does this unnecessarily increase hardirq latency and CPU overhead by replacing
a zero-overhead preemption disable (on non-RT) with an expensive hardware
interrupt disable?
The commit message explicitly states this was triggered by a test-only hardirq
injection. In a production environment, gen_estimator_read() is only called
from softirq or process contexts (such as netfilter hooks, TC actions, or
stats dumping), and never from hardirq context.
Since est_timer() executes unconditionally, this change appears to add
overhead to the fast path to protect against a state that is structurally
impossible in actual usage.
> write_seqcount_begin(&est->seq);
> est->avbps += brate;
> est->avpps += rate;
> write_seqcount_end(&est->seq);
> - preempt_enable_nested();
> + local_irq_restore(flags);
>
> est->last_bytes = b_bytes;
> est->last_packets = b_packets;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260923032936.2020902-1-runyu.xiao@seu.edu.cn?part=1
prev parent reply other threads:[~2026-09-24 3:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 3:29 Runyu Xiao
2026-09-23 6:24 ` Sebastian Andrzej Siewior
2026-09-23 7:43 ` Runyu Xiao
2026-09-23 7:12 ` Eric Dumazet
2026-09-24 3:29 ` sashiko-bot [this message]
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=20260924032950.C2A351F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=runyu.xiao@seu.edu.cn \
--cc=sashiko-reviews@lists.linux.dev \
/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
all inboxes | Powered by JetHome®