• Konrad Rzeszutek Wilk's avatar
    [CPUFREQ] powernow-k8: Don't notify of successful transition if we failed (vid case). · a9d3d206
    Konrad Rzeszutek Wilk authored
    Before this patch if we failed the vid transition would still try to
    submit the "new" frequencies to cpufreq.
    That is incorrect - also we could submit a non-existing frequency value
    which would cause cpufreq to crash. The ultimate fix is in cpufreq
    to deal with incorrect values, but this patch improves the error
    recovery in the AMD powernowk8 driver.
    
    The failure that was reported was as follows:
    
    powernow-k8: Found 1 AMD Athlon(tm) 64 Processor 3700+ (1 cpu cores) (version 2.20.00)
    powernow-k8: fid 0x2 (1000 MHz), vid 0x12
    powernow-k8: fid 0xa (1800 MHz), vid 0xa
    powernow-k8: fid 0xc (2000 MHz), vid 0x8
    powernow-k8: fid 0xe (2200 MHz), vid 0x8
    Marking TSC unstable due to cpufreq changes
    powernow-k8: fid trans failed, fid 0x2, curr 0x0
    BUG: unable to handle kernel paging request at ffff880807e07b78
    IP: [<ffffffff81479163>] cpufreq_stats_update+0x46/0x5b
    ...
    
    And transition fails and data->currfid ends up with 0. Since
    the machine does not support 800Mhz value when the calculation is
    done ('find_khz_freq_from_fid(data->currfid);') it reports the
    new frequency as 800000 which is bogus. This patch fixes
    the issue during target setting.
    
    The patch however does not fix the issue in 'powernowk8_cpu_init'
    where the pol->cur can also be set with the 800000 value:
    
              pol->cur = find_khz_freq_from_fid(data->currfid);
      dprintk("policy current frequency %d kHz\n", pol->cur);
    
      /* min/max the cpu is capable of */
      if (cpufreq_frequency_table_cpuinfo(pol, data->powernow_table)) {
    
    The fix for that looks to update cpufreq_frequency_table_cpuinfo to
    check pol->cur.... but that would cause an regression in how the
    acpi-cpufreq driver works (it sets cpu->cur after calling
    cpufreq_frequency_table_cpuinfo). Instead the fix will be to let
    cpufreq gracefully handle bogus data (another patch).
    Acked-by: default avatarBorislav Petkov <bp@alien8.de>
    CC: andre.przywara@amd.com
    CC: Mark.Langsdorf@amd.com
    Reported-by: default avatarTobias Diedrich <ranma+xen@tdiedrich.de>
    Tested-by: default avatarTobias Diedrich <ranma+xen@tdiedrich.de>
    [v1: Rebased on v3.0-rc2, reduced patch to deal with vid case]
    Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Signed-off-by: default avatarDave Jones <davej@redhat.com>
    a9d3d206
powernow-k8.c 40.1 KB