public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, mark.langsdorf@amd.com
Subject: Re: [PATCH] Warn of incorrect cpu_khz on AMD systems
Date: Thu, 06 Nov 2008 08:42:50 -0500	[thread overview]
Message-ID: <4912F45A.9000505@redhat.com> (raw)
In-Reply-To: <20081106090118.GC4890@elte.hu>


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

Yes, I noticed that too -- it's really the crux of the problem.  If 
no_ctr_free is a last resort boot option.  But I wonder if it should 
exist at all.

I was originally thinking the system should just stop booting if 
no_ctr_free and panic() ... and I'm willing to make that patch.

The likelihood of hitting this is low, below .0125% of the time.  But 
when it does hit, it is nasty and difficult to diagnose.
The last thing that I thought could be wrong was that cpu_khz was busted.

> 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.
>
>   

Will do -- but do you think a panic() is more appropriate?

P.

> 	Ingo
>   

  reply	other threads:[~2008-11-06 13:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-04 15:27 [PATCH] Warn of incorrect cpu_khz on AMD systems Prarit Bhargava
2008-11-06  9:01 ` Ingo Molnar
2008-11-06 13:42   ` Prarit Bhargava [this message]
2008-11-12 18:35   ` Prarit Bhargava
2008-11-12 18:54     ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4912F45A.9000505@redhat.com \
    --to=prarit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.langsdorf@amd.com \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox