aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/perf/hv-24x7.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
index b7a9a03ca59d..77b958f213a0 100644
--- a/arch/powerpc/perf/hv-24x7.c
+++ b/arch/powerpc/perf/hv-24x7.c
@@ -1222,11 +1222,12 @@ static int h_24x7_event_init(struct perf_event *event)
1222 return -EACCES; 1222 return -EACCES;
1223 } 1223 }
1224 1224
1225 /* see if the event complains */ 1225 /* Get the initial value of the counter for this event */
1226 if (single_24x7_request(event, &ct)) { 1226 if (single_24x7_request(event, &ct)) {
1227 pr_devel("test hcall failed\n"); 1227 pr_devel("test hcall failed\n");
1228 return -EIO; 1228 return -EIO;
1229 } 1229 }
1230 (void)local64_xchg(&event->hw.prev_count, ct);
1230 1231
1231 return 0; 1232 return 0;
1232} 1233}
@@ -1289,6 +1290,16 @@ static void h_24x7_event_read(struct perf_event *event)
1289 h24x7hw = &get_cpu_var(hv_24x7_hw); 1290 h24x7hw = &get_cpu_var(hv_24x7_hw);
1290 h24x7hw->events[i] = event; 1291 h24x7hw->events[i] = event;
1291 put_cpu_var(h24x7hw); 1292 put_cpu_var(h24x7hw);
1293 /*
1294 * Clear the event count so we can compute the _change_
1295 * in the 24x7 raw counter value at the end of the txn.
1296 *
1297 * Note that we could alternatively read the 24x7 value
1298 * now and save its value in event->hw.prev_count. But
1299 * that would require issuing a hcall, which would then
1300 * defeat the purpose of using the txn interface.
1301 */
1302 local64_set(&event->count, 0);
1292 } 1303 }
1293 1304
1294 put_cpu_var(hv_24x7_reqb); 1305 put_cpu_var(hv_24x7_reqb);