From: Bitao Hu <yaoma@linux.alibaba.com>
To: Doug Anderson <dianders@chromium.org>
Cc: akpm@linux-foundation.org, pmladek@suse.com,
kernelfans@gmail.com, liusong@linux.alibaba.com,
linux-kernel@vger.kernel.org, yaoma@linux.alibaba.com
Subject: Re: [PATCHv6 2/2] watchdog/softlockup: report the most frequent interrupts
Date: Sun, 11 Feb 2024 23:41:23 +0800 [thread overview]
Message-ID: <05563a26-9c3f-4a3b-ade6-c417feca70e6@linux.alibaba.com> (raw)
In-Reply-To: <CAD=FV=UP_G3Rswi_HePkgmcniADKhkoP51=H=PxGKbdegEfUgg@mail.gmail.com>
On 2024/2/9 00:03, Doug Anderson wrote:
> Hi,
>
> On Thu, Feb 8, 2024 at 4:54 AM Bitao Hu <yaoma@linux.alibaba.com> wrote:
>>
>> +static void start_counting_irqs(void)
>> +{
>> + int i;
>> + int local_nr_irqs;
>> + struct irq_desc *desc;
>> + u32 *counts = __this_cpu_read(hardirq_counts);
>> +
>> + if (!counts) {
>> + /*
>> + * nr_irqs has the potential to grow at runtime. We should read
>> + * it and store locally to avoid array out-of-bounds access.
>> + */
>> + local_nr_irqs = READ_ONCE(nr_irqs);
>
> nit: I don't think the READ_ONCE() is actually needed above. All that
> matters is that you're consistently using the same local variable
> ("local_nr_irqs") for allocating the array, looping, and then storing.
> No matter what optimizations might be happening and what else might be
> happening on other CPUs, once you put it in a local variable the
> compiler _must_ keep it consistent.
Oh, yes, READ_ONCE() is not necessary here.
>
> That being said, I don't think it really matters, so I'm not sure it's
> worth spinning your series just for that.
>
> In any case, this patch looks good to me now. Thanks!
>
> Reviewed-by: Douglas Anderson <dianders@chromium.org>
next prev parent reply other threads:[~2024-02-11 15:41 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-08 12:54 [PATCHv6 0/2] *** Detect interrupt storm in softlockup *** Bitao Hu
2024-02-08 12:54 ` [PATCHv6 1/2] watchdog/softlockup: low-overhead detection of interrupt Bitao Hu
2024-02-08 16:03 ` Doug Anderson
2024-02-09 13:35 ` Petr Mladek
2024-02-11 15:35 ` Bitao Hu
2024-02-11 23:46 ` Doug Anderson
2024-02-10 13:32 ` Liu Song
2024-02-08 12:54 ` [PATCHv6 2/2] watchdog/softlockup: report the most frequent interrupts Bitao Hu
2024-02-08 16:03 ` Doug Anderson
2024-02-11 15:41 ` Bitao Hu [this message]
2024-02-09 14:39 ` Petr Mladek
2024-02-11 15:36 ` Bitao Hu
2024-02-10 13:33 ` Liu Song
2024-02-09 14:48 ` [PATCHv6 0/2] *** Detect interrupt storm in softlockup *** Petr Mladek
2024-02-11 15:36 ` Bitao Hu
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=05563a26-9c3f-4a3b-ade6-c417feca70e6@linux.alibaba.com \
--to=yaoma@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=dianders@chromium.org \
--cc=kernelfans@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liusong@linux.alibaba.com \
--cc=pmladek@suse.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
all inboxes | Powered by JetHome®