linux/arch/powerpc/perf
Madhavan Srinivasan 7ecb37f62f powerpc/perf: Fix core-imc hotplug callback failure during imc initialization
Call trace observed during boot:

  nest_capp0_imc performance monitor hardware support registered
  nest_capp1_imc performance monitor hardware support registered
  core_imc memory allocation for cpu 56 failed
  Unable to handle kernel paging request for data at address 0xffa400010
  Faulting instruction address: 0xc000000000bf3294
  0:mon> e
  cpu 0x0: Vector: 300 (Data Access) at [c000000ff38ff8d0]
      pc: c000000000bf3294: mutex_lock+0x34/0x90
      lr: c000000000bf3288: mutex_lock+0x28/0x90
      sp: c000000ff38ffb50
     msr: 9000000002009033
     dar: ffa400010
   dsisr: 80000
    current = 0xc000000ff383de00
    paca    = 0xc000000007ae0000	 softe: 0	 irq_happened: 0x01
      pid   = 13, comm = cpuhp/0
  Linux version 4.11.0-39.el7a.ppc64le (mockbuild@ppc-058.build.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Tue Oct 3 07:42:44 EDT 2017
  0:mon> t
  [c000000ff38ffb80] c0000000002ddfac perf_pmu_migrate_context+0xac/0x470
  [c000000ff38ffc40] c00000000011385c ppc_core_imc_cpu_offline+0x1ac/0x1e0
  [c000000ff38ffc90] c000000000125758 cpuhp_invoke_callback+0x198/0x5d0
  [c000000ff38ffd00] c00000000012782c cpuhp_thread_fun+0x8c/0x3d0
  [c000000ff38ffd60] c0000000001678d0 smpboot_thread_fn+0x290/0x2a0
  [c000000ff38ffdc0] c00000000015ee78 kthread+0x168/0x1b0
  [c000000ff38ffe30] c00000000000b368 ret_from_kernel_thread+0x5c/0x74

While registering the cpuhoplug callbacks for core-imc, if we fails
in the cpuhotplug online path for any random core (either because opal call to
initialize the core-imc counters fails or because memory allocation fails for
that core), ppc_core_imc_cpu_offline() will get invoked for other cpus who
successfully returned from cpuhotplug online path.

But in the ppc_core_imc_cpu_offline() path we are trying to migrate the event
context, when core-imc counters are not even initialized. Thus creating the
above stack dump.

Add a check to see if core-imc counters are enabled or not in the cpuhotplug
offline path before migrating the context to handle this failing scenario.

Fixes: 885dcd709b ("powerpc/perf: Add nest IMC PMU support")
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2017-11-03 09:38:05 +11:00
..
req-gen powerpc/perf/{hv-gpci, hv-common}: generate requests with counters annotated 2015-02-02 17:56:39 +11:00
8xx-pmu.c powerpc/8xx: Perf events on PPC 8xx 2017-01-26 17:49:34 -06:00
bhrb.S powerpc/perf: Add basic assembly code to read BHRB entries on POWER8 2013-04-26 16:11:11 +10:00
callchain.c powerpc/mm: Rename find_linux_pte_or_hugepte() 2017-08-17 23:13:46 +10:00
core-book3s.c powerpc/sysrq: Fix oops whem ppmu is not registered 2017-09-20 13:30:09 +10:00
core-fsl-emb.c perf/powerpc: reset event hw state when adding it to the PMU 2015-01-29 23:44:18 -06:00
e500-pmu.c powerpc/perf: Add stalled-cycles events 2013-01-10 17:00:56 +11:00
e6500-pmu.c powerpc/perf: Add e6500 PMU driver 2013-08-07 18:38:04 -05:00
hv-24x7-catalog.h powerpc/perf/hv-24x7: parse catalog and populate sysfs with events 2015-02-02 17:56:38 +11:00
hv-24x7-domains.h powerpc/perf/hv-24x7: parse catalog and populate sysfs with events 2015-02-02 17:56:38 +11:00
hv-24x7.c powerpc/perf/hv-24x7: Aggregate result elements on POWER9 SMT8 2017-07-02 20:40:33 +10:00
hv-24x7.h powerpc/perf/hv-24x7: Support v2 of the hypervisor API 2017-07-02 20:40:33 +10:00
hv-common.c powerpc/perf/{hv-gpci, hv-common}: generate requests with counters annotated 2015-02-02 17:56:39 +11:00
hv-common.h perf: define EVENT_DEFINE_RANGE_FORMAT_LITE helper 2015-02-02 17:56:38 +11:00
hv-gpci-requests.h powerpc/perf/hv-gpci: add the remaining gpci requests 2015-02-02 17:56:39 +11:00
hv-gpci.c powerpc/sparse: Make a bunch of things static 2016-09-13 17:35:47 +10:00
hv-gpci.h powerpc/perf/{hv-gpci, hv-common}: generate requests with counters annotated 2015-02-02 17:56:39 +11:00
imc-pmu.c powerpc/perf: Fix core-imc hotplug callback failure during imc initialization 2017-11-03 09:38:05 +11:00
isa207-common.c powerpc/perf: Factor out PPMU_ONLY_COUNT_RUN check code from power8 2017-08-10 22:30:05 +10:00
isa207-common.h powerpc/perf: Factor out PPMU_ONLY_COUNT_RUN check code from power8 2017-08-10 22:30:05 +10:00
Makefile powerpc/perf: Add nest IMC PMU support 2017-07-25 22:55:45 +10:00
mpc7450-pmu.c powerpc/perf: Pass the struct perf_events down to compute_mmcr() 2014-07-28 14:30:47 +10:00
perf_regs.c powerpc/perf: Fix oops when kthread execs user process 2017-06-16 21:02:46 +10:00
power4-pmu.c powerpc/perf: Pass the struct perf_events down to compute_mmcr() 2014-07-28 14:30:47 +10:00
power5+-pmu.c powerpc/perf: Pass the struct perf_events down to compute_mmcr() 2014-07-28 14:30:47 +10:00
power5-pmu.c powerpc/perf: Pass the struct perf_events down to compute_mmcr() 2014-07-28 14:30:47 +10:00
power6-pmu.c powerpc/perf: Pass the struct perf_events down to compute_mmcr() 2014-07-28 14:30:47 +10:00
power7-events-list.h powerpc/perf: Make some new raw event codes available in sysfs 2014-03-24 09:48:23 +11:00
power7-pmu.c powerpc/sparse: Make a bunch of things static 2016-09-13 17:35:47 +10:00
power8-events-list.h powerpc/perf: Add Power8 mem_access event to sysfs 2017-04-19 20:00:23 +10:00
power8-pmu.c powerpc/perf: Factor out PPMU_ONLY_COUNT_RUN check code from power8 2017-08-10 22:30:05 +10:00
power9-events-list.h powerpc/perf: Cleanup of PM_BR_CMPL vs. PM_BRU_CMPL in Power9 event list 2017-08-10 22:30:06 +10:00
power9-pmu.c powerpc/perf: Cleanup of PM_BR_CMPL vs. PM_BRU_CMPL in Power9 event list 2017-08-10 22:30:06 +10:00
ppc970-pmu.c powerpc/perf: Pass the struct perf_events down to compute_mmcr() 2014-07-28 14:30:47 +10:00