Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp39558rwr; Tue, 2 May 2023 15:31:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4LbVA3fD31mCoR8ZAHaIv553HWhvbDJONHY4QS74BoVnOG0Tq/qOTOVIadgD93VNudvwUT X-Received: by 2002:a17:902:ecce:b0:1a5:1842:f7da with SMTP id a14-20020a170902ecce00b001a51842f7damr160210plh.6.1683066704944; Tue, 02 May 2023 15:31:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683066704; cv=none; d=google.com; s=arc-20160816; b=EiizNDRXaz2aU0Hr4wliWFQsfQI38b+EG7uvgivNiuFg2TkL5r6odCjWFPPCwJ2cIq xXDzzGbdwJk3/EgQGj2/xpb4yVhXLPCbMKiZDErOYM41v7f7INyBaDJ75uHRxZdPOSZH JX0cBULmaSwZcwt0HgTwCkxeg3yVIYqZCqMAex9ugPI6ARXpShkt0KNKQAqgB7DXHwOj CQ3NnuhGYstjH7MxurKr7FNbXJ2Qxie/qzatNNCFMemZvGd5sUXq/Sev7vHZYwkzaYyg 1bjsUb1dTd6r1L/qaaE0kVZZVzT2dn4JxVCNNzKTaknmNFzXtg7sxKiudAOAT0Ws440w iwFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=nLhizBa7P/P/7tVIHn7g0CEjf/1aT7efK0zDbLEM7NM=; b=kEJLuLljNcrCViYZXDUPwTKsyhRVvK87+Al2x8hSXUsPth1SaNOOMOsqz5BITZmFze tXP8nYDlhFqf5Cfk7ntxVX7a3XKGn/V0fIjkCwH+Bzhghpr6eDGTlEScarftBIjrvzKy NKbJ+NzgSEGYcE/P1/TEYoQtpgx3ZXytVUzXyHC8Ob58J7ZPe9mkHf7Dt/4KpyXkkeLW SP2R4+RxTK1Xoy5VuTIUQ4EPkho8f9UdBz/fjI3t09hw/HyzPCMaq2PgKg3g5+p+lc5V 3ssLAZdcoTYQaauxP8Xi1dbixDVFhPkUewgVvlENCR69U39dfN4VgTJ4GIeOYAyoRtdQ lJvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VnvGj4y0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iq22-20020a17090afb5600b0024e0153398bsi5548979pjb.1.2023.05.02.15.31.11; Tue, 02 May 2023 15:31:44 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VnvGj4y0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229742AbjEBWZa (ORCPT + 99 others); Tue, 2 May 2023 18:25:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbjEBWZ3 (ORCPT ); Tue, 2 May 2023 18:25:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2EB610E7; Tue, 2 May 2023 15:25:28 -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 399C062916; Tue, 2 May 2023 22:25:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E3A9C433A4; Tue, 2 May 2023 22:25:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683066327; bh=p6tGDs6cfabXvT/biu59cKim9mysMg3Q5CdtBG9oN3U=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=VnvGj4y0t06kGlOynnuR4B5RpXXLAZtmaEP39DSRpE8zgeDNVN4Yg62o4Y0NB9Sn5 6bnGvHLxJiq2RI8I5KBQVbZI4qhIBVBrFFzA/Otx3mmfUkh3cpNZd0R9ycEgFqEIfW wpS1cIJyE9uffrTCCUL56y52GznK68OJAcdzGfzcdtprgWSXCWrWFcBsjQQXTd1Vcz LFQ9HuVd9EQXMAl9VRNWyQXs9b6DH3bpJ8pVYuQo6oCy91VjIn5DF5q9K9ITbB+nkh qBDD0SeRV7FUc8PscJd/nWOnwtYahMr0R3cksIezVqXSXgijzV9ezCP55beJvahWnO O+6qkHVdd6+Iw== Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2a8c51ba511so43413541fa.1; Tue, 02 May 2023 15:25:27 -0700 (PDT) X-Gm-Message-State: AC+VfDwl5TYpJdROPp5Ui/1hCrZmE3Et/nKVlRFT8VZIIO7STccht3x1 2+kklkplD2tR7XPtDqJubvCVsy/8zgRHOFAqZ6A= X-Received: by 2002:ac2:5608:0:b0:4ef:f64b:65b4 with SMTP id v8-20020ac25608000000b004eff64b65b4mr380429lfd.26.1683066325488; Tue, 02 May 2023 15:25:25 -0700 (PDT) MIME-Version: 1.0 References: <20230502164102.1a51cdb4@gandalf.local.home> In-Reply-To: <20230502164102.1a51cdb4@gandalf.local.home> From: Song Liu Date: Tue, 2 May 2023 15:25:13 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] ftrace: Allow inline functions not inlined to be traced To: Steven Rostedt Cc: LKML , Linux Trace Kernel , Masami Hiramatsu , Andrew Morton , Thomas Gleixner , Peter Zijlstra , Mark Rutland , live-patching@vger.kernel.org, Kees Cook , Miguel Ojeda , Nick Desaulniers , Ingo Molnar Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 On Tue, May 2, 2023 at 1:41=E2=80=AFPM Steven Rostedt = wrote: > > 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 an= d > 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) Acked-by: Song Liu Thanks! Song > --- > 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_type= s.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 g= nu89 > * semantics rather than c99. This prevents multiple symbol definition e= rrors > * 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=3D67368 > * '__maybe_unused' allows us to avoid defined-but-not-used warnings. > */ > -# define __no_kasan_or_inline __no_sanitize_address notrace __maybe_unus= ed > +# 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 mandator= y. > */ > # define __no_kcsan __no_sanitize_thread __disable_sanitizer_instrumenta= tion > -# 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 >