tree:
https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git perf/core
head: a918097a296b40b4e4f7a75edf4380a293b84eb5
commit: a918097a296b40b4e4f7a75edf4380a293b84eb5 [10/10] perf: Fix task context PMU for
Hetero
config: x86_64-randconfig-a002-20210622 (attached as .config)
compiler: clang version 13.0.0 (
https://github.com/llvm/llvm-project
b3634d3e88b7f26534a5057bff182b7dced584fc)
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 x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
#
https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?...
git remote add peterz-queue
https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git
git fetch --no-tags peterz-queue perf/core
git checkout a918097a296b40b4e4f7a75edf4380a293b84eb5
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
> kernel/events/core.c:3831:19: warning: variable 'cpuctx'
is uninitialized when used here [-Wuninitialized]
pmu = ctx->pmu =
cpuctx->ctx.pmu;
^~~~~~
kernel/events/core.c:3824:33: note: initialize the variable 'cpuctx' to silence
this warning
struct perf_cpu_context *cpuctx;
^
= NULL
kernel/events/core.c:1097:1: warning: unused function 'perf_cgroup_switch'
[-Wunused-function]
perf_cgroup_switch(struct task_struct *task, struct task_struct *next)
^
2 warnings generated.
vim +/cpuctx +3831 kernel/events/core.c
3820
3821 static void perf_event_context_sched_in(struct perf_event_context *ctx,
3822 struct task_struct *task)
3823 {
3824 struct perf_cpu_context *cpuctx;
3825 struct pmu *pmu;
3826
3827 /*
3828 * HACK: for HETEROGENEOUS the task context might have switched to a
3829 * different PMU, force (re)set the context,
3830 */
3831 pmu = ctx->pmu = cpuctx->ctx.pmu;
3832
3833 cpuctx = __get_cpu_context(ctx);
3834 if (cpuctx->task_ctx == ctx) {
3835 if (cpuctx->sched_cb_usage)
3836 __perf_pmu_sched_task(cpuctx, true);
3837 return;
3838 }
3839
3840 perf_ctx_lock(cpuctx, ctx);
3841 /*
3842 * We must check ctx->nr_events while holding ctx->lock, such
3843 * that we serialize against perf_install_in_context().
3844 */
3845 if (!ctx->nr_events)
3846 goto unlock;
3847
3848 perf_pmu_disable(pmu);
3849 /*
3850 * We want to keep the following priority order:
3851 * cpu pinned (that don't need to move), task pinned,
3852 * cpu flexible, task flexible.
3853 *
3854 * However, if task's ctx is not carrying any pinned
3855 * events, no need to flip the cpuctx's events around.
3856 */
3857 if (!RB_EMPTY_ROOT(&ctx->pinned_groups.tree))
3858 cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE);
3859 perf_event_sched_in(cpuctx, ctx, task);
3860
3861 if (cpuctx->sched_cb_usage && pmu->sched_task)
3862 pmu->sched_task(cpuctx->task_ctx, true);
3863
3864 perf_pmu_enable(pmu);
3865
3866 unlock:
3867 perf_ctx_unlock(cpuctx, ctx);
3868 }
3869
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org