Skip to contentSkip to conversation

KNL divide by zero

PATCH New Srinivas Pandruvada 3 participants 4 messages Oct 15, 2015

Subsystems (2)
lore
Share & tools
lore

Srinivas Pandruvada

author maintainer
#0 lore raw

PATCH 1/1 KNL divide by zero

v1:
Fix bug for not reenabling interrupts

v0:
base version

Srinivas Pandruvada (1):
cpufreq: intel_pstate: divide by zero on Knights Landing (KNL)

 drivers/cpufreq/intel_pstate.c | 5 +++++
 1 file changed, 5 insertions(+)
Signature · 1 line
1.9.3
author maintainer
#1 lore raw

PATCH 1/1 cpufreq: intel_pstate: 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.

---
 drivers/cpufreq/intel_pstate.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/cpufreq/intel_pstate.c +5 -0
index 3af9dd7..aa33b92 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);
 
Signature · 1 line
1.9.3
#2 lore raw

Re: [PATCH v1] cpufreq: intel_pstate: divide by zero on Knights Landing (KNL)

Quoted 6 lines · Srinivas Pandruvada

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.

Applied.

I've also marked it for 4.1.y-stable (and later).

Kristen, please let me know if there are any concerns regarding this one.

Thanks,
Rafael

Acked-by on v1 1/1
#3 lore raw

Re: [PATCH v1] cpufreq: intel_pstate: divide by zero on Knights Landing (KNL)

In reply to Srinivas Pandruvada
Quoted 16 lines · On Thu, 15 Oct 2015 12:34:21 -0700 Srinivas Pandruvada…

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.

---
 drivers/cpufreq/intel_pstate.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/cpufreq/intel_pstate.c +0 -0
index 3af9dd7..aa33b92 100644
@@ -776,6 +776,11 @@ static inline void intel_pstate_sample(struct cpudata *cpu)
 	local_irq_save(flags);

drivers/cpufreq/intel_pstate.c static inline void intel_pstate_sample(struct cpudata *cpu) · line 786

Quoted 10 lines
drivers/cpufreq/intel_pstate.c +5 -0
 	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);