Re: [PATCH v2 1/2] perf/core: Share an event with multiple cgroups

From: kernel test robot
Date: Tue Apr 13 2021 - 05:39:49 EST


Hi Namhyung,

I love your patch! Yet something to improve:

[auto build test ERROR on tip/perf/core]
[also build test ERROR on tip/master linux/master linus/master v5.12-rc7 next-20210412]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Namhyung-Kim/perf-core-Sharing-events-with-multiple-cgroups/20210413-124251
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git cface0326a6c2ae5c8f47bd466f07624b3e348a7
config: powerpc-randconfig-r025-20210413 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9829f5e6b1bca9b61efc629770d28bb9014dec45)
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 powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://github.com/0day-ci/linux/commit/c604a61fb3cfd58be50992c8284b13e598312794
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Namhyung-Kim/perf-core-Sharing-events-with-multiple-cgroups/20210413-124251
git checkout c604a61fb3cfd58be50992c8284b13e598312794
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

>> kernel/events/core.c:3891:32: error: use of undeclared identifier 'cgroup_ctx_list'; did you mean 'cgroup_exit'?
if (!list_empty(this_cpu_ptr(&cgroup_ctx_list)) &&
^~~~~~~~~~~~~~~
cgroup_exit
include/linux/percpu-defs.h:265:39: note: expanded from macro 'this_cpu_ptr'
#define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
^
include/linux/percpu-defs.h:264:38: note: expanded from macro 'raw_cpu_ptr'
#define raw_cpu_ptr(ptr) per_cpu_ptr(ptr, 0)
^
include/linux/percpu-defs.h:263:65: note: expanded from macro 'per_cpu_ptr'
#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
^
include/linux/percpu-defs.h:259:20: note: expanded from macro 'VERIFY_PERCPU_PTR'
__verify_pcpu_ptr(__p); \
^
include/linux/percpu-defs.h:219:47: note: expanded from macro '__verify_pcpu_ptr'
const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
^
include/linux/cgroup.h:130:6: note: 'cgroup_exit' declared here
void cgroup_exit(struct task_struct *p);
^
>> kernel/events/core.c:3891:32: error: use of undeclared identifier 'cgroup_ctx_list'; did you mean 'cgroup_exit'?
if (!list_empty(this_cpu_ptr(&cgroup_ctx_list)) &&
^~~~~~~~~~~~~~~
cgroup_exit
include/linux/percpu-defs.h:265:39: note: expanded from macro 'this_cpu_ptr'
#define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
^
include/linux/percpu-defs.h:264:38: note: expanded from macro 'raw_cpu_ptr'
#define raw_cpu_ptr(ptr) per_cpu_ptr(ptr, 0)
^
include/linux/percpu-defs.h:263:65: note: expanded from macro 'per_cpu_ptr'
#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
^
include/linux/percpu-defs.h:260:12: note: expanded from macro 'VERIFY_PERCPU_PTR'
(typeof(*(__p)) __kernel __force *)(__p); \
^
include/linux/cgroup.h:130:6: note: 'cgroup_exit' declared here
void cgroup_exit(struct task_struct *p);
^
>> kernel/events/core.c:3891:32: error: use of undeclared identifier 'cgroup_ctx_list'; did you mean 'cgroup_exit'?
if (!list_empty(this_cpu_ptr(&cgroup_ctx_list)) &&
^~~~~~~~~~~~~~~
cgroup_exit
include/linux/percpu-defs.h:265:39: note: expanded from macro 'this_cpu_ptr'
#define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
^
include/linux/percpu-defs.h:264:38: note: expanded from macro 'raw_cpu_ptr'
#define raw_cpu_ptr(ptr) per_cpu_ptr(ptr, 0)
^
include/linux/percpu-defs.h:263:65: note: expanded from macro 'per_cpu_ptr'
#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
^
include/linux/percpu-defs.h:260:38: note: expanded from macro 'VERIFY_PERCPU_PTR'
(typeof(*(__p)) __kernel __force *)(__p); \
^
include/linux/cgroup.h:130:6: note: 'cgroup_exit' declared here
void cgroup_exit(struct task_struct *p);
^
>> kernel/events/core.c:3891:18: error: incompatible pointer types passing 'typeof (*(&cgroup_exit)) *' (aka 'void (*)(struct task_struct *)') to parameter of type 'const struct list_head *' [-Werror,-Wincompatible-pointer-types]
if (!list_empty(this_cpu_ptr(&cgroup_ctx_list)) &&
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/percpu-defs.h:265:27: note: expanded from macro 'this_cpu_ptr'
#define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
^~~~~~~~~~~~~~~~
include/linux/percpu-defs.h:264:26: note: expanded from macro 'raw_cpu_ptr'
#define raw_cpu_ptr(ptr) per_cpu_ptr(ptr, 0)
^~~~~~~~~~~~~~~~~~~
include/linux/percpu-defs.h:263:31: note: expanded from macro 'per_cpu_ptr'
#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:280:54: note: passing argument to parameter 'head' here
static inline int list_empty(const struct list_head *head)
^
>> kernel/events/core.c:3892:6: error: implicit declaration of function 'perf_cgroup_from_task' [-Werror,-Wimplicit-function-declaration]
perf_cgroup_from_task(task, NULL) !=
^
kernel/events/core.c:3892:6: note: did you mean 'perf_cgroup_match'?
kernel/events/core.c:1057:1: note: 'perf_cgroup_match' declared here
perf_cgroup_match(struct perf_event *event)
^
>> kernel/events/core.c:5955:10: error: too many arguments to function call, expected 3, have 4
(char __user *)(arg + 16));
^~~~~~~~~~~~~~~~~~~~~~~~~
kernel/events/core.c:2437:19: note: 'perf_event_read_cgroup_node' declared here
static inline int perf_event_read_cgroup_node(struct perf_event *event,
^
kernel/events/core.c:6981:6: warning: no previous prototype for function 'perf_pmu_snapshot_aux' [-Wmissing-prototypes]
long perf_pmu_snapshot_aux(struct perf_buffer *rb,
^
kernel/events/core.c:6981:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
long perf_pmu_snapshot_aux(struct perf_buffer *rb,
^
static
1 warning and 6 errors generated.


vim +3891 kernel/events/core.c

3851
3852 static void perf_event_switch(struct task_struct *task,
3853 struct task_struct *next_prev, bool sched_in);
3854
3855 #define for_each_task_context_nr(ctxn) \
3856 for ((ctxn) = 0; (ctxn) < perf_nr_task_contexts; (ctxn)++)
3857
3858 /*
3859 * Called from scheduler to remove the events of the current task,
3860 * with interrupts disabled.
3861 *
3862 * We stop each event and update the event value in event->count.
3863 *
3864 * This does not protect us against NMI, but disable()
3865 * sets the disabled bit in the control field of event _before_
3866 * accessing the event control register. If a NMI hits, then it will
3867 * not restart the event.
3868 */
3869 void __perf_event_task_sched_out(struct task_struct *task,
3870 struct task_struct *next)
3871 {
3872 int ctxn;
3873
3874 if (__this_cpu_read(perf_sched_cb_usages))
3875 perf_pmu_sched_task(task, next, false);
3876
3877 if (atomic_read(&nr_switch_events))
3878 perf_event_switch(task, next, false);
3879
3880 for_each_task_context_nr(ctxn)
3881 perf_event_context_sched_out(task, ctxn, next);
3882
3883 /*
3884 * if cgroup events exist on this CPU, then we need
3885 * to check if we have to switch out PMU state.
3886 * cgroup event are system-wide mode only
3887 */
3888 if (atomic_read(this_cpu_ptr(&perf_cgroup_events)))
3889 perf_cgroup_sched_out(task, next);
3890
> 3891 if (!list_empty(this_cpu_ptr(&cgroup_ctx_list)) &&
> 3892 perf_cgroup_from_task(task, NULL) !=
3893 perf_cgroup_from_task(next, NULL))
3894 cgroup_node_sched_out(task);
3895 }
3896

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip