From nobody Sun Apr 5 13:05:41 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFD9FECAAA1 for ; Fri, 16 Sep 2022 00:55:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229637AbiIPAzR (ORCPT ); Thu, 15 Sep 2022 20:55:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229613AbiIPAzO (ORCPT ); Thu, 15 Sep 2022 20:55:14 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 771EC30F6A for ; Thu, 15 Sep 2022 17:55:11 -0700 (PDT) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MTFr94wvYzmVR1; Fri, 16 Sep 2022 08:51:21 +0800 (CST) Received: from huawei.com (10.67.174.53) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 16 Sep 2022 08:55:08 +0800 From: Liao Chang To: , , , , , CC: , Subject: [PATCH] riscv/ftrace: Set FTRACE_FORCE_LIST_FUNC if DYNAMIC_FTRACE_WITH_REGS is not set Date: Fri, 16 Sep 2022 08:51:35 +0800 Message-ID: <20220916005135.91945-1-liaochang1@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.67.174.53] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" With the following configuration options: CONFIG_FUNCTION_TRACER=3Dy CONFIG_DYNAMIC_FTRACE is not set CONFIG_DYNAMIC_FTRACE_WITH_REGS is not set Setting function tracer leads to Linux being stuck: echo function > /sys/kernel/tracing/current_tracer The reason is: for static tracing, RISC-V mcount only support passing up ip and parent_ip, if it does not force list func, some C side effects occurs, where a function is called without passing a valid third parameter, then kernel will trap into page fault when jump from mcount to function_trace_call(). Fix this stuck issue by force kernel to use indirect list trace function, when CONFIG_DYNAMIC_FTRACE_WITH_REGS is not set. Fixes: 71e736a7d655 ("riscv/ftrace: Add ARCH_SUPPORTS_FTRACE_OPS support") Signed-off-by: Liao Chang --- arch/riscv/include/asm/ftrace.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/riscv/include/asm/ftrace.h b/arch/riscv/include/asm/ftrac= e.h index 04dad3380041..a9d365e46b52 100644 --- a/arch/riscv/include/asm/ftrace.h +++ b/arch/riscv/include/asm/ftrace.h @@ -23,7 +23,10 @@ #define MCOUNT_NAME mcount #endif =20 +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS #define ARCH_SUPPORTS_FTRACE_OPS 1 +#endif + #ifndef __ASSEMBLY__ void MCOUNT_NAME(void); static inline unsigned long ftrace_call_adjust(unsigned long addr) --=20 2.17.1