[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZHCn4hNxFpY5-9Ki@alley>
Date: Fri, 26 May 2023 14:36:50 +0200
From: Petr Mladek <pmladek@...e.com>
To: Douglas Anderson <dianders@...omium.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Matthias Kaehlcke <mka@...omium.org>,
kgdb-bugreport@...ts.sourceforge.net,
Stephane Eranian <eranian@...gle.com>, mpe@...erman.id.au,
Tzung-Bi Shih <tzungbi@...omium.org>,
Daniel Thompson <daniel.thompson@...aro.org>,
Mark Rutland <mark.rutland@....com>,
linuxppc-dev@...ts.ozlabs.org, Sumit Garg <sumit.garg@...aro.org>,
npiggin@...il.com, davem@...emloft.net,
Marc Zyngier <maz@...nel.org>,
Stephen Boyd <swboyd@...omium.org>, sparclinux@...r.kernel.org,
christophe.leroy@...roup.eu,
Catalin Marinas <catalin.marinas@....com>,
ravi.v.shankar@...el.com, Randy Dunlap <rdunlap@...radead.org>,
Pingfan Liu <kernelfans@...il.com>,
Guenter Roeck <groeck@...omium.org>,
Lecopzer Chen <lecopzer.chen@...iatek.com>,
Ian Rogers <irogers@...gle.com>, ito-yuichi@...itsu.com,
ricardo.neri@...el.com, linux-arm-kernel@...ts.infradead.org,
linux-perf-users@...r.kernel.org, Will Deacon <will@...nel.org>,
Chen-Yu Tsai <wens@...e.org>, linux-kernel@...r.kernel.org,
Masayoshi Mizuma <msys.mizuma@...il.com>,
Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH v5 15/18] watchdog/perf: Add a weak function for an arch
to detect if perf can use NMIs
On Fri 2023-05-19 10:18:39, Douglas Anderson wrote:
> On arm64, NMI support needs to be detected at runtime. Add a weak
> function to the perf hardlockup detector so that an architecture can
> implement it to detect whether NMIs are available.
>
> Signed-off-by: Douglas Anderson <dianders@...omium.org>
> ---
> While I won't object to this patch landing, I consider it part of the
> arm64 perf hardlockup effort. I would be OK with the earlier patches
> in the series landing and then not landing ${SUBJECT} patch nor
> anything else later.
>
> I'll also note that, as an alternative to this, it would be nice if we
> could figure out how to make perf_event_create_kernel_counter() fail
> on arm64 if NMIs aren't available. Maybe we could add a "must_use_nmi"
> element to "struct perf_event_attr"?
>
> --- a/kernel/watchdog_perf.c
> +++ b/kernel/watchdog_perf.c
> @@ -234,12 +234,22 @@ void __init hardlockup_detector_perf_restart(void)
> }
> }
>
> +bool __weak __init arch_perf_nmi_is_available(void)
> +{
> + return true;
> +}
> +
> /**
> * watchdog_hardlockup_probe - Probe whether NMI event is available at all
> */
> int __init watchdog_hardlockup_probe(void)
> {
> - int ret = hardlockup_detector_event_create();
> + int ret;
> +
> + if (!arch_perf_nmi_is_available())
> + return -ENODEV;
My understanding is that this would block the perf hardlockup detector
at runtime. Does it work with the "nmi_watchdog" sysctl. I see
that it is made read-only when it is not enabled at build time,
see NMI_WATCHDOG_SYSCTL_PERM.
> +
> + ret = hardlockup_detector_event_create();
>
> if (ret) {
> pr_info("Perf NMI watchdog permanently disabled\n");
Best Regards,
Petr
Powered by blists - more mailing lists