Re: [PATCHv5 1/3] watchdog/softlockup: low-overhead detection of interrupt

From: Doug Anderson
Date: Wed Feb 07 2024 - 12:14:17 EST


Hi,

On Tue, Feb 6, 2024 at 10:18 PM Bitao Hu <yaoma@xxxxxxxxxxxxxxxxx> wrote:
>
> >> +static void print_cpustat(void)
> >> +{
> >> + int i, group;
> >> + u8 tail = __this_cpu_read(cpustat_tail);
> >
> > Sorry for not noticing before, but why are you using
> > "__this_cpu_read()" instead of "this_cpu_read()"? In other words, why
> > do you need the double-underscore version everywhere? I don't think
> > you do, do you?
> I also struggled with which version of the operation to use. The one
> without double-underscores provides preemption/interrupt protection,
> but in watchdog.c, the version with double-underscores is used. I
> analyzed that it is also safe to use the version without
> preemption/interrupt protection in my code, so to maintain consistency
> with watchdog.c, I ues the version with double-underscores.
>
> Is my approach reasonable? If not, I will switch to using the
> non-underscored version.

Ah, OK. I hadn't followed the macros all the way through to the
arch-specific defines and I didn't see the preemption disable. OK,
what you have seems fine to me, especially since the double-underscore
version still has double-checks that preemption is disabled. Thanks
for explaining!

-Doug