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 5D2FFC0015E for ; Wed, 9 Aug 2023 14:16:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232542AbjHIOQP (ORCPT ); Wed, 9 Aug 2023 10:16:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232513AbjHIOQP (ORCPT ); Wed, 9 Aug 2023 10:16:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC19E2110; Wed, 9 Aug 2023 07:16:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 82BBF63476; Wed, 9 Aug 2023 14:16:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 982C1C433C9; Wed, 9 Aug 2023 14:16:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691590572; bh=1SsVUXtWZgOegRFQu/GbBOH3DZTNW23JsvaY2VEYgBY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=U1CjP3mWibzJWHlC+0WnkiYzptEzDbUEGoUKGfIq13sTvP5wK9jycbLETah8A4uHz iTlb/R0Qtz6uGeKJE3Au1LooZ601DpkjB+604scSfx55ovfJRN5gd43KUzLXG/WnLk ABdowwihO3Dh788RrYv5zy7hEb0U8ET8wH64r8ZYq0RleqaQEopIAxOn+F+swadv4S 8BbhiYTOTnHQGDY18ffsYNZaIWrBXUlpNkzXbVYsa1ngNVVwY6fq5JgkQWK0Ex8iHZ UVQyWpG55QO1akmjijvJDSzzRZ8bzMzlNK0Ntp6hZNmi90F74cChRsgswa2CANnr42 hWYULQmdXtlFQ== Date: Wed, 9 Aug 2023 23:16:07 +0900 From: Masami Hiramatsu (Google) To: Florent Revest Cc: Alexei Starovoitov , Steven Rostedt , linux-trace-kernel@vger.kernel.org, LKML , Martin KaFai Lau , bpf , Sven Schnelle , Alexei Starovoitov , Jiri Olsa , Arnaldo Carvalho de Melo , Daniel Borkmann , Alan Maguire , Mark Rutland , Peter Zijlstra , Thomas Gleixner Subject: Re: [RFC PATCH v2 2/6] tracing: Expose ftrace_regs regardless of CONFIG_FUNCTION_TRACER Message-Id: <20230809231607.0c5c75e7c3b69fcc96d82cb4@kernel.org> In-Reply-To: References: <169139090386.324433.6412259486776991296.stgit@devnote2> <169139092722.324433.16681957760325391475.stgit@devnote2> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-trace-kernel@vger.kernel.org On Wed, 9 Aug 2023 12:29:13 +0200 Florent Revest wrote: > On Mon, Aug 7, 2023 at 8:48 AM Masami Hiramatsu (Google) > wrote: > > diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h > > index ce156c7704ee..3fb94a1a2461 100644 > > --- a/include/linux/ftrace.h > > +++ b/include/linux/ftrace.h > > @@ -112,11 +112,11 @@ static inline int ftrace_mod_get_kallsym(unsigned int symnum, unsigned long *val > > } > > #endif > > > > -#ifdef CONFIG_FUNCTION_TRACER > > - > > -extern int ftrace_enabled; > > - > > -#ifndef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS > > +/* > > + * If the architecture doesn't support FTRACE_WITH_ARGS or disable function > > nit: disables* Thanks! > > > + * tracer, define the default(pt_regs compatible) ftrace_regs. > > + */ > > +#if !defined(CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS) || !defined(CONFIG_FUNCTION_TRACER) > > I wonder if we should make things simpler with: > > #if defined(HAVE_PT_REGS_COMPAT_FTRACE_REGS) || !defined(CONFIG_FUNCTION_TRACER) > > And remove the ftrace_regs definitions that are copy-pastes of this > block in arch specific headers. Then we can enforce in a single point > that HAVE_PT_REGS_COMPAT_FTRACE_REGS holds. Here, the "HAVE_PT_REGS_COMPAT_FTRACE_REGS" does not mean that the ftrace_regs is completely compatible with pt_regs, but on the memory it wraps struct pt_regs (thus we can just cast the type). - CONFIG_DYNAMIC_FTRACE_WITH_REGS ftrace_regs is completely compatible with pt_regs - CONFIG_DYNAMIC_FTRACE_WITH_ARGS | ftrace_regs may not compatible with pt_regs | +- CONFIG_HAVE_PT_REGS_COMPAT_FTRACE_REGS but on memory image, ftrace_regs includes pt_regs. Thank you, > > Maybe that's a question for Steven ? -- Masami Hiramatsu (Google)