[RESEND PATCH v2 2/2] arm64/watchdog_hld: Add a cpufreq notifier for update watchdog thresh
Yicong Yang
yangyicong at huawei.com
Mon Jun 30 01:38:01 PDT 2025
On 2025/6/27 23:35, Will Deacon wrote:
> On Thu, Jun 19, 2025 at 07:48:05PM +0800, Yicong Yang wrote:
>> From: Yicong Yang <yangyicong at hisilicon.com>
>>
>> arm64 depends on the cpufreq driver to gain the maximum cpu frequency
>> to convert the watchdog_thresh to perf event period. cpufreq drivers
>> like cppc_cpufreq will be initialized lately after the initializing of
>> the hard lockup detector so just use a safe cpufreq which will be
>> inaccurency. Use a cpufreq notifier to adjust the event's period to
>> a more accurate one.
>>
>> Signed-off-by: Yicong Yang <yangyicong at hisilicon.com>
>> ---
>> arch/arm64/kernel/watchdog_hld.c | 58 ++++++++++++++++++++++++++++++++
>> 1 file changed, 58 insertions(+)
>>
>> diff --git a/arch/arm64/kernel/watchdog_hld.c b/arch/arm64/kernel/watchdog_hld.c
>> index dcd25322127c..e55548cb26df 100644
>> --- a/arch/arm64/kernel/watchdog_hld.c
>> +++ b/arch/arm64/kernel/watchdog_hld.c
>> @@ -34,3 +34,61 @@ bool __init arch_perf_nmi_is_available(void)
>> */
>> return arm_pmu_irq_is_nmi();
>> }
>> +
>> +static int watchdog_perf_update_period(void *data)
>> +{
>> + int cpu = raw_smp_processor_id();
>
> Why raw?
>
smp_processor_id() also works for me, since here's running in a per-cpu worker from
smp_call_on_cpu() so we won't violate the check in smp_processor_id() when
CONFIG_DEBUG_PREEMPT=y. I might think the raw_smp_processora_id() is okay since we're
known to run on the local cpu so the unstable raw_smp_processor_id() is fine.
thanks.
More information about the linux-arm-kernel
mailing list