All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Prarit Bhargava <prarit@redhat.com>
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, 6 Nov 2008 10:01:18 +0100	[thread overview]
Message-ID: <20081106090118.GC4890@elte.hu> (raw)
In-Reply-To: <20081104152720.9964.71959.sendpatchset@prarit.bos.redhat.com>


* 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

  reply	other threads:[~2008-11-06  9:01 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 [this message]
2008-11-06 13:42   ` Prarit Bhargava
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=20081106090118.GC4890@elte.hu \
    --to=mingo@elte.hu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.langsdorf@amd.com \
    --cc=prarit@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.