Received: by 2002:a05:7412:bb8d:b0:d7:7d3a:4fe2 with SMTP id js13csp1880144rdb; Thu, 17 Aug 2023 05:05:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEeZ/VACQEovaWiJZfjj6Bli7P/DzAXy6AfUKd2PPkDt2kzX+AKwaKtm0/egWBO+RZijHfI X-Received: by 2002:a05:6512:128b:b0:4f8:6625:f2ca with SMTP id u11-20020a056512128b00b004f86625f2camr5098913lfs.61.1692273922998; Thu, 17 Aug 2023 05:05:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692273922; cv=none; d=google.com; s=arc-20160816; b=cZWL+gNN3fsiZRmWe/MqQdrP4GzM8nqAHbCjfBvh2tatQmxOT9VDmijct1voYcUQ6c 8aV57l+lKjbWF8YgXqdAdsZ82fqqFx17yBCkTrxa+NA+na+AJuRi29jqkiSZgEJ1Qbf/ LtIaihXut3VbmEBLZNyAcxPE7bCR2RLsGi68DyxCBfNHGNJHlXsGSilC9Z/JyQPhdieQ B10BaFbu3WZvCyOEZO0BPkGjwWOtUtTK76PzGoxwMajIQeX78O0+9JlWShbHHKDRQan+ ipr2mG+oOOwGjXMjcH6hm7RhVzpcqRGiw0hj4Ss8bsKtXKaOgmYox4SURqS7CG2SePaR sJsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=a6y1TC7cBo2QfNhr6teNP7YTGsh50NU2RBX8x/ID4jo=; fh=ijUM9WdhbbN6+ly4dEN2eW4s3CK4F4Es5KI0F7+l+Fc=; b=OPJ6hq1pGsCEaYUhjTWXkbnDWxj4GMtbllOc/ngkzItxdMfhF+BtsZWFFANhnhowJY odJ+AgJLI5x5nTQ8Bs56Pdn9h9rVM09EQnG7TraGnmRIkeu5YdKrXM6qGvg/Uz66njJs LKPd8Wp5FG5Go4NmIHGNqaMIMUYifRboc5L6Fy6KgdBOXpZ0CNv1ibh67wU3Jws5sIBz oL9q1DE15r75rveVXYUCjZl73ihoHXeWDqvLw3baXhn0sym+SNVzqXXxzPd1KI+4U8mj QDuhfnY3Xay/ZOHyWlQ/8J6gHJDsHLdAmeIbgGbfeNAI+VLJCa8zURc22JF6uxZYRiOp b+ZA== 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 m21-20020a056402051500b005232b8d1278si13131803edv.79.2023.08.17.05.04.36; Thu, 17 Aug 2023 05:05:22 -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 S245180AbjHPOIT (ORCPT + 99 others); Wed, 16 Aug 2023 10:08:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242867AbjHPOHy (ORCPT ); Wed, 16 Aug 2023 10:07:54 -0400 Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C528BE48 for ; Wed, 16 Aug 2023 07:07:52 -0700 (PDT) Received: by mail-qk1-f172.google.com with SMTP id af79cd13be357-76c9334baedso402507485a.2 for ; Wed, 16 Aug 2023 07:07:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692194872; x=1692799672; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a6y1TC7cBo2QfNhr6teNP7YTGsh50NU2RBX8x/ID4jo=; b=k4kgB5TT3mRfC05CUMGFC+Azf/RFy0MlvRJq92FMWZQGbHW1k7ZxB1719KKTe+h963 CZIvfEfFFWFTQwzaKFyFUe8V6wVvQ8lkSYPBRY+A8vkbL328qhWXOJuk9V6gt4VP+f0X GdNYmK5fJrDuyzjXrXPDzHgml88XNrbQARw/vjvj0O4IkQIVQqg5KVTy+62xUrgp9AER DIhuHr/+USZsg/Whvidv59AdF2hFn0n9edxgeq6kcgZEXsY38BvFOyLQw0ZKM9eU59Ta /C5h6NY1o+L/NmRYMBv6vID1aFXaOSSlDxdKueo7I8mUGRh+DYnWy8lPO1G00GNCGzqI Y4xA== X-Gm-Message-State: AOJu0Yw7lIUDrZQAdEerQbyZI0PjR/eVfQ0Y7xhE6BOmJw59tOLOSiFx 0HaN782KYyAS2h78uV/0+JU= X-Received: by 2002:a05:620a:254c:b0:767:ad42:cc32 with SMTP id s12-20020a05620a254c00b00767ad42cc32mr1660477qko.2.1692194871761; Wed, 16 Aug 2023 07:07:51 -0700 (PDT) Received: from maniforge ([2620:10d:c091:400::5:6eb]) by smtp.gmail.com with ESMTPSA id i15-20020a05620a074f00b0076c60b95b87sm4428533qki.96.2023.08.16.07.07.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Aug 2023 07:07:50 -0700 (PDT) Date: Wed, 16 Aug 2023 09:07:48 -0500 From: David Vernet To: kernel test robot Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org, Alexei Starovoitov Subject: Re: kernel/bpf/cpumask.c:41:21: warning: no previous declaration for 'bpf_cpumask_create' Message-ID: <20230816140748.GA759901@maniforge> References: <202308162115.Hn23vv3n-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202308162115.Hn23vv3n-lkp@intel.com> User-Agent: Mutt/2.2.10 (2023-03-25) X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 Wed, Aug 16, 2023 at 09:25:30PM +0800, kernel test robot wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > head: 4853c74bd7ab7fdb83f319bd9ace8a08c031e9b6 > commit: 516f4d3397c9e90f4da04f59986c856016269aa1 bpf: Enable cpumasks to be queried and used as kptrs > date: 7 months ago > config: x86_64-randconfig-x076-20230816 (https://download.01.org/0day-ci/archive/20230816/202308162115.Hn23vv3n-lkp@intel.com/config) > compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0 > reproduce: (https://download.01.org/0day-ci/archive/20230816/202308162115.Hn23vv3n-lkp@intel.com/reproduce) > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot > | Closes: https://lore.kernel.org/oe-kbuild-all/202308162115.Hn23vv3n-lkp@intel.com/ > > All warnings (new ones prefixed by >>): > > >> kernel/bpf/cpumask.c:41:21: warning: no previous declaration for 'bpf_cpumask_create' [-Wmissing-declarations] > struct bpf_cpumask *bpf_cpumask_create(void) Meh, more noise from lkp because of kfuncs. It would be nice if as a courtesy, these warnings were fixed before they got turned on and the email list got spammed 7 months after the commit landed; especially given that this is essentially redundant with -Wmissing-prototypes. Anyways, the solution here is to just add the following around all kfuncs that already have -Wmissing-prototypes disabled: __diag_push(); __diag_ignore_all("-Wmissing-declarations", "Global kfuncs as their definitions will be in BTF"); I'll send out a patch that adds this around all kfuncs so we can avoid all of these warnings in one go. > ^~~~~~~~~~~~~~~~~~ > >> kernel/bpf/cpumask.c:55:21: warning: no previous declaration for 'bpf_cpumask_acquire' [-Wmissing-declarations] > struct bpf_cpumask *bpf_cpumask_acquire(struct bpf_cpumask *cpumask) > ^~~~~~~~~~~~~~~~~~~ > kernel/bpf/cpumask.c:61:21: warning: no previous declaration for 'bpf_cpumask_kptr_get' [-Wmissing-declarations] > struct bpf_cpumask *bpf_cpumask_kptr_get(struct bpf_cpumask **cpumaskp) > ^~~~~~~~~~~~~~~~~~~~ > >> kernel/bpf/cpumask.c:79:6: warning: no previous declaration for 'bpf_cpumask_release' [-Wmissing-declarations] > void bpf_cpumask_release(struct bpf_cpumask *cpumask) > ^~~~~~~~~~~~~~~~~~~ > >> kernel/bpf/cpumask.c:91:5: warning: no previous declaration for 'bpf_cpumask_first' [-Wmissing-declarations] > u32 bpf_cpumask_first(const struct cpumask *cpumask) > ^~~~~~~~~~~~~~~~~ > >> kernel/bpf/cpumask.c:96:5: warning: no previous declaration for 'bpf_cpumask_first_zero' [-Wmissing-declarations] > u32 bpf_cpumask_first_zero(const struct cpumask *cpumask) > ^~~~~~~~~~~~~~~~~~~~~~ > >> kernel/bpf/cpumask.c:101:6: warning: no previous declaration for 'bpf_cpumask_set_cpu' [-Wmissing-declarations] > void bpf_cpumask_set_cpu(u32 cpu, struct bpf_cpumask *cpumask) > ^~~~~~~~~~~~~~~~~~~ > >> kernel/bpf/cpumask.c:109:6: warning: no previous declaration for 'bpf_cpumask_clear_cpu' [-Wmissing-declarations] > void bpf_cpumask_clear_cpu(u32 cpu, struct bpf_cpumask *cpumask) > ^~~~~~~~~~~~~~~~~~~~~ > >> kernel/bpf/cpumask.c:117:6: warning: no previous declaration for 'bpf_cpumask_test_cpu' [-Wmissing-declarations] > bool bpf_cpumask_test_cpu(u32 cpu, const struct cpumask *cpumask) > ^~~~~~~~~~~~~~~~~~~~ > >> kernel/bpf/cpumask.c:125:6: warning: no previous declaration for 'bpf_cpumask_test_and_set_cpu' [-Wmissing-declarations] > bool bpf_cpumask_test_and_set_cpu(u32 cpu, struct bpf_cpumask *cpumask) > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >> kernel/bpf/cpumask.c:133:6: warning: no previous declaration for 'bpf_cpumask_test_and_clear_cpu' [-Wmissing-declarations] > bool bpf_cpumask_test_and_clear_cpu(u32 cpu, struct bpf_cpumask *cpumask) > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >> kernel/bpf/cpumask.c:141:6: warning: no previous declaration for 'bpf_cpumask_setall' [-Wmissing-declarations] > void bpf_cpumask_setall(struct bpf_cpumask *cpumask) > ^~~~~~~~~~~~~~~~~~ > >> kernel/bpf/cpumask.c:146:6: warning: no previous declaration for 'bpf_cpumask_clear' [-Wmissing-declarations] > void bpf_cpumask_clear(struct bpf_cpumask *cpumask) > ^~~~~~~~~~~~~~~~~ > >> kernel/bpf/cpumask.c:151:6: warning: no previous declaration for 'bpf_cpumask_and' [-Wmissing-declarations] > bool bpf_cpumask_and(struct bpf_cpumask *dst, > ^~~~~~~~~~~~~~~ > >> kernel/bpf/cpumask.c:158:6: warning: no previous declaration for 'bpf_cpumask_or' [-Wmissing-declarations] > void bpf_cpumask_or(struct bpf_cpumask *dst, > ^~~~~~~~~~~~~~ > >> kernel/bpf/cpumask.c:165:6: warning: no previous declaration for 'bpf_cpumask_xor' [-Wmissing-declarations] > void bpf_cpumask_xor(struct bpf_cpumask *dst, > ^~~~~~~~~~~~~~~ > >> kernel/bpf/cpumask.c:172:6: warning: no previous declaration for 'bpf_cpumask_equal' [-Wmissing-declarations] > bool bpf_cpumask_equal(const struct cpumask *src1, const struct cpumask *src2) > ^~~~~~~~~~~~~~~~~ > >> kernel/bpf/cpumask.c:177:6: warning: no previous declaration for 'bpf_cpumask_intersects' [-Wmissing-declarations] > bool bpf_cpumask_intersects(const struct cpumask *src1, const struct cpumask *src2) > ^~~~~~~~~~~~~~~~~~~~~~ > >> kernel/bpf/cpumask.c:182:6: warning: no previous declaration for 'bpf_cpumask_subset' [-Wmissing-declarations] > bool bpf_cpumask_subset(const struct cpumask *src1, const struct cpumask *src2) > ^~~~~~~~~~~~~~~~~~ > >> kernel/bpf/cpumask.c:187:6: warning: no previous declaration for 'bpf_cpumask_empty' [-Wmissing-declarations] > bool bpf_cpumask_empty(const struct cpumask *cpumask) > ^~~~~~~~~~~~~~~~~ > >> kernel/bpf/cpumask.c:192:6: warning: no previous declaration for 'bpf_cpumask_full' [-Wmissing-declarations] > bool bpf_cpumask_full(const struct cpumask *cpumask) > ^~~~~~~~~~~~~~~~ > kernel/bpf/cpumask.c:197:6: warning: no previous declaration for 'bpf_cpumask_copy' [-Wmissing-declarations] > void bpf_cpumask_copy(struct bpf_cpumask *dst, const struct cpumask *src) > ^~~~~~~~~~~~~~~~ > kernel/bpf/cpumask.c:202:5: warning: no previous declaration for 'bpf_cpumask_any' [-Wmissing-declarations] > u32 bpf_cpumask_any(const struct cpumask *cpumask) > ^~~~~~~~~~~~~~~ > kernel/bpf/cpumask.c:207:5: warning: no previous declaration for 'bpf_cpumask_any_and' [-Wmissing-declarations] > u32 bpf_cpumask_any_and(const struct cpumask *src1, const struct cpumask *src2) > ^~~~~~~~~~~~~~~~~~~ > > > vim +/bpf_cpumask_create +41 kernel/bpf/cpumask.c > > 36 > 37 __diag_push(); > 38 __diag_ignore_all("-Wmissing-prototypes", > 39 "Global kfuncs as their definitions will be in BTF"); > 40 > > 41 struct bpf_cpumask *bpf_cpumask_create(void) > 42 { > 43 struct bpf_cpumask *cpumask; > 44 > 45 cpumask = bpf_mem_alloc(&bpf_cpumask_ma, sizeof(*cpumask)); > 46 if (!cpumask) > 47 return NULL; > 48 > 49 memset(cpumask, 0, sizeof(*cpumask)); > 50 refcount_set(&cpumask->usage, 1); > 51 > 52 return cpumask; > 53 } > 54 > > 55 struct bpf_cpumask *bpf_cpumask_acquire(struct bpf_cpumask *cpumask) > 56 { > 57 refcount_inc(&cpumask->usage); > 58 return cpumask; > 59 } > 60 > > 61 struct bpf_cpumask *bpf_cpumask_kptr_get(struct bpf_cpumask **cpumaskp) > 62 { > 63 struct bpf_cpumask *cpumask; > 64 > 65 /* The BPF memory allocator frees memory backing its caches in an RCU > 66 * callback. Thus, we can safely use RCU to ensure that the cpumask is > 67 * safe to read. > 68 */ > 69 rcu_read_lock(); > 70 > 71 cpumask = READ_ONCE(*cpumaskp); > 72 if (cpumask && !refcount_inc_not_zero(&cpumask->usage)) > 73 cpumask = NULL; > 74 > 75 rcu_read_unlock(); > 76 return cpumask; > 77 } > 78 > > 79 void bpf_cpumask_release(struct bpf_cpumask *cpumask) > 80 { > 81 if (!cpumask) > 82 return; > 83 > 84 if (refcount_dec_and_test(&cpumask->usage)) { > 85 migrate_disable(); > 86 bpf_mem_free(&bpf_cpumask_ma, cpumask); > 87 migrate_enable(); > 88 } > 89 } > 90 > > 91 u32 bpf_cpumask_first(const struct cpumask *cpumask) > 92 { > 93 return cpumask_first(cpumask); > 94 } > 95 > > 96 u32 bpf_cpumask_first_zero(const struct cpumask *cpumask) > 97 { > 98 return cpumask_first_zero(cpumask); > 99 } > 100 > > 101 void bpf_cpumask_set_cpu(u32 cpu, struct bpf_cpumask *cpumask) > 102 { > 103 if (!cpu_valid(cpu)) > 104 return; > 105 > 106 cpumask_set_cpu(cpu, (struct cpumask *)cpumask); > 107 } > 108 > > 109 void bpf_cpumask_clear_cpu(u32 cpu, struct bpf_cpumask *cpumask) > 110 { > 111 if (!cpu_valid(cpu)) > 112 return; > 113 > 114 cpumask_clear_cpu(cpu, (struct cpumask *)cpumask); > 115 } > 116 > > 117 bool bpf_cpumask_test_cpu(u32 cpu, const struct cpumask *cpumask) > 118 { > 119 if (!cpu_valid(cpu)) > 120 return false; > 121 > 122 return cpumask_test_cpu(cpu, (struct cpumask *)cpumask); > 123 } > 124 > > 125 bool bpf_cpumask_test_and_set_cpu(u32 cpu, struct bpf_cpumask *cpumask) > 126 { > 127 if (!cpu_valid(cpu)) > 128 return false; > 129 > 130 return cpumask_test_and_set_cpu(cpu, (struct cpumask *)cpumask); > 131 } > 132 > > 133 bool bpf_cpumask_test_and_clear_cpu(u32 cpu, struct bpf_cpumask *cpumask) > 134 { > 135 if (!cpu_valid(cpu)) > 136 return false; > 137 > 138 return cpumask_test_and_clear_cpu(cpu, (struct cpumask *)cpumask); > 139 } > 140 > > 141 void bpf_cpumask_setall(struct bpf_cpumask *cpumask) > 142 { > 143 cpumask_setall((struct cpumask *)cpumask); > 144 } > 145 > > 146 void bpf_cpumask_clear(struct bpf_cpumask *cpumask) > 147 { > 148 cpumask_clear((struct cpumask *)cpumask); > 149 } > 150 > > 151 bool bpf_cpumask_and(struct bpf_cpumask *dst, > 152 const struct cpumask *src1, > 153 const struct cpumask *src2) > 154 { > 155 return cpumask_and((struct cpumask *)dst, src1, src2); > 156 } > 157 > > 158 void bpf_cpumask_or(struct bpf_cpumask *dst, > 159 const struct cpumask *src1, > 160 const struct cpumask *src2) > 161 { > 162 cpumask_or((struct cpumask *)dst, src1, src2); > 163 } > 164 > > 165 void bpf_cpumask_xor(struct bpf_cpumask *dst, > 166 const struct cpumask *src1, > 167 const struct cpumask *src2) > 168 { > 169 cpumask_xor((struct cpumask *)dst, src1, src2); > 170 } > 171 > > 172 bool bpf_cpumask_equal(const struct cpumask *src1, const struct cpumask *src2) > 173 { > 174 return cpumask_equal(src1, src2); > 175 } > 176 > > 177 bool bpf_cpumask_intersects(const struct cpumask *src1, const struct cpumask *src2) > 178 { > 179 return cpumask_intersects(src1, src2); > 180 } > 181 > > 182 bool bpf_cpumask_subset(const struct cpumask *src1, const struct cpumask *src2) > 183 { > 184 return cpumask_subset(src1, src2); > 185 } > 186 > > 187 bool bpf_cpumask_empty(const struct cpumask *cpumask) > 188 { > 189 return cpumask_empty(cpumask); > 190 } > 191 > > 192 bool bpf_cpumask_full(const struct cpumask *cpumask) > 193 { > 194 return cpumask_full(cpumask); > 195 } > 196 > > 197 void bpf_cpumask_copy(struct bpf_cpumask *dst, const struct cpumask *src) > 198 { > 199 cpumask_copy((struct cpumask *)dst, src); > 200 } > 201 > > -- > 0-DAY CI Kernel Test Service > https://github.com/intel/lkp-tests/wiki