Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7390265rwr; Tue, 2 May 2023 14:05:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ50RXYKIc6uAfG8zfwG+ORPTHtNw5qX8YZE5vq53XHTMsN/URQ/VctnlU4g8e1f2j+CZzfA X-Received: by 2002:a05:6830:1e37:b0:6a1:1987:f458 with SMTP id t23-20020a0568301e3700b006a11987f458mr9302341otr.23.1683061543965; Tue, 02 May 2023 14:05:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683061543; cv=none; d=google.com; s=arc-20160816; b=Lp1T1M1URPVdlBoX3TzJOM4PzKnBBBTZOCKMr0teNJkluPDQGzQC1s8Hx6TB9V8BbK L3cyq7N5u1B7eP4LSBaKwwx3PrTg6qajfUFOiIe9jG67LcLfoMkWey2HLeMNRiqQ3uDy us1oYU3RnNaLXUTulh/Dsc14/w2I+JMkWtrRJ2ncwpXJ/SwOBScjXDy8dDQKzPSl6eL5 nawkNjuStEerr+sfwyRR1cVO9mI3X33ABT86W0kehYQ8RZTnQpOKuFMDof/lnGaUO2Ha /NnewtGR1VZCm+5N7BvEs7t/3bWAH8P1M/ZawWLWON7RPnsRDB5ZN5dBnm1Dr0mIc4AR CM2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:subject:cc:to:from:date; bh=xEy4DAK5CwSGeEO+5zPZjWHmsjdQKJUarUJw3T+JCJ8=; b=VPrg2dkJXG0FQnI11wcmJTqWH3zQ7DMZ8/BGHXutT9mDVxxgVOrIpDvnBy4C86vPX1 0ZnO/1DJoJiqNUVzJimF4ntlSzsSalXm0EBT50PtqkNbKvmBobNIDe2xbIY9JJaM11dq zwFI2nY5PkrxhvnWKvk88iUrkQBBOfMgDd3rR8Ulsg0eXit96w5AT3E/FLcRUqWodUAw Q2gFaqf53DowU893i4xkTHOUQc6CqJb9aMFlAfHqs6W+iHn7jEl4Q37A7zwYNS42gX6O NBOIRjCb+ehy5XwT4Bc7YU758VZSbS+7JADFoNH3gWP9yegmrlTTe/Xp47JjuG9zvTCT stew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t6-20020a056830082600b006a2efaa22bfsi22729966ots.214.2023.05.02.14.05.24; Tue, 02 May 2023 14:05:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230007AbjEBUlN (ORCPT + 99 others); Tue, 2 May 2023 16:41:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbjEBUlL (ORCPT ); Tue, 2 May 2023 16:41:11 -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 8B7DB1FD7; Tue, 2 May 2023 13:41:07 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 0061D622AA; Tue, 2 May 2023 20:41:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF5B0C433EF; Tue, 2 May 2023 20:41:04 +0000 (UTC) Date: Tue, 2 May 2023 16:41:02 -0400 From: Steven Rostedt To: LKML , Linux Trace Kernel Cc: Masami Hiramatsu , Andrew Morton , Thomas Gleixner , Peter Zijlstra , Mark Rutland , Song Liu , live-patching@vger.kernel.org, Kees Cook , Miguel Ojeda , Nick Desaulniers , Ingo Molnar Subject: [PATCH] ftrace: Allow inline functions not inlined to be traced Message-ID: <20230502164102.1a51cdb4@gandalf.local.home> 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 X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Steven Rostedt (Google)" Over 10 years ago there were many bugs that caused function tracing to crash because some inlined function was not inlined and should not have been traced. This made it hard to debug because when the developer tried to reproduce it, if their compiler still inlined the function, the bug would not trigger. The solution back then was simply to add "notrace" to "inline" which would make sure all functions that are marked inline are never traced even when the compiler decides to not inline them. A lot has changed over the last 10 years. 1) ftrace_test_recursion_trylock() is now used by all ftrace hooks which will prevent the recursive crashes from happening that was caused by inlined functions being traced. 2) noinstr is now used to mark pretty much all functions that would also cause problems if they are traced. Today, it is no longer a problem if an inlined function is not inlined and is traced. Removing notrace from inline has been requested several times over the years. I believe it is now safe to do so. Signed-off-by: Steven Rostedt (Google) --- include/linux/compiler_types.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index 547ea1ff806e..c8f23ba1c339 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -182,9 +182,8 @@ struct ftrace_likely_data { * externally visible function. This makes extern inline behave as per gnu89 * semantics rather than c99. This prevents multiple symbol definition errors * of extern inline functions at link time. - * A lot of inline functions can cause havoc with function tracing. */ -#define inline inline __gnu_inline __inline_maybe_unused notrace +#define inline inline __gnu_inline __inline_maybe_unused /* * gcc provides both __inline__ and __inline as alternate spellings of @@ -230,7 +229,7 @@ struct ftrace_likely_data { * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 * '__maybe_unused' allows us to avoid defined-but-not-used warnings. */ -# define __no_kasan_or_inline __no_sanitize_address notrace __maybe_unused +# define __no_kasan_or_inline __no_sanitize_address __maybe_unused # define __no_sanitize_or_inline __no_kasan_or_inline #else # define __no_kasan_or_inline __always_inline @@ -247,7 +246,7 @@ struct ftrace_likely_data { * disable all instrumentation. See Kconfig.kcsan where this is mandatory. */ # define __no_kcsan __no_sanitize_thread __disable_sanitizer_instrumentation -# define __no_sanitize_or_inline __no_kcsan notrace __maybe_unused +# define __no_sanitize_or_inline __no_kcsan __maybe_unused #else # define __no_kcsan #endif -- 2.39.2