Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7caaf4d8 authored by Robert Richter's avatar Robert Richter Committed by Ingo Molnar
Browse files

perf/x86-ibs: Extend hw period that triggers overflow



If the last hw period is too short we might hit the irq handler which
biases the results. Thus try to have a max last period that triggers
the sw overflow.

Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1333390758-10893-10-git-send-email-robert.richter@amd.com


Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent fc006cf7
Loading
Loading
Loading
Loading
+13 −2
Original line number Original line Diff line number Diff line
@@ -85,8 +85,19 @@ perf_event_set_period(struct hw_perf_event *hwc, u64 min, u64 max, u64 *hw_perio
		overflow = 1;
		overflow = 1;
	}
	}


	/*
	 * If the hw period that triggers the sw overflow is too short
	 * we might hit the irq handler. This biases the results.
	 * Thus we shorten the next-to-last period and set the last
	 * period to the max period.
	 */
	if (left > max) {
		left -= max;
		if (left > max)
		if (left > max)
			left = max;
			left = max;
		else if (left < min)
			left = min;
	}


	*hw_period = (u64)left;
	*hw_period = (u64)left;