mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephane Eranian <eranian@hpl.hp.com>
To: Daniel Walker <dwalker@mvista.com>
Cc: B.Steinbrink@gmx.de, ak@suse.de, linux-kernel@vger.kernel.org,
	akpm@linux-foundation.org, Stephane Eranian <eranian@hpl.hp.com>
Subject: Re: nmi_watchdog=2 regression in 2.6.21
Date: Fri, 31 Aug 2007 09:21:46 -0700	[thread overview]
Message-ID: <20070831162146.GD7161@frankl.hpl.hp.com> (raw)
In-Reply-To: <1188571401.26038.41.camel@dhcp193.mvista.com>

[-- Attachment #1: Type: text/plain, Size: 1184 bytes --]

Daniel,

On Fri, Aug 31, 2007 at 07:43:20AM -0700, Daniel Walker wrote:
> On Thu, 2007-08-30 at 14:05 -0700, Stephane Eranian wrote:
> > Daniel,
> 
> > Yes, I realized I missed a small detail in the switch statement.
> > Could you try the new version?
> 
> This patch still has the stuck NMI .. Essentially the same thing that
> happened without the patch..
> 
Ok, looks like deaulting to P6 does not quite work.

Here is a new version. This time I used a different approach.
I am must admit I am a bit puzzled by the duplication of information
between the wd_ops and the nmi_watchdog_ctlblk structure. My understanding
is that thelater is used as a cache for the info that needs to be per-cpu.

The wd_ops provides the MSR to use for the counter, yet all the setup_*()
routines hardcode the MSR. Not sure why?

In this patch, the setup_*() routine now extract the MSR from the wd_ops
to copy them into the nmi_watchdog_ctlblk. This is not done for P4 because
of the special and ugly case of HT. 

With this approach, we can now create a custom wd_ops for CoreDuo that is
a clone of the intel_arch_wd_ops, except for the MSR.

Could you try this one instead?

Thanks.

-- 

-Stephane

[-- Attachment #2: coreduo3.diff --]
[-- Type: text/plain, Size: 2070 bytes --]

diff --git a/arch/i386/kernel/cpu/perfctr-watchdog.c b/arch/i386/kernel/cpu/perfctr-watchdog.c
index 9b5d6af..f9066e1 100644
--- a/arch/i386/kernel/cpu/perfctr-watchdog.c
+++ b/arch/i386/kernel/cpu/perfctr-watchdog.c
@@ -271,8 +271,8 @@ static int setup_k7_watchdog(unsigned nmi_hz)
 	unsigned int evntsel;
 	struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk);
 
-	perfctr_msr = MSR_K7_PERFCTR0;
-	evntsel_msr = MSR_K7_EVNTSEL0;
+	perfctr_msr = wd_ops->perfctr;
+	evntsel_msr = wd_ops->evntsel;
 
 	wrmsrl(perfctr_msr, 0UL);
 
@@ -351,8 +351,8 @@ static int setup_p6_watchdog(unsigned nmi_hz)
 	unsigned int evntsel;
 	struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk);
 
-	perfctr_msr = MSR_P6_PERFCTR0;
-	evntsel_msr = MSR_P6_EVNTSEL0;
+	perfctr_msr = wd_ops->perfctr;
+	evntsel_msr = wd_ops->evntsel;
 
 	/* KVM doesn't implement this MSR */
 	if (wrmsr_safe(perfctr_msr, 0, 0) < 0)
@@ -577,8 +577,8 @@ static int setup_intel_arch_watchdog(unsigned nmi_hz)
 	    (ebx & ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT))
 		return 0;
 
-	perfctr_msr = MSR_ARCH_PERFMON_PERFCTR1;
-	evntsel_msr = MSR_ARCH_PERFMON_EVENTSEL1;
+	perfctr_msr = wd_ops->perfctr;
+	evntsel_msr = wd_ops->evntsel;
 
 	wrmsrl(perfctr_msr, 0UL);
 
@@ -613,6 +613,16 @@ static struct wd_ops intel_arch_wd_ops = {
 	.evntsel = MSR_ARCH_PERFMON_EVENTSEL1,
 };
 
+static struct wd_ops coreduo_wd_ops = {
+	.reserve = single_msr_reserve,
+	.unreserve = single_msr_unreserve,
+	.setup = setup_intel_arch_watchdog,
+	.rearm = p6_rearm,
+	.stop = single_msr_stop_watchdog,
+	.perfctr = MSR_ARCH_PERFMON_PERFCTR0,
+	.evntsel = MSR_ARCH_PERFMON_EVENTSEL0,
+};
+
 static void probe_nmi_watchdog(void)
 {
 	switch (boot_cpu_data.x86_vendor) {
@@ -623,6 +633,10 @@ static void probe_nmi_watchdog(void)
 		wd_ops = &k7_wd_ops;
 		break;
 	case X86_VENDOR_INTEL:
+		if (boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 14) {
+			wd_ops = &coreduo_wd_ops;
+			break;
+		}
 		if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) {
 			wd_ops = &intel_arch_wd_ops;
 			break;

  reply	other threads:[~2007-08-31 16:22 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-08  0:06 Daniel Walker
2007-08-08 14:20 ` Björn Steinbrink
2007-08-08 15:20   ` Daniel Walker
2007-08-20 16:44   ` Daniel Walker
2007-08-23 20:08     ` Michal Piotrowski
2007-08-23 21:22       ` Daniel Walker
2007-08-27  0:45         ` Who wants to maintain KR list for stable releases? (was Re: nmi_watchdog=2 regression in 2.6.21) Michal Piotrowski
2007-08-27  7:51           ` Andrew Morton
2007-08-27  9:41             ` Jeff Garzik
2007-08-27 11:35               ` Michal Piotrowski
2007-08-27 16:09               ` Adrian Bunk
2007-08-27 16:05                 ` Daniel Walker
2007-08-27 11:38             ` Michal Piotrowski
2007-08-27 12:35               ` Rafael J. Wysocki
2007-08-27 15:02                 ` Michal Piotrowski
2007-08-27 15:13               ` Daniel Walker
2007-08-27 15:26                 ` Michal Piotrowski
2007-08-27 15:39                   ` Daniel Walker
2007-08-27 17:02                     ` Michal Piotrowski
2007-08-27 17:17                       ` Daniel Walker
2007-08-27 19:12                     ` David Rees
2007-08-29  7:42                       ` Natalie Protasevich
2007-08-29 22:23                         ` Adrian Bunk
2007-08-29 23:59                           ` Natalie Protasevich
2007-08-30  8:51                             ` Adrian Bunk
2007-08-30 15:24                             ` Who wants to maintain KR list for stable releases? Stefan Richter
     [not found]                               ` <32209efe0708300950r5787402l4d02cedd862314fd@mail.gmail.com>
2007-08-30 22:11                                 ` Al Boldi
2007-09-03 12:29                               ` Adrian Bunk
2007-09-03 13:20                                 ` Stefan Richter
2007-08-30 15:54                           ` Who wants to maintain KR list for stable releases? (was Re: nmi_watchdog=2 regression in 2.6.21) Bill Davidsen
2007-09-03 12:43                             ` Adrian Bunk
2007-08-27 16:26             ` Daniel Walker
2007-08-27 16:44               ` Andrew Morton
2007-08-27 16:52                 ` Adrian Bunk
2007-08-27 17:08                 ` Daniel Walker
2007-08-27 18:26                   ` Andrew Morton
2007-08-27  8:11           ` David Rees
2007-08-27 11:42             ` Michal Piotrowski
2007-08-27 14:39           ` Daniel Walker
2007-08-27 15:11             ` Michal Piotrowski
2007-08-27 17:54   ` nmi_watchdog=2 regression in 2.6.21 Stephane Eranian
2007-08-27 17:55     ` Daniel Walker
2007-08-27 22:55       ` Stephane Eranian
2007-08-27 23:07         ` Daniel Walker
2007-08-28  9:12           ` Stephane Eranian
2007-08-28 14:34             ` Daniel Walker
2007-08-28 17:05               ` Stephane Eranian
2007-08-28 18:30                 ` Daniel Walker
2007-08-28 19:46                   ` Stephane Eranian
2007-08-28 20:13                     ` Daniel Walker
2007-08-29 21:24                       ` Stephane Eranian
2007-08-30  1:21                         ` Daniel Walker
2007-08-30 21:05                           ` Stephane Eranian
2007-08-31 14:43                             ` Daniel Walker
2007-08-31 16:21                               ` Stephane Eranian [this message]
2007-08-31 16:35                                 ` Daniel Walker
2007-08-31 18:06                                   ` Björn Steinbrink
2007-09-01  0:24                                     ` Daniel Walker
2007-09-01  1:00                                       ` Björn Steinbrink
2007-09-01  1:36                                         ` Daniel Walker
2007-09-01 10:19                                           ` Andi Kleen
2007-09-01 19:51                                             ` Stephane Eranian
2007-09-01 20:32                                               ` Andi Kleen
2007-09-01 20:46                                                 ` Daniel Walker
2007-09-01  9:12                                       ` Andi Kleen
2007-08-28 20:26                     ` Daniel Walker
2007-08-28 20:21                   ` Stephane Eranian

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=20070831162146.GD7161@frankl.hpl.hp.com \
    --to=eranian@hpl.hp.com \
    --cc=B.Steinbrink@gmx.de \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=dwalker@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome