Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > fc11cd6e1c513a17304da94a5390f3cd > files > 3969

kernel-2.6.18-194.11.1.el5.src.rpm

From: Markus Armbruster <armbru@redhat.com>
Date: Wed, 27 Aug 2008 17:49:03 -0400
Subject: [x86] make bare-metal oprofile recognize other platforms
Message-id: m3d4juruwg.fsf@crossbow.pond.sub.org
O-Subject: [PATCH RHEL-5.3 1/2] Make bare-metal oprofile recognize Nehalem
Bugzilla: 458441
RH-Acked-by: Bill Burns <bburns@redhat.com>
RH-Acked-by: Anton Arapov <aarapov@redhat.com>
RH-Acked-by: Rik van Riel <riel@redhat.com>

Straightforward backport of:

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>

Bug 458441.

diff --git a/arch/i386/oprofile/nmi_int.c b/arch/i386/oprofile/nmi_int.c
index 6b50231..287278d 100644
--- a/arch/i386/oprofile/nmi_int.c
+++ b/arch/i386/oprofile/nmi_int.c
@@ -331,24 +331,38 @@ static int __init p4_init(char ** cpu_type)
 }
 
 
-static int __init ppro_init(char ** cpu_type)
+static int __init ppro_init(char **cpu_type)
 {
 	__u8 cpu_model = boot_cpu_data.x86_model;
 
-	if (cpu_model == 14)
+	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";
-	else if (cpu_model == 15 || cpu_model == 23)
+		break;
+	case 15: case 23:
 		*cpu_type = "i386/core_2";
-	else if (cpu_model > 0xd)
-		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";
+		break;
+	case 26:
+		*cpu_type = "i386/core_2";
+		break;
+	default:
+		/* Unknown */
+	    return 0;
 	}
 
 	model = &op_ppro_spec;