[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202210272227.jWuKg5y6-lkp@intel.com>
Date: Thu, 27 Oct 2022 22:03:53 +0800
From: kernel test robot <lkp@...el.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
linux-kernel@...r.kernel.org, x86@...nel.org,
Ravi Bangoria <ravi.bangoria@....com>
Subject: [tip:perf/core 1/2] kernel/events/core.c:181:48: error: redefinition
of 'cpu_context' as different kind of symbol
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core
head: dc39beffcfc19a8dd2a09c5818dcd1a4e9099033
commit: 983bd8543b5ab8e9a2870ae258bccd4ce7a22c7c [1/2] perf: Rewrite core context handling
config: mips-randconfig-r024-20221026
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920)
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 mips cross compiling tool for clang build
# apt-get install binutils-mips64el-linux-gnuabi64
# https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=983bd8543b5ab8e9a2870ae258bccd4ce7a22c7c
git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
git fetch --no-tags tip perf/core
git checkout 983bd8543b5ab8e9a2870ae258bccd4ce7a22c7c
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash kernel/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
All errors (new ones prefixed by >>):
>> kernel/events/core.c:181:48: error: redefinition of 'cpu_context' as different kind of symbol
static DEFINE_PER_CPU(struct perf_cpu_context, cpu_context);
^
arch/mips/include/asm/mmu_context.h:106:19: note: previous definition is here
static inline u64 cpu_context(unsigned int cpu, const struct mm_struct *mm)
^
>> kernel/events/core.c:181:48: error: redefinition of 'cpu_context' as different kind of symbol
static DEFINE_PER_CPU(struct perf_cpu_context, cpu_context);
^
arch/mips/include/asm/mmu_context.h:106:19: note: previous definition is here
static inline u64 cpu_context(unsigned int cpu, const struct mm_struct *mm)
^
>> kernel/events/core.c:186:35: error: member reference base type 'typeof (*(&cpu_context))' (aka 'unsigned long long (unsigned int, const struct mm_struct *)') is not a structure or union
return this_cpu_ptr(&cpu_context)->task_ctx;
~~~~~~~~~~~~~~~~~~~~~~~~~~^ ~~~~~~~~
>> kernel/events/core.c:222:27: error: incompatible pointer types initializing 'struct perf_cpu_context *' with an expression of type 'typeof ((typeof (*(&cpu_context)) *)(&cpu_context))' (aka 'unsigned long long (*)(unsigned int, const struct mm_struct *)') [-Werror,-Wincompatible-pointer-types]
struct perf_cpu_context *cpuctx = this_cpu_ptr(&cpu_context);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/events/core.c:319:27: error: incompatible pointer types initializing 'struct perf_cpu_context *' with an expression of type 'typeof ((typeof (*(&cpu_context)) *)(&cpu_context))' (aka 'unsigned long long (*)(unsigned int, const struct mm_struct *)') [-Werror,-Wincompatible-pointer-types]
struct perf_cpu_context *cpuctx = this_cpu_ptr(&cpu_context);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
>> kernel/events/core.c:2360:37: error: incompatible pointer types passing 'typeof ((typeof (*(&cpu_context)) *)(&cpu_context))' (aka 'unsigned long long (*)(unsigned int, const struct mm_struct *)') to parameter of type 'struct perf_cpu_context *' [-Werror,-Wincompatible-pointer-types]
__perf_remove_from_context(event, this_cpu_ptr(&cpu_context),
^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/percpu-defs.h:252:27: note: expanded from macro 'this_cpu_ptr'
#define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
^~~~~~~~~~~~~~~~
include/linux/percpu-defs.h:239:31: note: expanded from macro 'raw_cpu_ptr'
#define raw_cpu_ptr(ptr) \
^
kernel/events/core.c:2294:32: note: passing argument to parameter 'cpuctx' here
struct perf_cpu_context *cpuctx,
^
kernel/events/core.c:2603:27: error: incompatible pointer types initializing 'struct perf_cpu_context *' with an expression of type 'typeof ((typeof (*(&cpu_context)) *)(&cpu_context))' (aka 'unsigned long long (*)(unsigned int, const struct mm_struct *)') [-Werror,-Wincompatible-pointer-types]
struct perf_cpu_context *cpuctx = this_cpu_ptr(&cpu_context);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/events/core.c:2687:27: error: incompatible pointer types initializing 'struct perf_cpu_context *' with an expression of type 'typeof ((typeof (*(&cpu_context)) *)(&cpu_context))' (aka 'unsigned long long (*)(unsigned int, const struct mm_struct *)') [-Werror,-Wincompatible-pointer-types]
struct perf_cpu_context *cpuctx = this_cpu_ptr(&cpu_context);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/events/core.c:2705:27: error: incompatible pointer types initializing 'struct perf_cpu_context *' with an expression of type 'typeof ((typeof (*(&cpu_context)) *)(&cpu_context))' (aka 'unsigned long long (*)(unsigned int, const struct mm_struct *)') [-Werror,-Wincompatible-pointer-types]
struct perf_cpu_context *cpuctx = this_cpu_ptr(&cpu_context);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/events/core.c:3224:27: error: incompatible pointer types initializing 'struct perf_cpu_context *' with an expression of type 'typeof ((typeof (*(&cpu_context)) *)(&cpu_context))' (aka 'unsigned long long (*)(unsigned int, const struct mm_struct *)') [-Werror,-Wincompatible-pointer-types]
struct perf_cpu_context *cpuctx = this_cpu_ptr(&cpu_context);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/events/core.c:3556:27: error: incompatible pointer types initializing 'struct perf_cpu_context *' with an expression of type 'typeof ((typeof (*(&cpu_context)) *)(&cpu_context))' (aka 'unsigned long long (*)(unsigned int, const struct mm_struct *)') [-Werror,-Wincompatible-pointer-types]
struct perf_cpu_context *cpuctx = this_cpu_ptr(&cpu_context);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/events/core.c:3578:27: error: incompatible pointer types initializing 'struct perf_cpu_context *' with an expression of type 'typeof ((typeof (*(&cpu_context)) *)(&cpu_context))' (aka 'unsigned long long (*)(unsigned int, const struct mm_struct *)') [-Werror,-Wincompatible-pointer-types]
struct perf_cpu_context *cpuctx = this_cpu_ptr(&cpu_context);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
>> kernel/events/core.c:3686:10: error: incompatible pointer types assigning to 'struct perf_cpu_context *' from 'typeof ((typeof (*(&cpu_context)) *)(&cpu_context))' (aka 'unsigned long long (*)(unsigned int, const struct mm_struct *)') [-Werror,-Wincompatible-pointer-types]
cpuctx = this_cpu_ptr(&cpu_context);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/events/core.c:3848:27: error: incompatible pointer types initializing 'struct perf_cpu_context *' with an expression of type 'typeof ((typeof (*(&cpu_context)) *)(&cpu_context))' (aka 'unsigned long long (*)(unsigned int, const struct mm_struct *)') [-Werror,-Wincompatible-pointer-types]
struct perf_cpu_context *cpuctx = this_cpu_ptr(&cpu_context);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/events/core.c:3891:27: error: incompatible pointer types initializing 'struct perf_cpu_context *' with an expression of type 'typeof ((typeof (*(&cpu_context)) *)(&cpu_context))' (aka 'unsigned long long (*)(unsigned int, const struct mm_struct *)') [-Werror,-Wincompatible-pointer-types]
struct perf_cpu_context *cpuctx = this_cpu_ptr(&cpu_context);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/events/core.c:4215:27: error: incompatible pointer types initializing 'struct perf_cpu_context *' with an expression of type 'typeof ((typeof (*(&cpu_context)) *)(&cpu_context))' (aka 'unsigned long long (*)(unsigned int, const struct mm_struct *)') [-Werror,-Wincompatible-pointer-types]
struct perf_cpu_context *cpuctx = this_cpu_ptr(&cpu_context);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/events/core.c:4218:29: warning: variable 'task_ctx' set but not used [-Wunused-but-set-variable]
struct perf_event_context *task_ctx = NULL;
^
kernel/events/core.c:4276:27: error: incompatible pointer types initializing 'struct perf_cpu_context *' with an expression of type 'typeof ((typeof (*(&cpu_context)) *)(&cpu_context))' (aka 'unsigned long long (*)(unsigned int, const struct mm_struct *)') [-Werror,-Wincompatible-pointer-types]
struct perf_cpu_context *cpuctx = this_cpu_ptr(&cpu_context);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/events/core.c:4330:9: error: incompatible pointer types assigning to 'struct perf_cpu_context *' from 'typeof ((typeof (*(&cpu_context)) *)(&cpu_context))' (aka 'unsigned long long (*)(unsigned int, const struct mm_struct *)') [-Werror,-Wincompatible-pointer-types]
cpuctx = this_cpu_ptr(&cpu_context);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/events/core.c:4432:27: error: incompatible pointer types initializing 'struct perf_cpu_context *' with an expression of type 'typeof ((typeof (*(&cpu_context)) *)(&cpu_context))' (aka 'unsigned long long (*)(unsigned int, const struct mm_struct *)') [-Werror,-Wincompatible-pointer-types]
struct perf_cpu_context *cpuctx = this_cpu_ptr(&cpu_context);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
vim +/cpu_context +181 kernel/events/core.c
180
> 181 static DEFINE_PER_CPU(struct perf_cpu_context, cpu_context);
182
183 struct perf_event_context *perf_cpu_task_ctx(void)
184 {
185 lockdep_assert_irqs_disabled();
> 186 return this_cpu_ptr(&cpu_context)->task_ctx;
187 }
188
189 /*
190 * On task ctx scheduling...
191 *
192 * When !ctx->nr_events a task context will not be scheduled. This means
193 * we can disable the scheduler hooks (for performance) without leaving
194 * pending task ctx state.
195 *
196 * This however results in two special cases:
197 *
198 * - removing the last event from a task ctx; this is relatively straight
199 * forward and is done in __perf_remove_from_context.
200 *
201 * - adding the first event to a task ctx; this is tricky because we cannot
202 * rely on ctx->is_active and therefore cannot use event_function_call().
203 * See perf_install_in_context().
204 *
205 * If ctx->nr_events, then ctx->is_active and cpuctx->task_ctx are set.
206 */
207
208 typedef void (*event_f)(struct perf_event *, struct perf_cpu_context *,
209 struct perf_event_context *, void *);
210
211 struct event_function_struct {
212 struct perf_event *event;
213 event_f func;
214 void *data;
215 };
216
217 static int event_function(void *info)
218 {
219 struct event_function_struct *efs = info;
220 struct perf_event *event = efs->event;
221 struct perf_event_context *ctx = event->ctx;
> 222 struct perf_cpu_context *cpuctx = this_cpu_ptr(&cpu_context);
223 struct perf_event_context *task_ctx = cpuctx->task_ctx;
224 int ret = 0;
225
226 lockdep_assert_irqs_disabled();
227
228 perf_ctx_lock(cpuctx, task_ctx);
229 /*
230 * Since we do the IPI call without holding ctx->lock things can have
231 * changed, double check we hit the task we set out to hit.
232 */
233 if (ctx->task) {
234 if (ctx->task != current) {
235 ret = -ESRCH;
236 goto unlock;
237 }
238
239 /*
240 * We only use event_function_call() on established contexts,
241 * and event_function() is only ever called when active (or
242 * rather, we'll have bailed in task_function_call() or the
243 * above ctx->task != current test), therefore we must have
244 * ctx->is_active here.
245 */
246 WARN_ON_ONCE(!ctx->is_active);
247 /*
248 * And since we have ctx->is_active, cpuctx->task_ctx must
249 * match.
250 */
251 WARN_ON_ONCE(task_ctx != ctx);
252 } else {
253 WARN_ON_ONCE(&cpuctx->ctx != ctx);
254 }
255
256 efs->func(event, cpuctx, ctx, efs->data);
257 unlock:
258 perf_ctx_unlock(cpuctx, task_ctx);
259
260 return ret;
261 }
262
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (165612 bytes)
Powered by blists - more mailing lists