linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Sumit Garg <sumit.garg@linaro.org>
Cc: mark.rutland@arm.com, daniel.thompson@linaro.org,
	linux-kernel@vger.kernel.org, lecopzer.chen@mediatek.com,
	catalin.marinas@arm.com, dianders@chromium.org,
	swboyd@chromium.org, alexandru.elisei@arm.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v5] arm64: Enable perf events based hard lockup detector
Date: Tue, 26 Jan 2021 14:18:19 +0000	[thread overview]
Message-ID: <20210126141818.GC29956@willie-the-truck> (raw)
In-Reply-To: <1610712101-14929-1-git-send-email-sumit.garg@linaro.org>

Hi Sumit,

On Fri, Jan 15, 2021 at 05:31:41PM +0530, Sumit Garg 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(). So we need to re-initialize lockup detection once
> PMU has been initialized.
> 
> Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> ---

[...]

> diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
> index 3605f77a..bafb7c8 100644
> --- a/arch/arm64/kernel/perf_event.c
> +++ b/arch/arm64/kernel/perf_event.c
> @@ -23,6 +23,8 @@
>  #include <linux/platform_device.h>
>  #include <linux/sched_clock.h>
>  #include <linux/smp.h>
> +#include <linux/nmi.h>
> +#include <linux/cpufreq.h>
>  
>  /* ARMv8 Cortex-A53 specific event types. */
>  #define ARMV8_A53_PERFCTR_PREF_LINEFILL				0xC2
> @@ -1246,12 +1248,30 @@ static struct platform_driver armv8_pmu_driver = {
>  	.probe		= armv8_pmu_device_probe,
>  };
>  
> +static int __init lockup_detector_init_fn(void *data)
> +{
> +	lockup_detector_init();
> +	return 0;
> +}
> +
>  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_init);
> +		ret = arm_pmu_acpi_probe(armv8_pmuv3_init);
> +
> +	/*
> +	 * Try to re-initialize lockup detector after PMU init in
> +	 * case PMU events are triggered via NMIs.
> +	 */
> +	if (ret == 0 && arm_pmu_irq_is_nmi())
> +		smp_call_on_cpu(raw_smp_processor_id(), lockup_detector_init_fn,
> +				NULL, false);
> +
> +	return ret;

What's wrong with the alternative approach outlined by Mark:

https://lore.kernel.org/r/20210113130235.GB19011@C02TD0UTHF1T.local

?

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-01-26 14:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 12:01 [PATCH v5] arm64: Enable perf events based hard lockup detector Sumit Garg
2021-01-26 14:18 ` Will Deacon [this message]
2021-01-28  7:07   ` Sumit Garg
2021-02-19  9:37 ` Sumit Garg
2021-03-30  8:06   ` Lecopzer Chen
2021-03-30  8:32     ` Lecopzer Chen
2021-03-30 12:30       ` Sumit Garg
2021-04-12 12:01         ` Sumit Garg
2021-04-19 17:03           ` Will Deacon
     [not found] ` <CAFA6WYOygwhhH4fuB8DFPHWF5KkxORH0E0AKL8Xp0y1jNuQr-w@mail.gmail.com>
2021-07-19  6:35   ` Fwd: " Huang Shijie

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=20210126141818.GC29956@willie-the-truck \
    --to=will@kernel.org \
    --cc=alexandru.elisei@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=daniel.thompson@linaro.org \
    --cc=dianders@chromium.org \
    --cc=lecopzer.chen@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=sumit.garg@linaro.org \
    --cc=swboyd@chromium.org \
    /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;
as well as URLs for NNTP newsgroup(s).