powerpc/perf: Fix pmu_count to count only nest imc pmus
authorMadhavan Srinivasan <maddy@linux.vnet.ibm.com>
Wed, 22 Nov 2017 05:15:38 +0000 (10:45 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Dec 2017 08:53:06 +0000 (09:53 +0100)
[ Upstream commit de34787f1096cce38e2590be0013b44418d14546 ]

"pmu_count" in opal_imc_counters_probe() is intended to hold
the number of successful nest imc pmu registerations. But
current code also counts other imc units like core_imc and
thread_imc. Patch add a check to count only nest imc pmus.

Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/platforms/powernv/opal-imc.c

index 21f6531fae20fc1e010f499923cde964540b895a..b150f4deaccfc5f153e6c3527579b9dc288cdab3 100644 (file)
@@ -191,8 +191,10 @@ static int opal_imc_counters_probe(struct platform_device *pdev)
                        break;
                }
 
-               if (!imc_pmu_create(imc_dev, pmu_count, domain))
-                       pmu_count++;
+               if (!imc_pmu_create(imc_dev, pmu_count, domain)) {
+                       if (domain == IMC_DOMAIN_NEST)
+                               pmu_count++;
+               }
        }
 
        return 0;