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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 124A8C433EF for ; Fri, 18 Mar 2022 18:26:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 34F9A8D0002; Fri, 18 Mar 2022 14:26:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2FDB28D0001; Fri, 18 Mar 2022 14:26:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 19EC18D0002; Fri, 18 Mar 2022 14:26:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0006.hostedemail.com [216.40.44.6]) by kanga.kvack.org (Postfix) with ESMTP id 0044C8D0001 for ; Fri, 18 Mar 2022 14:26:45 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B4D3818288A4F for ; Fri, 18 Mar 2022 18:26:45 +0000 (UTC) X-FDA: 79258337970.20.E76C781 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by imf20.hostedemail.com (Postfix) with ESMTP id 36AC21C001F for ; Fri, 18 Mar 2022 18:26:45 +0000 (UTC) Received: by mail-lf1-f50.google.com with SMTP id l20so15345959lfg.12 for ; Fri, 18 Mar 2022 11:26:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BEvIcItzwI7AbO5vcVLAT6Szyh3SVhaIHzst9Wi8ht0=; b=ChBd8tt/A1LasVJpzsSL146qUJoEGjcxAawxw2u0GKWIKHWEmrKnsfAT6X3iI9Myc+ a1UwTQYljtKjwdAWgYXCQKfnysaVL/ryd0IxtNx6/LX4dexWZ4bAOHVyXWRhMiLvUerg RwUz1vPZUfL8zNO4Hy0IwizRwPzTa0roqq1DPe+ytfA3Fbtq5JXBRCWUYmriHeU9nFis ZmExuWdV0RsqzCPtnysBnHXZMJt0P2clx855Smm5PtYo8Atw/ka5wQMkWCYaHpaxbtOf I2kkjBH9htr2fZ4G7+3Gidk7Hw68O135HQA7L5zwL3ubg7An1fugHBVSbPW+5kbexZJE 0nbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BEvIcItzwI7AbO5vcVLAT6Szyh3SVhaIHzst9Wi8ht0=; b=lNDyyNIruiAtS51QYuthT1t2v+lHr86U8ibwlaqyXX4rgzTgZbPUtzymeWmu2JhD9f R+xQev6G6krLTrQQF8sIGDSJ6WJzItVLg4rjITD6Y1DtMllsP5rzWs+CHt0HYET4ihu2 4skBSk+bNQXDgMSOGGHX4WcRG3WQw6G8bbriad46XLxQuFBodlrhaK9k7B5HEIxmq1HT iUqUXxMaoC6h3FN6HpEYqogom4LqICbuzMgtBZ61mjbH8rWsODpawCSWruXeJax8L4EM EwhxLdvDDiBeRP5DV+XsFdp3WMVOFul+euB6rQdvlKwJq8kB9veuxlX4siENnnOLDhw0 sQaA== X-Gm-Message-State: AOAM533A1m/UsUV2cgA/VwZ+Ayg9D5BH1uiZtc6nyCXrH/qiQprJs3GK luCiGG5TaY2nfOiAIovlFQ+7akNVYvPJIqAvAt5m1w== X-Google-Smtp-Source: ABdhPJyxHHom+Te5JPNVVmMmZgxUny013AKSlGj9fZudGfTq1qDb7BPPzRNtYCimG0xRyMqK4inYQimRbxIL4K2F2RM= X-Received: by 2002:ac2:5feb:0:b0:448:2707:6bfd with SMTP id s11-20020ac25feb000000b0044827076bfdmr6951438lfg.380.1647628003319; Fri, 18 Mar 2022 11:26:43 -0700 (PDT) MIME-Version: 1.0 References: <202203110903.3xDyTUVl-lkp@intel.com> <20220310210404.7c47aa47@gandalf.local.home> In-Reply-To: <20220310210404.7c47aa47@gandalf.local.home> From: Nick Desaulniers Date: Fri, 18 Mar 2022 11:26:31 -0700 Message-ID: Subject: Re: [linux-next:master 4103/11953] arch/arm/kernel/ftrace.c:229:6: warning: no previous prototype for function 'prepare_ftrace_return' To: Steven Rostedt , Ard Biesheuvel , Marc Zyngier , Arnd Bergmann Cc: kernel test robot , llvm@lists.linux.dev, kbuild-all@lists.01.org, Linux Memory Management List , Linus Torvalds Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 36AC21C001F Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b="ChBd8tt/"; spf=pass (imf20.hostedemail.com: domain of ndesaulniers@google.com designates 209.85.167.50 as permitted sender) smtp.mailfrom=ndesaulniers@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-Stat-Signature: jqsx7udt3y6dx6mrmwy4tnieh3bs4g65 X-HE-Tag: 1647628005-29799 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: , , On Thu, Mar 10, 2022 at 6:04 PM Steven Rostedt wrote: > > On Fri, 11 Mar 2022 09:44:11 +0800 > kernel test robot wrote: > > > Hi Ard, > > > > FYI, the error/warning still remains. > > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > > head: 71941773e143369a73c9c4a3b62fbb60736a1182 > > commit: 41918ec82eb6f80c8b401422f27ca76c85aa0cb7 [4103/11953] ARM: ftrace: enable the graph tracer with the EABI unwinder > > config: arm-aspeed_g4_defconfig (https://download.01.org/0day-ci/archive/20220311/202203110903.3xDyTUVl-lkp@intel.com/config) > > compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 276ca87382b8f16a65bddac700202924228982f6) > > reproduce (this is a W=1 build): > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > > chmod +x ~/bin/make.cross > > # install arm cross compiling tool for clang build > > # apt-get install binutils-arm-linux-gnueabi > > # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=41918ec82eb6f80c8b401422f27ca76c85aa0cb7 > > git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git > > git fetch --no-tags linux-next master > > git checkout 41918ec82eb6f80c8b401422f27ca76c85aa0cb7 > > # save the config file to linux build tree > > mkdir build_dir > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash arch/arm/kernel/ > > > > If you fix the issue, kindly add following tag as appropriate > > Reported-by: kernel test robot > > > > All warnings (new ones prefixed by >>): > > > > >> arch/arm/kernel/ftrace.c:229:6: warning: no previous prototype for function 'prepare_ftrace_return' [-Wmissing-prototypes] > > void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, > > ^ > > arch/arm/kernel/ftrace.c:229:1: note: declare 'static' if the function is not intended to be used outside of this translation unit > > void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, > > ^ > > static > > 1 warning generated. > > > > Hmm, this is only called from assembly code, which doesn't care about > prototypes. Is there a way to quiet this warning to say "this is called > only by assembly"? > > Or do we just add a useless prototype to shut it up? So this has come up a few times before, particularly around the usage in the kernel of `asmlinkage`. This 0day report also only comes up for W=1 builds, which enable -Wmissing-prototypes (see scripts/Makefile.extrawarn). The problem is that `asmlinkage` is not a language keyword; it's a preprocessor define (see include/linux/linkage.h, arch/ia64/include/asm/linkage.h, arch/x86/include/asm/linkage.h), so the compiler has no idea that this function is only called from assembly only. The warning is meant to catch implicit defines (-Wimplicit-function-declaration) where the signature the caller is expecting doesn't match the callee's actual definition (because the callee wasn't declared in a shared header). I think IF we had a function attribute added to the compiler that disabled -Wmissing-prototype warnings just for that definition, then we could do something like: #define asmlinkage CPP_ASMLINKAGE \ __attribute__((no_wmissing_prototypes,error( \ "Called an asmlinkage function from C; remove " \ "asmlinkage or dont call this fn")) or something. We wouldn't be able to always enable -Wmissing-prototypes until we had such an fn attr though, due to cases like this. I think -Wmissing-prototypes is still worthwhile, and that Arnd previously mentioned interest in this warning. For now, I think it's worth forward declaring the function, in the .c file (rather than a header) with a comment that this is expected to be called from asm only. If that ever changes, then the declaration can be moved to a header. -- Thanks, ~Nick Desaulniers