|
@@ -169,8 +169,14 @@ armpmu_event_set_period(struct perf_event *event,
|
|
ret = 1;
|
|
ret = 1;
|
|
}
|
|
}
|
|
|
|
|
|
- if (left > (s64)armpmu->max_period)
|
|
|
|
- left = armpmu->max_period;
|
|
|
|
|
|
+ /*
|
|
|
|
+ * Limit the maximum period to prevent the counter value
|
|
|
|
+ * from overtaking the one we are about to program. In
|
|
|
|
+ * effect we are reducing max_period to account for
|
|
|
|
+ * interrupt latency (and we are being very conservative).
|
|
|
|
+ */
|
|
|
|
+ if (left > (armpmu->max_period >> 1))
|
|
|
|
+ left = armpmu->max_period >> 1;
|
|
|
|
|
|
local64_set(&hwc->prev_count, (u64)-left);
|
|
local64_set(&hwc->prev_count, (u64)-left);
|
|
|
|
|