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 X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CBA5C4361B for ; Thu, 10 Dec 2020 19:18:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0039723B26 for ; Thu, 10 Dec 2020 19:18:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0039723B26 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6D4216B005D; Thu, 10 Dec 2020 14:18:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6AC1D6B0068; Thu, 10 Dec 2020 14:18:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E6D66B006C; Thu, 10 Dec 2020 14:18:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0117.hostedemail.com [216.40.44.117]) by kanga.kvack.org (Postfix) with ESMTP id 4999A6B005D for ; Thu, 10 Dec 2020 14:18:47 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 061183630 for ; Thu, 10 Dec 2020 19:18:47 +0000 (UTC) X-FDA: 77578334694.18.steel11_000084d273fa Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id D435B100EC665 for ; Thu, 10 Dec 2020 19:18:46 +0000 (UTC) X-HE-Tag: steel11_000084d273fa X-Filterd-Recvd-Size: 8464 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Thu, 10 Dec 2020 19:18:46 +0000 (UTC) Received: by mail-pl1-f172.google.com with SMTP id x12so2810752plr.10 for ; Thu, 10 Dec 2020 11:18:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0jTwekrKHkRvR5UGwaVUrluDpKs+eHkDfugKv4pyf3o=; b=k47MCVNM1z6ZRawgYnxC6u/9PMOa5JlJX9uaOq+WC7aHis7BwDEmJBvBydqChrpsvw FO3S7bYi/ITGTfUB4tM2AqgE1E/8BUTeByjQ4k5f94aMAdP96XooRUOioX1GLySm25UP hCO5e4GWNGKFeZ+pWqhO9b9BYIfvea1GstMQcczAeWJMuQy1xsjc7qnFVFpYxpI59x6z 2FXvaoR0Vdao+7RcOLKbYNC+qzEk3JX3tw9w3YCD9Wdap3t/ddd+RsxzIIL4KdY76+O5 ZsFFUlBLSJHkX4oCz4T0+6qF7OaEI/5ImD5mKAYF1Hw6OYzu8AZyjC/1q0dfX1UZfnCr 8QjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0jTwekrKHkRvR5UGwaVUrluDpKs+eHkDfugKv4pyf3o=; b=n6oSA9dZ22XsGSy7meRaF6RE1G7djxlNzQJDWaHnyk12o5qgR8W04W2cGTTiHm0qA+ MuOY+23j5osAV/oJh5JDBFFMG/ZyCQVl8ASfhbfmqC95gQ+HSa1m6XYKIu7Xzn4rSWbq j4eBcQwfZ0LNWT70idHaOOk/77EMNwJ6M8/ElJaLBZPiImSZ6uMnZ0z064eeY3iqMaSL MRpK6NBQRhPqns5HnuWLOadeh2t/rwcD2U0XPqx8zYTN7hCjVG+MEvuLqYU08QeWXfgW 4xvtva13LGspkv6/eRG83w/a9sniWJ6c0f57eUumbZIDjvUCrgo+p/eigChRUYaQu8KA iqsQ== X-Gm-Message-State: AOAM533LWro0b/InkDGfHagCkP7Ns1GmNIiiOsOIkQkUsYjJAy3Su/JF LM30yERE76eEJW/5bwpi9szBEQf6PUu69lv3J/rPCg== X-Google-Smtp-Source: ABdhPJzmRSSOkx9xSZ2Eo62i3FqItnKKyS5AA6kt0PWsxPIS1GR8Ge0ZjAP/Lk7/CoC5BxfcyytKWyJH9NKiyntATeg= X-Received: by 2002:a17:902:8541:b029:da:fcd1:7bf with SMTP id d1-20020a1709028541b02900dafcd107bfmr7752559plo.56.1607627924954; Thu, 10 Dec 2020 11:18:44 -0800 (PST) MIME-Version: 1.0 References: <202012101752.oNGReKJM-lkp@intel.com> <8d7aab68fd0d0a5d3ee1e99088e9a68e@kernel.org> In-Reply-To: <8d7aab68fd0d0a5d3ee1e99088e9a68e@kernel.org> From: Nick Desaulniers Date: Thu, 10 Dec 2020 11:18:33 -0800 Message-ID: Subject: Re: [linux-next:master 10163/12085] arch/arm64/kvm/hyp/nvhe/psci-relay.c:174:28: warning: no previous prototype for function 'kvm_host_psci_cpu_entry' To: Marc Zyngier Cc: kernel test robot , David Brazdil , kbuild-all@lists.01.org, clang-built-linux , Linux Memory Management List , Masahiro Yamada Content-Type: text/plain; charset="UTF-8" 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, Dec 10, 2020 at 1:38 AM Marc Zyngier wrote: > > On 2020-12-10 09:24, kernel test robot wrote: > > tree: > > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git > > master > > head: 2f1d5c77f13fe64497c2e2601605f7d7ec4da9b1 > > commit: cdf367192766ad11a03e8d5098556be43b8eb6b0 [10163/12085] KVM: > > arm64: Intercept host's CPU_ON SMCs > > config: arm64-randconfig-r032-20201209 (attached as .config) > > compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project > > 1968804ac726e7674d5de22bc2204b45857da344) > > 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 arm64 cross compiling tool for clang build > > # apt-get install binutils-aarch64-linux-gnu > > # > > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=cdf367192766ad11a03e8d5098556be43b8eb6b0 > > 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 cdf367192766ad11a03e8d5098556be43b8eb6b0 > > # save the attached .config to linux build tree > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross > > ARCH=arm64 > > > > If you fix the issue, kindly add following tag as appropriate > > Reported-by: kernel test robot > > > > All warnings (new ones prefixed by >>): > > > >>> arch/arm64/kvm/hyp/nvhe/psci-relay.c:174:28: warning: no previous > >>> prototype for function 'kvm_host_psci_cpu_entry' > >>> [-Wmissing-prototypes] > > asmlinkage void __noreturn kvm_host_psci_cpu_entry(bool is_cpu_on) > > ^ > > arch/arm64/kvm/hyp/nvhe/psci-relay.c:174:12: note: declare 'static' > > if the function is not intended to be used outside of this translation > > unit > > asmlinkage void __noreturn kvm_host_psci_cpu_entry(bool is_cpu_on) > > ^ > > static > > 1 warning generated. > > I wish someone would fix these reports and weed out these false > positive. > > The function is annotated as asmlinkage, meaning it is called from some > assembly code. Not amount of prototyping is going to help the assembler, > and making it static is just going to break the build. While it's not great, my recommendation would be to provide a declaration within the same source file. The warning is generally about defining a function with extern linkage without having previously declared a prototype, which can be dangerous when there's other callers in other translation units as they would have to match the prototype without any compiler checks. The compiler can't know when looking in isolation at one translation unit that the only callers are assembler. See for example stpcpy in lib/string.c: 290 char *stpcpy(char *__restrict__ dest, const char *__restrict__ src); 291 char *stpcpy(char *__restrict__ dest, const char *__restrict__ src) 292 { ... It has extern linkage but we don't really want people to call it, so the prototype is provided within the TU to shut up -Wmissing-prototypes. I'd argue we should do the same thing to fix -Wmissing-prototypes for functions who are only called from assembler. You might think "that's stupid" and I wouldn't disagree, but that's one of the ways to resolve -Wmissing-prototypes: 1. use static linkage if no callers exist outside of the TU (does not apply here, we have external callers), or 2. provide a declaration in a header so other C callers don't mess up the prototype (does not apply here, we don't have external C callers), or 3. provide a declaration in the same TU (4. don't do W=1 builds. :P) While it may be painful/weird for this case, making this TU -Wmissing-prototypes clean allows folks to tackle the above 3 cases throughout the tree. > > Thanks, > > M. > > > > > vim +/kvm_host_psci_cpu_entry +174 arch/arm64/kvm/hyp/nvhe/psci-relay.c > > > > 173 > > > 174 asmlinkage void __noreturn kvm_host_psci_cpu_entry(bool > > is_cpu_on) > > 175 { > > 176 struct psci_boot_args *boot_args; > > 177 struct kvm_cpu_context *host_ctxt; > > 178 > > 179 host_ctxt = > > &this_cpu_ptr(hyp_symbol_addr(kvm_host_data))->host_ctxt; > > 180 boot_args = this_cpu_ptr(hyp_symbol_addr(cpu_on_args)); > > 181 > > 182 cpu_reg(host_ctxt, 0) = boot_args->r0; > > 183 write_sysreg_el2(boot_args->pc, SYS_ELR); > > 184 release_boot_args(boot_args); > > 185 > > 186 __host_enter(host_ctxt); > > 187 } > > 188 > > > > --- > > 0-DAY CI Kernel Test Service, Intel Corporation > > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org > > -- > Jazz is not dead. It just smells funny... > > -- > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group. > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/8d7aab68fd0d0a5d3ee1e99088e9a68e%40kernel.org. -- Thanks, ~Nick Desaulniers