[SRU][wily] Fix KNL Intel P State driver divide by zero

Zhang, Xiong Y xiong.y.zhang at intel.com
Tue Oct 20 08:40:38 UTC 2015


The following commit is from 4.3 kernel which fix devide by zero in intel P state driver on KNL.

commit 8e601a9f97a00bab031980de34f9a81891c1f82f
Author: Srinivas Pandruvada <srinivas.pandruvada at linux.intel.com>
Date:   Thu Oct 15 12:34:21 2015 -0700

    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)
    Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada at linux.intel.com>
    Acked-by: Kristen Carlson Accardi <kristen at linux.intel.com>
    Cc: 4.1+ <stable at vger.kernel.org> # 4.1+
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki at intel.com>

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 3af9dd7..aa33b92 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -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);

thanks

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20151020/d6495a02/attachment.html>


More information about the kernel-team mailing list