From: Yunhui Cui <cuiyunhui@bytedance.com>
To: akpm@linux-foundation.org, alex@ghiti.fr, anup@brainfault.org,
aou@eecs.berkeley.edu, atish.patra@linux.dev,
catalin.marinas@arm.com, cuiyunhui@bytedance.com,
dianders@chromium.org, johannes@sipsolutions.net,
lihuafei1@huawei.com, mark.rutland@arm.com, masahiroy@kernel.org,
maz@kernel.org, mingo@kernel.org, nicolas.schier@linux.dev,
palmer@dabbelt.com, paul.walmsley@sifive.com,
suzuki.poulose@arm.com, thorsten.blum@linux.dev,
wangjinchao600@gmail.com, will@kernel.org,
yangyicong@hisilicon.com, zhanjie9@hisilicon.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
linux-riscv@lists.infradead.org
Cc: Paul Walmsley <pjw@kernel.org>
Subject: [PATCH v4 2/2] riscv: add HARDLOCKUP_DETECTOR_PERF support
Date: Tue, 14 Oct 2025 11:14:25 +0800 [thread overview]
Message-ID: <20251014031425.93284-3-cuiyunhui@bytedance.com> (raw)
In-Reply-To: <20251014031425.93284-1-cuiyunhui@bytedance.com>
Enable the HARDLOCKUP_DETECTOR_PERF function based on RISC-V SSE.
Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Paul Walmsley <pjw@kernel.org>
---
arch/riscv/Kconfig | 3 +++
drivers/perf/riscv_pmu_sbi.c | 10 ++++++++++
2 files changed, 13 insertions(+)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index badbb2b366946..0ae3291b303f9 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -186,6 +186,9 @@ config RISCV
select HAVE_PAGE_SIZE_4KB
select HAVE_PCI
select HAVE_PERF_EVENTS
+ select HAVE_PERF_EVENTS_NMI if RISCV_PMU_SBI_SSE
+ select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && HAVE_PERF_EVENTS_NMI
+ select WATCHDOG_PERF_ADJUST_PERIOD if HARDLOCKUP_DETECTOR_PERF && CPU_FREQ
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 c852f64a50221..0c7c5924687c9 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>
@@ -1192,6 +1193,13 @@ static int pmu_sbi_setup_sse(struct riscv_pmu *pmu)
}
#endif
+#ifdef CONFIG_HARDLOCKUP_DETECTOR_PERF
+bool arch_perf_nmi_is_available(void)
+{
+ return IS_ENABLED(CONFIG_RISCV_PMU_SBI_SSE);
+}
+#endif
+
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);
@@ -1618,6 +1626,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
prev parent reply other threads:[~2025-10-14 3:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 3:14 [PATCH v4 0/2] Add HARDLOCKUP_DETECTOR_PERF support for RISC-V Yunhui Cui
2025-10-14 3:14 ` [PATCH v4 1/2] watchdog: move arm64 watchdog_hld into common code Yunhui Cui
2025-11-03 13:44 ` Will Deacon
2025-11-07 2:42 ` [External] " yunhui cui
2025-11-07 13:10 ` Will Deacon
2025-11-11 7:15 ` yunhui cui
2025-10-14 3:14 ` Yunhui Cui [this message]
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=20251014031425.93284-3-cuiyunhui@bytedance.com \
--to=cuiyunhui@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=alex@ghiti.fr \
--cc=anup@brainfault.org \
--cc=aou@eecs.berkeley.edu \
--cc=atish.patra@linux.dev \
--cc=catalin.marinas@arm.com \
--cc=dianders@chromium.org \
--cc=johannes@sipsolutions.net \
--cc=lihuafei1@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=masahiroy@kernel.org \
--cc=maz@kernel.org \
--cc=mingo@kernel.org \
--cc=nicolas.schier@linux.dev \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=pjw@kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=thorsten.blum@linux.dev \
--cc=wangjinchao600@gmail.com \
--cc=will@kernel.org \
--cc=yangyicong@hisilicon.com \
--cc=zhanjie9@hisilicon.com \
/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