Re: [PATCH v4 6/6] arm64: Enable perf events based hard lockup detector

From: Petr Mladek
Date: Fri May 20 2022 - 05:47:44 EST


On Thu 2022-04-28 00:13:40, Lecopzer Chen wrote:
> With the recent feature added to enable perf events to use pseudo NMIs
> as interrupts on platforms which support GICv3 or later, its now been
> possible to enable hard lockup detector (or NMI watchdog) on arm64
> platforms. So enable corresponding support.
>
> One thing to note here is that normally lockup detector is initialized
> just after the early initcalls but PMU on arm64 comes up much later as
> device_initcall(). To cope with that, overriding watchdog_nmi_probe() to
> let the watchdog framework know PMU not ready, and inform the framework
> to re-initialize lockup detection once PMU has been initialized.
>
> [1]: http://lore.kernel.org/linux-arm-kernel/1610712101-14929-1-git-send-email-sumit.garg@xxxxxxxxxx
>
> --- a/arch/arm64/kernel/perf_event.c
> +++ b/arch/arm64/kernel/perf_event.c
> @@ -1390,10 +1391,15 @@ static struct platform_driver armv8_pmu_driver = {
>
> static int __init armv8_pmu_driver_init(void)
> {
> + int ret;
> +
> if (acpi_disabled)
> - return platform_driver_register(&armv8_pmu_driver);
> + ret = platform_driver_register(&armv8_pmu_driver);
> else
> - return arm_pmu_acpi_probe(armv8_pmuv3_pmu_init);
> + ret = arm_pmu_acpi_probe(armv8_pmuv3_pmu_init);
> +
> + retry_lockup_detector_init();

Does it makes sense to call retry_lockup_detector_init() when
the above returned an error? Should it be?

if (!ret)
retry_lockup_detector_init();

> + return ret;
> }
> device_initcall(armv8_pmu_driver_init)


I am not qualified to ack the arm-specific code. But otherwise
the change looks reasonable.

Best Regards,
Petr