From nobody Fri Dec 19 10:44:11 2025 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82A3C26056D for ; Fri, 14 Nov 2025 03:33:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763091195; cv=none; b=XabTarmROTa9FYjDxnkcwCQzE1rPvb+qkwlo3AWFFBIygV4ei/xtieYsqCMckZ8PSepXvUx8+EmZbTx0ElOH7uAiWgFY0NsX0E7XVfcdRt7vNI48iy1LEDDQgm33Tu3OzJo1fVA8YxNZ25QFQF4FPVXFh9WHu94KQl12Kr2z+Mw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763091195; c=relaxed/simple; bh=MEktD7Q4lr4BzIQfNar3Unfhcxo9clcZUzcd+NqIv1k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YjrHDjFsS633xM7GOn9CzeMFEFLAwZf0lCooX8lDoxHuRWfgPv085Vvx5LbiJBaXlhi4wCALbRwu9XFcqkzvTTdC4F37yXKCi1ozVtZuWVA51Fm/0HtZ0EUlFPtwylv7imtQ1tEV1jy3sc1YWpIHCvwxb4571nQB61lrfNI/138= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=XFxhFgfW; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="XFxhFgfW" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-297d4a56f97so14960855ad.1 for ; Thu, 13 Nov 2025 19:33:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1763091192; x=1763695992; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RwoYW3TpVbjpnbuDSYglQbGQzGJdKy4yKIu8+Puv/Yk=; b=XFxhFgfWOMISEOkzt1hh+/qg8Dtms8qdfA5+6D3ZRiR12aE2diTYHpjV7Lg8+XI+42 BCGdtIW17X24ZwXvuIpggXzZOGr8uNzeAILLleYOP4ztjrTCxdv4upwaepjDSxlaW0KF Z/ackthbYRXdQZNli+YPYWOBtzKFcwkMqP5yFlxb4AWB3EGYu95nB85FJxss8tnbJC4G ur5vlLe18pRGhGgy1cRyOFvzSEXSsxeC5tk65/eD96z8OG2yIfaPmABKK2dHDkr+aszd uTHrcI2nXxcMxJHegzENpPHPYHOOZUCYBAlltmSqtZ4YhfZSGD6ec+fK6JJc0KQDj2hY t15Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763091192; x=1763695992; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=RwoYW3TpVbjpnbuDSYglQbGQzGJdKy4yKIu8+Puv/Yk=; b=tXI+kPLjOCSvN7aDA0oEcBe3vGic+MZcGpLEmD5+Uz4SqVFEZcnC+tuj8SfqKCpvah 6kr3I2AMam4rH94LJlOMaJRF6QH0vw7TdNrqAANrMHXKN0yj/0PNcxPaX9qFbL1a2tcw aLcnriYlfNpr1eASnV7ihb8ka3HxFJCrGGg1qzPhv79aJTEIpEmKFKcgL2Ocg4E5KcuY c/3RmvOGy7ynG9hBm2gVTJ3q1FcrM1j8O5SE3zhDWSTdxYNUzbWz141lor/FpaQHQH2x t8WguQ5ww1mN8FdUQqdgkS1nvZ6G9LyeawB0HsFxB7zNF0sAvLHBnWtyv4qUOdf/hkQc 1FPw== X-Forwarded-Encrypted: i=1; AJvYcCUnVLXhKRGn6lFQlXskL15ZuNvnKQp98wGUJbX26vWnLhp34xUzaGfznPMOulXYWWyXwb5s8G1Zova5RMQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwnL7B+h7CuS3LxvvVLEmGtlAFDyQk5nKq1GVW/7/0Mwv5hcVlK niwhkGrM02MYmypmaKmhIsDPI82TEnpxq/rY0mTDPvoCzJlCtLvK1xAi95qX9doTlB8= X-Gm-Gg: ASbGncufZaj95yLyBPhUrKR1aWiUs8Wn+CN0e+HlqXjvk4PR2gxh4HTrq48VLeYJkhN eMANlFfNKZfja0Q3lOGhB1UMTIHeQCb+O9KJEmtvypB9Gwwq3X/2NBf9WVn5IW3kjevdZqx/JQ2 UVod4jeWWK8uNfk/c7Ffe0AuVIemaCSQQ4f3jZJKD7bBspiiCRAg2LznMrMHDkX5oHIjJ91zjfQ /QwbRaYPQGkqcDTZ4Cx2q57/wOI4tTTL1DQPwGxhT0yW2nfLd/CgB6TK0dgqGuWpjkbQnsJ2zYr no6OonDFaKcT1MgwmcndS3XZpncArrhndPU1D/owRUkWXiu3v3G1TKNZyS2gViVh10IqrHyyQOx yccf5YPE9L5pAFIsjJLFF9uQ8af9acpR4rQS9JroWrkbPSY9ZKDLdritgvF1hz37aquRSGwd971 GYzl1PBnIutYrSYGfcns2ofwTrtCCr0A== X-Google-Smtp-Source: AGHT+IHfXjnRp3cTFGa+8Qanqxwy10UGsb/fLvaOOKkhNjGlyR2g6kaDXFitMh3x5rYeK43UijaMTw== X-Received: by 2002:a17:903:247:b0:252:a80c:3cc5 with SMTP id d9443c01a7336-2986a6beeb4mr15742395ad.22.1763091191709; Thu, 13 Nov 2025 19:33:11 -0800 (PST) Received: from L6YN4KR4K9.bytedance.net ([61.213.176.8]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2985c2b0bf0sm40334405ad.71.2025.11.13.19.33.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 13 Nov 2025 19:33:11 -0800 (PST) From: Yunhui Cui 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 Subject: [PATCH v6 2/2] riscv: add HARDLOCKUP_DETECTOR_PERF support Date: Fri, 14 Nov 2025 11:32:43 +0800 Message-Id: <20251114033243.76509-3-cuiyunhui@bytedance.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20251114033243.76509-1-cuiyunhui@bytedance.com> References: <20251114033243.76509-1-cuiyunhui@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Enable the HARDLOCKUP_DETECTOR_PERF function based on RISC-V SSE. Signed-off-by: Yunhui Cui Reviewed-by: Douglas Anderson Acked-by: Paul Walmsley --- 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 fadec20b87a8e..46ccd33732fa8 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_N= MI + select WATCHDOG_PERF_ADJUST_PERIOD if HARDLOCKUP_DETECTOR_PERF 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 #include #include +#include =20 #include #include @@ -1192,6 +1193,13 @@ static int pmu_sbi_setup_sse(struct riscv_pmu *pmu) } #endif =20 +#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 =3D 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(); =20 + lockup_detector_retry_init(); + return ret; } device_initcall(pmu_sbi_devinit) --=20 2.39.5