ia64/xen-unstable

changeset 18305:3d5515f40b9b

x86, xenoprof: Add Nehalem to list of ppro cores

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>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Aug 11 10:52:18 2008 +0100 (2008-08-11)
parents f60c565e2ca2
children f10d436d9a9e
files xen/arch/x86/oprofile/nmi_int.c
line diff
     1.1 --- a/xen/arch/x86/oprofile/nmi_int.c	Mon Aug 11 10:49:57 2008 +0100
     1.2 +++ b/xen/arch/x86/oprofile/nmi_int.c	Mon Aug 11 10:52:18 2008 +0100
     1.3 @@ -296,24 +296,40 @@ static int __init ppro_init(char ** cpu_
     1.4  {
     1.5  	__u8 cpu_model = current_cpu_data.x86_model;
     1.6  
     1.7 -	if (cpu_model == 15 || cpu_model == 23) {
     1.8 +	switch (cpu_model) {
     1.9 +	case 0 ... 2:
    1.10 +		*cpu_type = "i386/ppro";
    1.11 +		break;
    1.12 +	case 3 ... 5:
    1.13 +		*cpu_type = "i386/pii";
    1.14 +		break;
    1.15 +	case 6 ... 8:
    1.16 +		*cpu_type = "i386/piii";
    1.17 +		break;
    1.18 +	case 9:
    1.19 +		*cpu_type = "i386/p6_mobile";
    1.20 +		break;
    1.21 +	case 10 ... 13:
    1.22 +		*cpu_type = "i386/p6";
    1.23 +		break;
    1.24 +	case 14:
    1.25 +		*cpu_type = "i386/core";
    1.26 +		break;
    1.27 +	case 15: case 23:
    1.28  		*cpu_type = "i386/core_2";
    1.29  		ppro_has_global_ctrl = 1;
    1.30 -	} else if (cpu_model == 14)
    1.31 -		*cpu_type = "i386/core";
    1.32 -	else if (cpu_model > 13) {
    1.33 +		break;
    1.34 +	case 26:
    1.35 +		*cpu_type = "i386/core_2";
    1.36 +		ppro_has_global_ctrl = 1;
    1.37 +		break;
    1.38 +	default:
    1.39 +		/* Unknown */
    1.40  		printk("xenoprof: Initialization failed. "
    1.41  		       "Intel processor model %d for P6 class family is not "
    1.42  		       "supported\n", cpu_model);
    1.43  		return 0;
    1.44 -	} else if (cpu_model == 9)
    1.45 -		*cpu_type = "i386/p6_mobile";
    1.46 -	else if (cpu_model > 5)
    1.47 -		*cpu_type = "i386/piii";
    1.48 -	else if (cpu_model > 2)
    1.49 -		*cpu_type = "i386/pii";
    1.50 -	else
    1.51 -		*cpu_type = "i386/ppro";
    1.52 +	}
    1.53  
    1.54  	model = &op_ppro_spec;
    1.55  	return 1;