Skip to contentSkip to conversation

FAILED: patch "[PATCH] cpufreq: intel_pstate: Fix divide by zero on Knights Landing" failed to apply to 4.1-stable tree

PATCH [email protected] 1 participant 1 message Oct 23, 2015

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 8e601a9f97a00bab031980de34f9a81891c1f82f Mon Sep 17 00:00:00 2001

From: Srinivas Pandruvada <[email protected]>
Date: Thu, 15 Oct 2015 12:34:21 -0700
Subject: [PATCH] cpufreq: intel_pstate: Fix divide by zero on Knights Landing
(KNL)

This is a workaround for KNL platform, where in some cases MPERF counter will not have updated value before next read of MSR_IA32_MPERF. In this case divide by zero will occur. This change ignores current sample for busy calculation in this case.

Fixes b34ef932d79a (intel_pstate: Knights Landing support)
Cc 4.1+ <[email protected]> # 4.1+
drivers/cpufreq/intel_pstate.c +5 -0
index 3af9dd7332e6..aa33b92b3e3e 100644
@@ -776,6 +776,11 @@ static inline void intel_pstate_sample(struct cpudata *cpu)
 	local_irq_save(flags);
 	rdmsrl(MSR_IA32_APERF, aperf);
 	rdmsrl(MSR_IA32_MPERF, mperf);
+	if (cpu->prev_mperf == mperf) {
+		local_irq_restore(flags);
+		return;
+	}
+
 	tsc = rdtsc();
 	local_irq_restore(flags);