[External] Re: [PATCH v2 1/2] watchdog: move arm64 watchdog_hld into common code
Doug Anderson
dianders at chromium.org
Fri Sep 26 13:57:31 PDT 2025
Hi,
On Fri, Sep 26, 2025 at 2:37 AM yunhui cui <cuiyunhui at bytedance.com> wrote:
>
> Hi Doug,
>
> On Fri, Sep 26, 2025 at 4:00 AM Doug Anderson <dianders at chromium.org> wrote:
> >
> > Hi,
> >
> > On Thu, Sep 25, 2025 at 1:48 AM Yunhui Cui <cuiyunhui at bytedance.com> wrote:
> > >
> > > @@ -17,6 +17,7 @@
> > > #include <linux/cpu_pm.h>
> > > #include <linux/export.h>
> > > #include <linux/kernel.h>
> > > +#include <linux/nmi.h>
> > > #include <linux/perf/arm_pmu.h>
> > > #include <linux/slab.h>
> > > #include <linux/sched/clock.h>
> > > @@ -696,10 +697,12 @@ static int armpmu_get_cpu_irq(struct arm_pmu *pmu, int cpu)
> > > return per_cpu(hw_events->irq, cpu);
> > > }
> > >
> > > -bool arm_pmu_irq_is_nmi(void)
> > > +#ifdef CONFIG_HARDLOCKUP_DETECTOR_PERF
> > > +bool arch_perf_nmi_is_available(void)
> > > {
> > > return has_nmi;
> > > }
> > > +#endif
> >
> > Should the previous comment move here, AKA:
> >
> > /*
> > * hardlockup_detector_perf_init() will success even if Pseudo-NMI turns off,
>
> Okay, we also need to change it to “watchdog_hardlockup_probe()”
>
> > * however, the pmu interrupts will act like a normal interrupt instead of
> > * NMI and the hardlockup detector would be broken.
> > */
> >
> >
> > > +static int __init init_watchdog_freq_notifier(void)
> > > +{
> > > + return cpufreq_register_notifier(&watchdog_freq_notifier,
> > > + CPUFREQ_POLICY_NOTIFIER);
> >
> > I think you need to do something to prevent this from happening on any
> > platforms that override hw_nmi_get_sample_period(), right? These
> > cpufreq notifiers will be useless in that case...
>
> I understand this is not a problem. watchdog_perf uses
> PERF_COUNT_HW_CPU_CYCLES, which means it is inherently limited by the
> CPU's main frequency. After we make such a change, a larger value may
> be used as the period, so the NMI period will become longer, but this
> value will not change after the system starts.
I'm not sure I follow. On x86, hw_nmi_get_sample_period() is:
u64 hw_nmi_get_sample_period(int watchdog_thresh)
{
return (u64)(cpu_khz) * 1000 * watchdog_thresh;
}
On PowerPC it's:
u64 hw_nmi_get_sample_period(int watchdog_thresh)
{
return ppc_proc_freq * watchdog_thresh;
}
Neither of those are necessarily based on the results the cpufreq
reports. ...so therefore I don't think you should be taking the
cpufreq reported numbers and assuming they're OK on x86 and powerpc.
-Doug
More information about the linux-riscv
mailing list