Message ID | 20230517124721.929540-1-arnd@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1124873vqo; Wed, 17 May 2023 06:12:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4sM27u7qIww7EhbE2TYy7szi5lNn/CpJS55o3QiJ1xCSEFF1F+luIAl7tYDMs7eEojry8/ X-Received: by 2002:a05:6a20:3956:b0:106:30c5:3d02 with SMTP id r22-20020a056a20395600b0010630c53d02mr13598346pzg.40.1684329125524; Wed, 17 May 2023 06:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684329125; cv=none; d=google.com; s=arc-20160816; b=wk2FHnlRQ2j07KJ3k4C1tIZpd0G4Wz7irYXFbjOh8h0Z8eD/ypkOxCtIZvLD9u16i6 Q/DhQ+mPPjW91gealJHM/2cBSO/2QyhYbjSmNjYBvwFI8ymT/qqVJxjioRZ5k0G/dZ/g DtHJF2tpRAesq/WC9KTFd3PV64HB7Zqq4em1BDcf8vidXBU7urtOS4Oub+tYgKogxhOt 2+VrMrjU2auw2XVFRiENaqvBZFB5ScD1SFi0UrSsmHAadqrtyFGbTh1dJeSPq8gtWCun zhc3j1lrT+Jnx8QhGmU20l98GUfu3seYhp81f2Clz8NDA0amJYIbK9zD36S+NKea9dVb uTZw== 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:date:subject:cc:to:from:dkim-signature; bh=OuIEu6F5BFvCAxHcFZZLm43U7wswi6l9e4j6OGTguP0=; b=EzSxfg1qFKnT2FbBAODH7YqA5ZtiyMRzMPOm652BcAH5T2O9K/+1yl4CMap9HHy8BU zTt9IaMoSQpre8F/pOcPmxftJgsN+rgzzCSHkEAOl+X5ymr5cwkXsYzs6fVlxgSKV4vI 4JLq2g80J4UOUilGL0EctGbkFoQcsSuVH3RGncYX/rzJS8udig6a2Jb1VAoI4schX4DV 8H39XIZHuPep4Wu1BEV/YRz9hwX54v7A8bBe9q0/WKtTz2xoNPY5R0bawUL5Cg/1WDdQ 2uITyRG/zt0lVg4VEll7iDOihSYnEWwmiUhBPsYrL8LYzokNVDMFFkQRzv/0Ur9Qy2D0 y2qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NE2fqtYq; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 7-20020a630007000000b0052c7c1eb769si21064158pga.856.2023.05.17.06.11.52; Wed, 17 May 2023 06:12:05 -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=NE2fqtYq; 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 S231776AbjEQMri (ORCPT <rfc822;pacteraone@gmail.com> + 99 others); Wed, 17 May 2023 08:47:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231759AbjEQMr3 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 17 May 2023 08:47:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BFA712C; Wed, 17 May 2023 05:47: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 C05BD646CD; Wed, 17 May 2023 12:47:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB90FC433EF; Wed, 17 May 2023 12:47:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684327647; bh=NTct6PtjEtuPM5wlTLSiKa6Oz8nevVfIM3Gsc53yGng=; h=From:To:Cc:Subject:Date:From; b=NE2fqtYq5UrGRjgu9TsVFmF3Q0M2nt7uV0wRr//Fs9MOw+oFwH1in5Vtj+NEFRHO8 Usx11UMUFfFJq6gLSiF4HVKCDHoU814M6SC6NFTVmQah+i/xFJki4Ohni3CJNlgiex ZJR78/8DCfipgYdoReKXPt+L3DCtV1v8ClacFS9/YgdQd92nT+w37T1lGwiK/eyUk1 gf1MW9X1MvJ+qIRhE2Nc078U5PwcWGDVk6olMWi8+XvjSr/ZBmC4MABzfCR3SOkDBI NeqM1VvceE615MHVjXdzDvXMabe8bOV5hwLRFk5QjYMRF0Mbd+K73A1X56vCUEgDUP oXw2Te19MbvmQ== From: Arnd Bergmann <arnd@kernel.org> To: Steven Rostedt <rostedt@goodmis.org>, Masami Hiramatsu <mhiramat@kernel.org> Cc: linux-trace-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>, Luc Van Oostenryck <luc.vanoostenryck@gmail.com>, Kees Cook <keescook@chromium.org>, Bart Van Assche <bvanassche@acm.org>, Sami Tolvanen <samitolvanen@google.com>, "Peter Zijlstra (Intel)" <peterz@infradead.org>, linux-sparse@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] tracing: make ftrace_likely_update() declaration visible Date: Wed, 17 May 2023 14:47:12 +0200 Message-Id: <20230517124721.929540-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766147097367285821?= X-GMAIL-MSGID: =?utf-8?q?1766147097367285821?= |
Series |
tracing: make ftrace_likely_update() declaration visible
|
|
Commit Message
Arnd Bergmann
May 17, 2023, 12:47 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de> This function is only used when CONFIG_TRACE_BRANCH_PROFILING is set, and the declaration is hidden behind this Kconfig symbol, which causes a warning if disabled: kernel/trace/trace_branch.c:205:6: error: no previous prototype for 'ftrace_likely_update' [-Werror=missing-prototypes] Move the declaration out of the #ifdef to avoid the warning. Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- include/linux/compiler.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Comments
On Wed, May 17, 2023 at 5:47 AM Arnd Bergmann <arnd@kernel.org> wrote: > > From: Arnd Bergmann <arnd@arndb.de> > > This function is only used when CONFIG_TRACE_BRANCH_PROFILING is > set, and the declaration is hidden behind this Kconfig symbol, > which causes a warning if disabled: That explanation is not very clear. The problem is that the tracing code itself is built with DISABLE_BRANCH_PROFILING, in order to not recurse. And that hides the declaration when the definition is compiled, leading to the problem. CONFIG_TRACE_BRANCH_PROFILING isn't the problem in itself - *that* part of the test is consistent (not used, not declared, and not compiled if it is off). The problem is that DISABLE_BRANCH_PROFILING case, where it is used elsewhere, but not declared when it is itself compiled. I applied the patch, but I tried to reword the explanation to be more clear. I may have failed. Linus
On Wed, 17 May 2023 09:39:41 -0700 Linus Torvalds <torvalds@linux-foundation.org> wrote: > On Wed, May 17, 2023 at 5:47 AM Arnd Bergmann <arnd@kernel.org> wrote: > > > > From: Arnd Bergmann <arnd@arndb.de> > > > > This function is only used when CONFIG_TRACE_BRANCH_PROFILING is > > set, and the declaration is hidden behind this Kconfig symbol, > > which causes a warning if disabled: > > That explanation is not very clear. > > The problem is that the tracing code itself is built with > DISABLE_BRANCH_PROFILING, in order to not recurse. And that hides the > declaration when the definition is compiled, leading to the problem. > > CONFIG_TRACE_BRANCH_PROFILING isn't the problem in itself - *that* > part of the test is consistent (not used, not declared, and not > compiled if it is off). > > The problem is that DISABLE_BRANCH_PROFILING case, where it is used > elsewhere, but not declared when it is itself compiled. > > I applied the patch, but I tried to reword the explanation to be more > clear. I may have failed. > That's pretty much it. The DISABLE_BRANCH_PROFILING is to disable it in various places where it will crash if used (vdso is one of them). It is also used to prevent the code that declares it from recursing on itself (as you stated). Thus, the issue is simply that the declaration is hidden by the recursion protection where the function is actually defined. Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org> -- Steve
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 947a60b801db..d7779a18b24f 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -12,11 +12,10 @@ * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code * to disable branch tracing on a per file basis. */ -#if defined(CONFIG_TRACE_BRANCH_PROFILING) \ - && !defined(DISABLE_BRANCH_PROFILING) && !defined(__CHECKER__) void ftrace_likely_update(struct ftrace_likely_data *f, int val, int expect, int is_constant); - +#if defined(CONFIG_TRACE_BRANCH_PROFILING) \ + && !defined(DISABLE_BRANCH_PROFILING) && !defined(__CHECKER__) #define likely_notrace(x) __builtin_expect(!!(x), 1) #define unlikely_notrace(x) __builtin_expect(!!(x), 0)