From mboxrd@z Thu Jan 1 00:00:00 1970 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 63C6CC433F5 for ; Mon, 25 Apr 2022 15:05:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242728AbiDYPI3 (ORCPT ); Mon, 25 Apr 2022 11:08:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242719AbiDYPIZ (ORCPT ); Mon, 25 Apr 2022 11:08:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E955F1FCF3; Mon, 25 Apr 2022 08:05:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A19C6B8160D; Mon, 25 Apr 2022 15:05:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65958C385A4; Mon, 25 Apr 2022 15:05:14 +0000 (UTC) Date: Mon, 25 Apr 2022 11:05:12 -0400 From: Steven Rostedt To: Xu Kuohai Cc: , , , , , Catalin Marinas , Will Deacon , Ingo Molnar , Daniel Borkmann , Alexei Starovoitov , Zi Shen Lim , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , "David S . Miller" , Hideaki YOSHIFUJI , David Ahern , Thomas Gleixner , Borislav Petkov , Dave Hansen , , , Shuah Khan , Jakub Kicinski , Jesper Dangaard Brouer , Mark Rutland , Pasha Tatashin , Ard Biesheuvel , Daniel Kiss , Steven Price , Sudeep Holla , Marc Zyngier , Peter Collingbourne , Mark Brown , Delyan Kratunov , Kumar Kartikeya Dwivedi Subject: Re: [PATCH bpf-next v3 2/7] ftrace: Fix deadloop caused by direct call in ftrace selftest Message-ID: <20220425110512.538ce0bf@gandalf.local.home> In-Reply-To: <20220424154028.1698685-3-xukuohai@huawei.com> References: <20220424154028.1698685-1-xukuohai@huawei.com> <20220424154028.1698685-3-xukuohai@huawei.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Sun, 24 Apr 2022 11:40:23 -0400 Xu Kuohai wrote: > diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c > index abcadbe933bb..d2eff2b1d743 100644 > --- a/kernel/trace/trace_selftest.c > +++ b/kernel/trace/trace_selftest.c > @@ -785,8 +785,24 @@ static struct fgraph_ops fgraph_ops __initdata = { > }; > > #ifdef CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS > +#ifdef CONFIG_ARM64 Please find a way to add this in arm specific code. Do not add architecture defines in generic code. You could add: #ifndef ARCH_HAVE_FTRACE_DIRECT_TEST_FUNC noinline __noclone static void trace_direct_tramp(void) { } #endif here, and in arch/arm64/include/ftrace.h #define ARCH_HAVE_FTRACE_DIRECT_TEST_FUNC and define your test function in the arm64 specific code. -- Steve > +extern void trace_direct_tramp(void); > + > +asm ( > +" .pushsection .text, \"ax\", @progbits\n" > +" .type trace_direct_tramp, %function\n" > +" .global trace_direct_tramp\n" > +"trace_direct_tramp:" > +" mov x10, x30\n" > +" mov x30, x9\n" > +" ret x10\n" > +" .size trace_direct_tramp, .-trace_direct_tramp\n" > +" .popsection\n" > +); > +#else > noinline __noclone static void trace_direct_tramp(void) { } > #endif > +#endif > > /* > * Pretty much the same than for the function tracer from which the selftest