Skip to contentSkip to conversation

powerpc/perf: Fix usage of nest_imc_refc

PATCH Applied Madhavan Srinivasan 2 participants 2 messages Aug 16, 2017 – Aug 18, 2017 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/perf: Fix usage of nest_imc_refc

nest_imc_refc is a reference count struct,
used to track number of active perf sessions
using the nest units.

It is preferred to access nest_imc_refc using
per-cpu pointer 'local_nest_imc_refc'. Since,
nest_imc_refc is not initialized using node_id
as array index. Patch to fix the same.

Fixes 885dcd709ba91 ('powerpc/perf: Add nest IMC PMU support')
---
 arch/powerpc/perf/imc-pmu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/perf/imc-pmu.c +2 -2
index a8f95f96d54b..9ccac86f3463 100644
@@ -404,7 +404,7 @@ static void nest_imc_counters_release(struct perf_event *event)
 		rc = opal_imc_counters_stop(OPAL_IMC_COUNTERS_NEST,
 					    get_hard_smp_processor_id(event->cpu));
 		if (rc) {
-			mutex_unlock(&nest_imc_refc[node_id].lock);
+			mutex_unlock(&ref->lock);
 			pr_err("nest-imc: Unable to stop the counters for core %d\n", node_id);
 			return;
 		}
@@ -487,7 +487,7 @@ static int nest_imc_event_init(struct perf_event *event)
 		rc = opal_imc_counters_start(OPAL_IMC_COUNTERS_NEST,
 					     get_hard_smp_processor_id(event->cpu));
 		if (rc) {
-			mutex_unlock(&nest_imc_refc[node_id].lock);
+			mutex_unlock(&ref->lock);
 			pr_err("nest-imc: Unable to start the counters for node %d\n",
 									node_id);
 			return rc;
Signature · 1 line
2.7.4
#1 lore raw
Quoted 4 lines · Madhavan Srinivasan

nest_imc_refc is a reference count struct,
used to track number of active perf sessions
using the nest units.

Quoted 8 lines

It is preferred to access nest_imc_refc using
per-cpu pointer 'local_nest_imc_refc'. Since,
nest_imc_refc is not initialized using node_id
as array index. Patch to fix the same.

Fixes 885dcd709ba91 ('powerpc/perf: Add nest IMC PMU support')

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/711bd207a233141308d0aea0d2e286

cheers