linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Add HARDLOCKUP_DETECTOR_PERF for riscv
@ 2025-08-27 10:09 Yunhui Cui
  2025-08-27 10:09 ` [PATCH 1/2] watchdog: refactor watchdog_hld functionality Yunhui Cui
  2025-08-27 10:09 ` [PATCH 2/2] riscv: add HARDLOCKUP_DETECTOR_PERF support Yunhui Cui
  0 siblings, 2 replies; 9+ messages in thread
From: Yunhui Cui @ 2025-08-27 10:09 UTC (permalink / raw)
  To: paul.walmsley, palmer, aou, alex, atish.patra, anup, will,
	mark.rutland, linux-riscv, linux-kernel, linux-arm-kernel,
	linux-perf-users, catalin.marinas, masahiroy, suzuki.poulose,
	cuiyunhui, maz, zhanjie9, yangyicong, dianders, mingo, lihuafei1,
	akpm, jpoimboe, rppt, kees, thomas.weissschuh

This patchset is mainly based on RISCV_SSE, and the enabling of the
hardlockup perf feature depends on RISCV_PMU_SSE.
Link: https://lore.kernel.org/all/20250808153901.2477005-1-cleger@rivosinc.com/
patch[1]: Move watchdog_hld.c to kernel/ to facilitate reuse by RISC-V.
patch[2]: Add Kconfig selections for RISC-V.

Yunhui Cui (2):
  watchdog: refactor watchdog_hld functionality
  riscv: add HARDLOCKUP_DETECTOR_PERF support

 arch/arm64/kernel/Makefile                   | 1 -
 arch/riscv/Kconfig                           | 3 +++
 drivers/perf/arm_pmu.c                       | 2 +-
 drivers/perf/riscv_pmu_sbi.c                 | 8 ++++++++
 include/linux/nmi.h                          | 1 +
 include/linux/perf/arm_pmu.h                 | 2 --
 kernel/Makefile                              | 2 +-
 {arch/arm64/kernel => kernel}/watchdog_hld.c | 8 ++++++--
 8 files changed, 20 insertions(+), 7 deletions(-)
 rename {arch/arm64/kernel => kernel}/watchdog_hld.c (97%)

-- 
2.39.5



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] watchdog: refactor watchdog_hld functionality
  2025-08-27 10:09 [PATCH 0/2] Add HARDLOCKUP_DETECTOR_PERF for riscv Yunhui Cui
@ 2025-08-27 10:09 ` Yunhui Cui
  2025-08-29 21:33   ` Doug Anderson
  2025-08-27 10:09 ` [PATCH 2/2] riscv: add HARDLOCKUP_DETECTOR_PERF support Yunhui Cui
  1 sibling, 1 reply; 9+ messages in thread
From: Yunhui Cui @ 2025-08-27 10:09 UTC (permalink / raw)
  To: paul.walmsley, palmer, aou, alex, atish.patra, anup, will,
	mark.rutland, linux-riscv, linux-kernel, linux-arm-kernel,
	linux-perf-users, catalin.marinas, masahiroy, suzuki.poulose,
	cuiyunhui, maz, zhanjie9, yangyicong, dianders, mingo, lihuafei1,
	akpm, jpoimboe, rppt, kees, thomas.weissschuh

Move watchdog_hld.c to kernel/, and rename arm_pmu_irq_is_nmi()
to arch_pmu_irq_is_nmi() for cross-arch reusability.

Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
---
 arch/arm64/kernel/Makefile                   | 1 -
 drivers/perf/arm_pmu.c                       | 2 +-
 include/linux/nmi.h                          | 1 +
 include/linux/perf/arm_pmu.h                 | 2 --
 kernel/Makefile                              | 2 +-
 {arch/arm64/kernel => kernel}/watchdog_hld.c | 8 ++++++--
 6 files changed, 9 insertions(+), 7 deletions(-)
 rename {arch/arm64/kernel => kernel}/watchdog_hld.c (97%)

diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index 76f32e424065e..12d77f373fea4 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -44,7 +44,6 @@ obj-$(CONFIG_KUSER_HELPERS)		+= kuser32.o
 obj-$(CONFIG_FUNCTION_TRACER)		+= ftrace.o entry-ftrace.o
 obj-$(CONFIG_MODULES)			+= module.o module-plts.o
 obj-$(CONFIG_PERF_EVENTS)		+= perf_regs.o perf_callchain.o
-obj-$(CONFIG_HARDLOCKUP_DETECTOR_PERF)	+= watchdog_hld.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)	+= hw_breakpoint.o
 obj-$(CONFIG_CPU_PM)			+= sleep.o suspend.o
 obj-$(CONFIG_KGDB)			+= kgdb.o
diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index 5c310e803dd78..4fd7f88d44543 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -696,7 +696,7 @@ 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)
+bool arch_pmu_irq_is_nmi(void)
 {
 	return has_nmi;
 }
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index cf3c6ab408aac..c34bdc4f43f6d 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -207,6 +207,7 @@ static inline bool trigger_single_cpu_backtrace(int cpu)
 #ifdef CONFIG_HARDLOCKUP_DETECTOR_PERF
 u64 hw_nmi_get_sample_period(int watchdog_thresh);
 bool arch_perf_nmi_is_available(void);
+bool arch_pmu_irq_is_nmi(void);
 #endif
 
 #if defined(CONFIG_HARDLOCKUP_CHECK_TIMESTAMP) && \
diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h
index 93c9a26492fcf..6b53fb453fd63 100644
--- a/include/linux/perf/arm_pmu.h
+++ b/include/linux/perf/arm_pmu.h
@@ -184,8 +184,6 @@ void kvm_host_pmu_init(struct arm_pmu *pmu);
 #define kvm_host_pmu_init(x)	do { } while(0)
 #endif
 
-bool arm_pmu_irq_is_nmi(void);
-
 /* Internal functions only for core arm_pmu code */
 struct arm_pmu *armpmu_alloc(void);
 void armpmu_free(struct arm_pmu *pmu);
diff --git a/kernel/Makefile b/kernel/Makefile
index c60623448235f..4ec7702b00aa1 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -101,7 +101,7 @@ obj-$(CONFIG_KGDB) += debug/
 obj-$(CONFIG_DETECT_HUNG_TASK) += hung_task.o
 obj-$(CONFIG_LOCKUP_DETECTOR) += watchdog.o
 obj-$(CONFIG_HARDLOCKUP_DETECTOR_BUDDY) += watchdog_buddy.o
-obj-$(CONFIG_HARDLOCKUP_DETECTOR_PERF) += watchdog_perf.o
+obj-$(CONFIG_HARDLOCKUP_DETECTOR_PERF) += watchdog_perf.o watchdog_hld.o
 obj-$(CONFIG_SECCOMP) += seccomp.o
 obj-$(CONFIG_RELAY) += relay.o
 obj-$(CONFIG_SYSCTL) += utsname_sysctl.o
diff --git a/arch/arm64/kernel/watchdog_hld.c b/kernel/watchdog_hld.c
similarity index 97%
rename from arch/arm64/kernel/watchdog_hld.c
rename to kernel/watchdog_hld.c
index 3093037dcb7be..f3864e604a6b5 100644
--- a/arch/arm64/kernel/watchdog_hld.c
+++ b/kernel/watchdog_hld.c
@@ -1,7 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/nmi.h>
 #include <linux/cpufreq.h>
-#include <linux/perf/arm_pmu.h>
 
 /*
  * Safe maximum CPU frequency in case a particular platform doesn't implement
@@ -25,6 +24,11 @@ u64 hw_nmi_get_sample_period(int watchdog_thresh)
 	return (u64)max_cpu_freq * watchdog_thresh;
 }
 
+__weak bool arch_pmu_irq_is_nmi(void)
+{
+	return false;
+}
+
 bool __init arch_perf_nmi_is_available(void)
 {
 	/*
@@ -32,7 +36,7 @@ bool __init arch_perf_nmi_is_available(void)
 	 * however, the pmu interrupts will act like a normal interrupt instead of
 	 * NMI and the hardlockup detector would be broken.
 	 */
-	return arm_pmu_irq_is_nmi();
+	return arch_pmu_irq_is_nmi();
 }
 
 static int watchdog_perf_update_period(void *data)
-- 
2.39.5



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] riscv: add HARDLOCKUP_DETECTOR_PERF support
  2025-08-27 10:09 [PATCH 0/2] Add HARDLOCKUP_DETECTOR_PERF for riscv Yunhui Cui
  2025-08-27 10:09 ` [PATCH 1/2] watchdog: refactor watchdog_hld functionality Yunhui Cui
@ 2025-08-27 10:09 ` Yunhui Cui
  1 sibling, 0 replies; 9+ messages in thread
From: Yunhui Cui @ 2025-08-27 10:09 UTC (permalink / raw)
  To: paul.walmsley, palmer, aou, alex, atish.patra, anup, will,
	mark.rutland, linux-riscv, linux-kernel, linux-arm-kernel,
	linux-perf-users, catalin.marinas, masahiroy, suzuki.poulose,
	cuiyunhui, maz, zhanjie9, yangyicong, dianders, mingo, lihuafei1,
	akpm, jpoimboe, rppt, kees, thomas.weissschuh

Reuse watchdog_hld.c to enable HARDLOCKUP_DETECTOR_PERF and
add Kconfig selections for RISC-V.

Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
---
 arch/riscv/Kconfig           | 3 +++
 drivers/perf/riscv_pmu_sbi.c | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 451eb23d86c96..214b1ead5781a 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -184,6 +184,9 @@ config RISCV
 	select HAVE_PAGE_SIZE_4KB
 	select HAVE_PCI
 	select HAVE_PERF_EVENTS
+	select PERF_EVENTS
+	select HAVE_PERF_EVENTS_NMI if RISCV_SSE && RISCV_PMU_SSE
+	select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && HAVE_PERF_EVENTS_NMI
 	select HAVE_PERF_REGS
 	select HAVE_PERF_USER_STACK_DUMP
 	select HAVE_POSIX_CPU_TIMERS_TASK_WORK
diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c
index 8c1ac7985df6c..c5423a046d016 100644
--- a/drivers/perf/riscv_pmu_sbi.c
+++ b/drivers/perf/riscv_pmu_sbi.c
@@ -22,6 +22,7 @@
 #include <linux/sched/clock.h>
 #include <linux/soc/andes/irq.h>
 #include <linux/workqueue.h>
+#include <linux/nmi.h>
 
 #include <asm/errata_list.h>
 #include <asm/sbi.h>
@@ -1102,6 +1103,11 @@ static int pmu_sbi_setup_sse(struct riscv_pmu *pmu)
 }
 #endif
 
+bool arch_pmu_irq_is_nmi(void)
+{
+	return IS_ENABLED(CONFIG_RISCV_PMU_SSE);
+}
+
 static int pmu_sbi_starting_cpu(unsigned int cpu, struct hlist_node *node)
 {
 	struct riscv_pmu *pmu = hlist_entry_safe(node, struct riscv_pmu, node);
@@ -1525,6 +1531,8 @@ static int __init pmu_sbi_devinit(void)
 	/* Notify legacy implementation that SBI pmu is available*/
 	riscv_pmu_legacy_skip_init();
 
+	lockup_detector_retry_init();
+
 	return ret;
 }
 device_initcall(pmu_sbi_devinit)
-- 
2.39.5



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] watchdog: refactor watchdog_hld functionality
  2025-08-27 10:09 ` [PATCH 1/2] watchdog: refactor watchdog_hld functionality Yunhui Cui
@ 2025-08-29 21:33   ` Doug Anderson
  2025-09-01  5:57     ` [External] " yunhui cui
  0 siblings, 1 reply; 9+ messages in thread
From: Doug Anderson @ 2025-08-29 21:33 UTC (permalink / raw)
  To: Yunhui Cui
  Cc: paul.walmsley, palmer, aou, alex, atish.patra, anup, will,
	mark.rutland, linux-riscv, linux-kernel, linux-arm-kernel,
	linux-perf-users, catalin.marinas, masahiroy, suzuki.poulose, maz,
	zhanjie9, yangyicong, mingo, lihuafei1, akpm, jpoimboe, rppt,
	kees, thomas.weissschuh

Hi,

On Wed, Aug 27, 2025 at 3:10 AM Yunhui Cui <cuiyunhui@bytedance.com> wrote:
>
> Move watchdog_hld.c to kernel/, and rename arm_pmu_irq_is_nmi()
> to arch_pmu_irq_is_nmi() for cross-arch reusability.
>
> Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
> ---
>  arch/arm64/kernel/Makefile                   | 1 -
>  drivers/perf/arm_pmu.c                       | 2 +-
>  include/linux/nmi.h                          | 1 +
>  include/linux/perf/arm_pmu.h                 | 2 --
>  kernel/Makefile                              | 2 +-
>  {arch/arm64/kernel => kernel}/watchdog_hld.c | 8 ++++++--
>  6 files changed, 9 insertions(+), 7 deletions(-)
>  rename {arch/arm64/kernel => kernel}/watchdog_hld.c (97%)

I'm not a huge fan of the perf hardlockup detector and IMO we should
maybe just delete it. Thus spreading it to support a new architecture
isn't my favorite thing to do. Can't you use the buddy hardlockup
detector?

That being said, I did a quick look at your patch. I'm pretty sure you
can't just move the arm64 "watchdog_hld.c" to be generic. Won't
hw_nmi_get_sample_period() conflict with everyone else's (x86 and
powerpc)?

-Doug


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [External] Re: [PATCH 1/2] watchdog: refactor watchdog_hld functionality
  2025-08-29 21:33   ` Doug Anderson
@ 2025-09-01  5:57     ` yunhui cui
  2025-09-02 17:03       ` Doug Anderson
  0 siblings, 1 reply; 9+ messages in thread
From: yunhui cui @ 2025-09-01  5:57 UTC (permalink / raw)
  To: Doug Anderson
  Cc: paul.walmsley, palmer, aou, alex, atish.patra, anup, will,
	mark.rutland, linux-riscv, linux-kernel, linux-arm-kernel,
	linux-perf-users, catalin.marinas, masahiroy, suzuki.poulose, maz,
	zhanjie9, yangyicong, mingo, lihuafei1, akpm, jpoimboe, rppt,
	kees, thomas.weissschuh

Hi Doug,

On Sat, Aug 30, 2025 at 5:34 AM Doug Anderson <dianders@chromium.org> wrote:
>
> Hi,
>
> On Wed, Aug 27, 2025 at 3:10 AM Yunhui Cui <cuiyunhui@bytedance.com> wrote:
> >
> > Move watchdog_hld.c to kernel/, and rename arm_pmu_irq_is_nmi()
> > to arch_pmu_irq_is_nmi() for cross-arch reusability.
> >
> > Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
> > ---
> >  arch/arm64/kernel/Makefile                   | 1 -
> >  drivers/perf/arm_pmu.c                       | 2 +-
> >  include/linux/nmi.h                          | 1 +
> >  include/linux/perf/arm_pmu.h                 | 2 --
> >  kernel/Makefile                              | 2 +-
> >  {arch/arm64/kernel => kernel}/watchdog_hld.c | 8 ++++++--
> >  6 files changed, 9 insertions(+), 7 deletions(-)
> >  rename {arch/arm64/kernel => kernel}/watchdog_hld.c (97%)
>
> I'm not a huge fan of the perf hardlockup detector and IMO we should
> maybe just delete it. Thus spreading it to support a new architecture
> isn't my favorite thing to do. Can't you use the buddy hardlockup
> detector?

Why is there a plan to remove CONFIG_HARDLOCKUP_DETECTOR_PERF? Could
you explain the specific reasons? Is the community's future plan to
favor CONFIG_HARDLOCKUP_DETECTOR_BUDDY?

>
> That being said, I did a quick look at your patch. I'm pretty sure you
> can't just move the arm64 "watchdog_hld.c" to be generic. Won't
> hw_nmi_get_sample_period() conflict with everyone else's (x86 and
> powerpc)?
>
> -Doug
>

Thanks,
Yunhui


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [External] Re: [PATCH 1/2] watchdog: refactor watchdog_hld functionality
  2025-09-01  5:57     ` [External] " yunhui cui
@ 2025-09-02 17:03       ` Doug Anderson
  2025-09-03 11:56         ` yunhui cui
  0 siblings, 1 reply; 9+ messages in thread
From: Doug Anderson @ 2025-09-02 17:03 UTC (permalink / raw)
  To: yunhui cui
  Cc: paul.walmsley, palmer, aou, alex, atish.patra, anup, will,
	mark.rutland, linux-riscv, linux-kernel, linux-arm-kernel,
	linux-perf-users, catalin.marinas, masahiroy, suzuki.poulose, maz,
	zhanjie9, yangyicong, mingo, lihuafei1, akpm, jpoimboe, rppt,
	kees, thomas.weissschuh

Hi,

On Sun, Aug 31, 2025 at 10:57 PM yunhui cui <cuiyunhui@bytedance.com> wrote:
>
> Hi Doug,
>
> On Sat, Aug 30, 2025 at 5:34 AM Doug Anderson <dianders@chromium.org> wrote:
> >
> > Hi,
> >
> > On Wed, Aug 27, 2025 at 3:10 AM Yunhui Cui <cuiyunhui@bytedance.com> wrote:
> > >
> > > Move watchdog_hld.c to kernel/, and rename arm_pmu_irq_is_nmi()
> > > to arch_pmu_irq_is_nmi() for cross-arch reusability.
> > >
> > > Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
> > > ---
> > >  arch/arm64/kernel/Makefile                   | 1 -
> > >  drivers/perf/arm_pmu.c                       | 2 +-
> > >  include/linux/nmi.h                          | 1 +
> > >  include/linux/perf/arm_pmu.h                 | 2 --
> > >  kernel/Makefile                              | 2 +-
> > >  {arch/arm64/kernel => kernel}/watchdog_hld.c | 8 ++++++--
> > >  6 files changed, 9 insertions(+), 7 deletions(-)
> > >  rename {arch/arm64/kernel => kernel}/watchdog_hld.c (97%)
> >
> > I'm not a huge fan of the perf hardlockup detector and IMO we should
> > maybe just delete it. Thus spreading it to support a new architecture
> > isn't my favorite thing to do. Can't you use the buddy hardlockup
> > detector?
>
> Why is there a plan to remove CONFIG_HARDLOCKUP_DETECTOR_PERF? Could
> you explain the specific reasons? Is the community's future plan to
> favor CONFIG_HARDLOCKUP_DETECTOR_BUDDY?

I don't think there are any concrete plans, but there was some discussion here:

https://lore.kernel.org/all/CAD=FV=WWUiCi6bZCs_gseFpDDWNkuJMoL6XCftEo6W7q6jRCkg@mail.gmail.com/

-Doug


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [External] Re: [PATCH 1/2] watchdog: refactor watchdog_hld functionality
  2025-09-02 17:03       ` Doug Anderson
@ 2025-09-03 11:56         ` yunhui cui
  2025-09-05 23:57           ` Doug Anderson
  0 siblings, 1 reply; 9+ messages in thread
From: yunhui cui @ 2025-09-03 11:56 UTC (permalink / raw)
  To: Doug Anderson
  Cc: paul.walmsley, palmer, aou, alex, atish.patra, anup, will,
	mark.rutland, linux-riscv, linux-kernel, linux-arm-kernel,
	linux-perf-users, catalin.marinas, masahiroy, suzuki.poulose, maz,
	zhanjie9, yangyicong, mingo, lihuafei1, akpm, jpoimboe, rppt,
	kees, thomas.weissschuh

Hi Doug,

On Wed, Sep 3, 2025 at 1:04 AM Doug Anderson <dianders@chromium.org> wrote:
>
> Hi,
>
> On Sun, Aug 31, 2025 at 10:57 PM yunhui cui <cuiyunhui@bytedance.com> wrote:
> >
> > Hi Doug,
> >
> > On Sat, Aug 30, 2025 at 5:34 AM Doug Anderson <dianders@chromium.org> wrote:
> > >
> > > Hi,
> > >
> > > On Wed, Aug 27, 2025 at 3:10 AM Yunhui Cui <cuiyunhui@bytedance.com> wrote:
> > > >
> > > > Move watchdog_hld.c to kernel/, and rename arm_pmu_irq_is_nmi()
> > > > to arch_pmu_irq_is_nmi() for cross-arch reusability.
> > > >
> > > > Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
> > > > ---
> > > >  arch/arm64/kernel/Makefile                   | 1 -
> > > >  drivers/perf/arm_pmu.c                       | 2 +-
> > > >  include/linux/nmi.h                          | 1 +
> > > >  include/linux/perf/arm_pmu.h                 | 2 --
> > > >  kernel/Makefile                              | 2 +-
> > > >  {arch/arm64/kernel => kernel}/watchdog_hld.c | 8 ++++++--
> > > >  6 files changed, 9 insertions(+), 7 deletions(-)
> > > >  rename {arch/arm64/kernel => kernel}/watchdog_hld.c (97%)
> > >
> > > I'm not a huge fan of the perf hardlockup detector and IMO we should
> > > maybe just delete it. Thus spreading it to support a new architecture
> > > isn't my favorite thing to do. Can't you use the buddy hardlockup
> > > detector?
> >
> > Why is there a plan to remove CONFIG_HARDLOCKUP_DETECTOR_PERF? Could
> > you explain the specific reasons? Is the community's future plan to
> > favor CONFIG_HARDLOCKUP_DETECTOR_BUDDY?
>
> I don't think there are any concrete plans, but there was some discussion here:
>
> https://lore.kernel.org/all/CAD=FV=WWUiCi6bZCs_gseFpDDWNkuJMoL6XCftEo6W7q6jRCkg@mail.gmail.com/
>
> -Doug
>

I’ve read your linked content, which details the pros and cons of perf
watchdog and buddy watchdog.
I think everyone will agree on choosing one as the default.
It seems there’s no kernel/watchdog entry in MAINTAINERS—what’s next
for these two approaches?

Thanks,
Yunhui


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [External] Re: [PATCH 1/2] watchdog: refactor watchdog_hld functionality
  2025-09-03 11:56         ` yunhui cui
@ 2025-09-05 23:57           ` Doug Anderson
  2025-09-07 23:14             ` Ian Rogers
  0 siblings, 1 reply; 9+ messages in thread
From: Doug Anderson @ 2025-09-05 23:57 UTC (permalink / raw)
  To: yunhui cui
  Cc: paul.walmsley, palmer, aou, alex, atish.patra, anup, will,
	mark.rutland, linux-riscv, linux-kernel, linux-arm-kernel,
	linux-perf-users, catalin.marinas, masahiroy, suzuki.poulose, maz,
	zhanjie9, yangyicong, mingo, lihuafei1, akpm, jpoimboe, rppt,
	kees, thomas.weissschuh

Hi,

On Wed, Sep 3, 2025 at 4:56 AM yunhui cui <cuiyunhui@bytedance.com> wrote:
>
> Hi Doug,
>
> On Wed, Sep 3, 2025 at 1:04 AM Doug Anderson <dianders@chromium.org> wrote:
> >
> > Hi,
> >
> > On Sun, Aug 31, 2025 at 10:57 PM yunhui cui <cuiyunhui@bytedance.com> wrote:
> > >
> > > Hi Doug,
> > >
> > > On Sat, Aug 30, 2025 at 5:34 AM Doug Anderson <dianders@chromium.org> wrote:
> > > >
> > > > Hi,
> > > >
> > > > On Wed, Aug 27, 2025 at 3:10 AM Yunhui Cui <cuiyunhui@bytedance.com> wrote:
> > > > >
> > > > > Move watchdog_hld.c to kernel/, and rename arm_pmu_irq_is_nmi()
> > > > > to arch_pmu_irq_is_nmi() for cross-arch reusability.
> > > > >
> > > > > Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
> > > > > ---
> > > > >  arch/arm64/kernel/Makefile                   | 1 -
> > > > >  drivers/perf/arm_pmu.c                       | 2 +-
> > > > >  include/linux/nmi.h                          | 1 +
> > > > >  include/linux/perf/arm_pmu.h                 | 2 --
> > > > >  kernel/Makefile                              | 2 +-
> > > > >  {arch/arm64/kernel => kernel}/watchdog_hld.c | 8 ++++++--
> > > > >  6 files changed, 9 insertions(+), 7 deletions(-)
> > > > >  rename {arch/arm64/kernel => kernel}/watchdog_hld.c (97%)
> > > >
> > > > I'm not a huge fan of the perf hardlockup detector and IMO we should
> > > > maybe just delete it. Thus spreading it to support a new architecture
> > > > isn't my favorite thing to do. Can't you use the buddy hardlockup
> > > > detector?
> > >
> > > Why is there a plan to remove CONFIG_HARDLOCKUP_DETECTOR_PERF? Could
> > > you explain the specific reasons? Is the community's future plan to
> > > favor CONFIG_HARDLOCKUP_DETECTOR_BUDDY?
> >
> > I don't think there are any concrete plans, but there was some discussion here:
> >
> > https://lore.kernel.org/all/CAD=FV=WWUiCi6bZCs_gseFpDDWNkuJMoL6XCftEo6W7q6jRCkg@mail.gmail.com/
> >
> > -Doug
> >
>
> I’ve read your linked content, which details the pros and cons of perf
> watchdog and buddy watchdog.
> I think everyone will agree on choosing one as the default.
> It seems there’s no kernel/watchdog entry in MAINTAINERS—what’s next
> for these two approaches?

I guess to start, someone (you?) should send some patches to the list.
Maybe one patch to make buddy the default and one to change the
description of the "perf" lockup detector say that its usage is
discouraged, that it might be removed, that people should use the
"buddy" detector instead, and that if there's a reason someone needs
the "perf" detector instead of the buddy one then they should make
some loud noises.

You'd want to CC folks who were involved in recent watchdog changes
and make sure to CC Andrew (akpm). If folks react positive and Andrew
agrees then he'll likely land the the patches and we'll have made
forward progress. :-)

-Doug


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [External] Re: [PATCH 1/2] watchdog: refactor watchdog_hld functionality
  2025-09-05 23:57           ` Doug Anderson
@ 2025-09-07 23:14             ` Ian Rogers
  0 siblings, 0 replies; 9+ messages in thread
From: Ian Rogers @ 2025-09-07 23:14 UTC (permalink / raw)
  To: Doug Anderson
  Cc: yunhui cui, paul.walmsley, palmer, aou, alex, atish.patra, anup,
	will, mark.rutland, linux-riscv, linux-kernel, linux-arm-kernel,
	linux-perf-users, catalin.marinas, masahiroy, suzuki.poulose, maz,
	zhanjie9, yangyicong, mingo, lihuafei1, akpm, jpoimboe, rppt,
	kees, thomas.weissschuh

On Fri, Sep 5, 2025 at 4:57 PM Doug Anderson <dianders@chromium.org> wrote:
>
> Hi,
>
> On Wed, Sep 3, 2025 at 4:56 AM yunhui cui <cuiyunhui@bytedance.com> wrote:
> > I’ve read your linked content, which details the pros and cons of perf
> > watchdog and buddy watchdog.
> > I think everyone will agree on choosing one as the default.
> > It seems there’s no kernel/watchdog entry in MAINTAINERS—what’s next
> > for these two approaches?
>
> I guess to start, someone (you?) should send some patches to the list.
> Maybe one patch to make buddy the default and one to change the
> description of the "perf" lockup detector say that its usage is
> discouraged, that it might be removed, that people should use the
> "buddy" detector instead, and that if there's a reason someone needs
> the "perf" detector instead of the buddy one then they should make
> some loud noises.
>
> You'd want to CC folks who were involved in recent watchdog changes
> and make sure to CC Andrew (akpm). If folks react positive and Andrew
> agrees then he'll likely land the the patches and we'll have made
> forward progress. :-)

+1

There are also things like /proc/sys/kernel/nmi_watchdog being used to
enable/disable the hard lookup detector. If we could move that to a
unique file so that perf is less confused in places like:
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/util/util.c#n70
ie. perf shouldn't warn about the NMI watchdog being enabled and
taking a perf event when it doesn't.

Thanks,
Ian


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-09-07 23:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-27 10:09 [PATCH 0/2] Add HARDLOCKUP_DETECTOR_PERF for riscv Yunhui Cui
2025-08-27 10:09 ` [PATCH 1/2] watchdog: refactor watchdog_hld functionality Yunhui Cui
2025-08-29 21:33   ` Doug Anderson
2025-09-01  5:57     ` [External] " yunhui cui
2025-09-02 17:03       ` Doug Anderson
2025-09-03 11:56         ` yunhui cui
2025-09-05 23:57           ` Doug Anderson
2025-09-07 23:14             ` Ian Rogers
2025-08-27 10:09 ` [PATCH 2/2] riscv: add HARDLOCKUP_DETECTOR_PERF support Yunhui Cui

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).