lkml.org 
[lkml]   [2008]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Warn of incorrect cpu_khz on AMD systems

* Prarit Bhargava <prarit@redhat.com> wrote:

> If none of the perfctrs are free when calculating cpu_khz we default
> to using ctr 3 (ie, we just choose 3). This may lead to an
> incorrect tsc freq value which can cause the system to be unstable.
>
> To aid in future debugging, WARN the user of a potential problem.

oh, nasty... when can this happen - are you using nmi_watchdog=2?

Cannot we avoid this situation somehow? The calibrate_cpu() function
is quite ugly and does a dangerous thing by ignoring the reservation.

This whole sequence is sloppy:

for (i = 0; i < 4; i++)
if (avail_to_resrv_perfctr_nmi_bit(i))
break;
no_ctr_free = (i == 4);
if (no_ctr_free) {
i = 3;
rdmsrl(MSR_K7_EVNTSEL3, evntsel3);
wrmsrl(MSR_K7_EVNTSEL3, 0);
rdmsrl(MSR_K7_PERFCTR3, pmc3);
} else {
reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i);
reserve_evntsel_nmi(MSR_K7_EVNTSEL0 + i);
}

> no_ctr_free = (i == 4);
> if (no_ctr_free) {
> + printk(KERN_WARN "Warning: AMD perfctrs busy ... "
> + "cpu_khz value may be incorrect.\n");

also, please use a WARN() instead so that kerneloops.org picks it up.

Ingo


\
 
 \ /
  Last update: 2008-11-06 10:03    [W:0.071 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site