Unverified Commit e184a607 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!12016 perf/x86/intel: Limit the period on Haswell

parents e1fcb05e a47808bd
Loading
Loading
Loading
Loading
+21 −2
Original line number Diff line number Diff line
@@ -4520,6 +4520,25 @@ static enum hybrid_cpu_type adl_get_hybrid_cpu_type(void)
	return HYBRID_INTEL_CORE;
}

static inline bool erratum_hsw11(struct perf_event *event)
{
	return (event->hw.config & INTEL_ARCH_EVENT_MASK) ==
		X86_CONFIG(.event=0xc0, .umask=0x01);
}

/*
 * The HSW11 requires a period larger than 100 which is the same as the BDM11.
 * A minimum period of 128 is enforced as well for the INST_RETIRED.ALL.
 *
 * The message 'interrupt took too long' can be observed on any counter which
 * was armed with a period < 32 and two events expired in the same NMI.
 * A minimum period of 32 is enforced for the rest of the events.
 */
static void hsw_limit_period(struct perf_event *event, s64 *left)
{
	*left = max(*left, erratum_hsw11(event) ? 128 : 32);
}

/*
 * Broadwell:
 *
@@ -4537,8 +4556,7 @@ static enum hybrid_cpu_type adl_get_hybrid_cpu_type(void)
 */
static void bdw_limit_period(struct perf_event *event, s64 *left)
{
	if ((event->hw.config & INTEL_ARCH_EVENT_MASK) ==
			X86_CONFIG(.event=0xc0, .umask=0x01)) {
	if (erratum_hsw11(event)) {
		if (*left < 128)
			*left = 128;
		*left &= ~0x3fULL;
@@ -6598,6 +6616,7 @@ __init int intel_pmu_init(void)

		x86_pmu.hw_config = hsw_hw_config;
		x86_pmu.get_event_constraints = hsw_get_event_constraints;
		x86_pmu.limit_period = hsw_limit_period;
		x86_pmu.lbr_double_abort = true;
		extra_attr = boot_cpu_has(X86_FEATURE_RTM) ?
			hsw_format_attr : nhm_format_attr;