All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: xen-devel@lists.xensource.com
Cc: jvillalo@redhat.com
Subject: [PATCH] Add Nehalem to list of ppro cores
Date: Fri, 08 Aug 2008 12:34:34 -0400	[thread overview]
Message-ID: <m3tzdvsbxh.fsf@crossbow.pond.sub.org> (raw)

Straight port from Linus's tree:

commit 4b9f12a3779c548b68bc9af7d94030868ad3aa1b
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Thu Jul 24 17:29:00 2008 -0700

    x86/oprofile/nmi_int: add Nehalem to list of ppro cores
    
    ..otherwise oprofile will fall back on that poor timer interrupt.
    
    Also replace the unreadable chain of if-statements with a "switch()"
    statement instead. It generates better code, and is a lot clearer.
    
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Signed-off-by: Markus Armbruster <armbru@redhat.com>

---
Developed and smoke-tested in RHEL-5 on a family 6 model 15 (I don't
have a Nehalem myself).  This is the port to xen-unstable, which is
trivial, but untested.

diff -r 4e3316ed1af5 xen/arch/x86/oprofile/nmi_int.c
--- a/xen/arch/x86/oprofile/nmi_int.c	Fri Aug 08 15:02:19 2008 +0100
+++ b/xen/arch/x86/oprofile/nmi_int.c	Fri Aug 08 12:01:18 2008 -0400
@@ -296,24 +296,40 @@
 {
 	__u8 cpu_model = current_cpu_data.x86_model;
 
-	if (cpu_model == 15 || cpu_model == 23) {
+	switch (cpu_model) {
+	case 0 ... 2:
+		*cpu_type = "i386/ppro";
+		break;
+	case 3 ... 5:
+		*cpu_type = "i386/pii";
+		break;
+	case 6 ... 8:
+		*cpu_type = "i386/piii";
+		break;
+	case 9:
+		*cpu_type = "i386/p6_mobile";
+		break;
+	case 10 ... 13:
+		*cpu_type = "i386/p6";
+		break;
+	case 14:
+		*cpu_type = "i386/core";
+		break;
+	case 15: case 23:
 		*cpu_type = "i386/core_2";
 		ppro_has_global_ctrl = 1;
-	} else if (cpu_model == 14)
-		*cpu_type = "i386/core";
-	else if (cpu_model > 13) {
+		break;
+	case 26:
+		*cpu_type = "i386/core_2";
+		ppro_has_global_ctrl = 1;
+		break;
+	default:
+		/* Unknown */
 		printk("xenoprof: Initialization failed. "
 		       "Intel processor model %d for P6 class family is not "
 		       "supported\n", cpu_model);
 		return 0;
-	} else if (cpu_model == 9)
-		*cpu_type = "i386/p6_mobile";
-	else if (cpu_model > 5)
-		*cpu_type = "i386/piii";
-	else if (cpu_model > 2)
-		*cpu_type = "i386/pii";
-	else
-		*cpu_type = "i386/ppro";
+	}
 
 	model = &op_ppro_spec;
 	return 1;

                 reply	other threads:[~2008-08-08 16:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=m3tzdvsbxh.fsf@crossbow.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=jvillalo@redhat.com \
    --cc=xen-devel@lists.xensource.com \
    /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.