|
@@ -1222,11 +1222,12 @@ static int h_24x7_event_init(struct perf_event *event)
|
|
return -EACCES;
|
|
return -EACCES;
|
|
}
|
|
}
|
|
|
|
|
|
- /* see if the event complains */
|
|
|
|
|
|
+ /* Get the initial value of the counter for this event */
|
|
if (single_24x7_request(event, &ct)) {
|
|
if (single_24x7_request(event, &ct)) {
|
|
pr_devel("test hcall failed\n");
|
|
pr_devel("test hcall failed\n");
|
|
return -EIO;
|
|
return -EIO;
|
|
}
|
|
}
|
|
|
|
+ (void)local64_xchg(&event->hw.prev_count, ct);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -1289,6 +1290,16 @@ static void h_24x7_event_read(struct perf_event *event)
|
|
h24x7hw = &get_cpu_var(hv_24x7_hw);
|
|
h24x7hw = &get_cpu_var(hv_24x7_hw);
|
|
h24x7hw->events[i] = event;
|
|
h24x7hw->events[i] = event;
|
|
put_cpu_var(h24x7hw);
|
|
put_cpu_var(h24x7hw);
|
|
|
|
+ /*
|
|
|
|
+ * Clear the event count so we can compute the _change_
|
|
|
|
+ * in the 24x7 raw counter value at the end of the txn.
|
|
|
|
+ *
|
|
|
|
+ * Note that we could alternatively read the 24x7 value
|
|
|
|
+ * now and save its value in event->hw.prev_count. But
|
|
|
|
+ * that would require issuing a hcall, which would then
|
|
|
|
+ * defeat the purpose of using the txn interface.
|
|
|
|
+ */
|
|
|
|
+ local64_set(&event->count, 0);
|
|
}
|
|
}
|
|
|
|
|
|
put_cpu_var(hv_24x7_reqb);
|
|
put_cpu_var(hv_24x7_reqb);
|