diff options
author | Robert Richter <robert.richter@amd.com> | 2011-10-11 13:39:16 -0400 |
---|---|---|
committer | Robert Richter <robert.richter@amd.com> | 2011-11-04 10:04:34 -0400 |
commit | 159a80b2142df709416ab369113de7d511c48331 (patch) | |
tree | 852dd0ce5c818e13158c09f702752113c462d2a8 /arch/x86/oprofile/nmi_int.c | |
parent | 97f7f8189fe54e3cfe324ef9ad35064f3d2d3bff (diff) |
oprofile, x86: Add kernel parameter oprofile.cpu_type=timer
We need this to better test x86 NMI timer mode. Otherwise it is very
hard to setup systems with NMI timer enabled, but we have this e.g. in
virtual machine environments.
Signed-off-by: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'arch/x86/oprofile/nmi_int.c')
-rw-r--r-- | arch/x86/oprofile/nmi_int.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c index 68894fdc034b..7ca4d43e8988 100644 --- a/arch/x86/oprofile/nmi_int.c +++ b/arch/x86/oprofile/nmi_int.c | |||
@@ -613,24 +613,36 @@ static int __init p4_init(char **cpu_type) | |||
613 | return 0; | 613 | return 0; |
614 | } | 614 | } |
615 | 615 | ||
616 | static int force_arch_perfmon; | 616 | enum __force_cpu_type { |
617 | static int force_cpu_type(const char *str, struct kernel_param *kp) | 617 | reserved = 0, /* do not force */ |
618 | timer, | ||
619 | arch_perfmon, | ||
620 | }; | ||
621 | |||
622 | static int force_cpu_type; | ||
623 | |||
624 | static int set_cpu_type(const char *str, struct kernel_param *kp) | ||
618 | { | 625 | { |
619 | if (!strcmp(str, "arch_perfmon")) { | 626 | if (!strcmp(str, "timer")) { |
620 | force_arch_perfmon = 1; | 627 | force_cpu_type = timer; |
628 | printk(KERN_INFO "oprofile: forcing NMI timer mode\n"); | ||
629 | } else if (!strcmp(str, "arch_perfmon")) { | ||
630 | force_cpu_type = arch_perfmon; | ||
621 | printk(KERN_INFO "oprofile: forcing architectural perfmon\n"); | 631 | printk(KERN_INFO "oprofile: forcing architectural perfmon\n"); |
632 | } else { | ||
633 | force_cpu_type = 0; | ||
622 | } | 634 | } |
623 | 635 | ||
624 | return 0; | 636 | return 0; |
625 | } | 637 | } |
626 | module_param_call(cpu_type, force_cpu_type, NULL, NULL, 0); | 638 | module_param_call(cpu_type, set_cpu_type, NULL, NULL, 0); |
627 | 639 | ||
628 | static int __init ppro_init(char **cpu_type) | 640 | static int __init ppro_init(char **cpu_type) |
629 | { | 641 | { |
630 | __u8 cpu_model = boot_cpu_data.x86_model; | 642 | __u8 cpu_model = boot_cpu_data.x86_model; |
631 | struct op_x86_model_spec *spec = &op_ppro_spec; /* default */ | 643 | struct op_x86_model_spec *spec = &op_ppro_spec; /* default */ |
632 | 644 | ||
633 | if (force_arch_perfmon && cpu_has_arch_perfmon) | 645 | if (force_cpu_type == arch_perfmon && cpu_has_arch_perfmon) |
634 | return 0; | 646 | return 0; |
635 | 647 | ||
636 | /* | 648 | /* |
@@ -697,6 +709,9 @@ int __init op_nmi_init(struct oprofile_operations *ops) | |||
697 | if (!cpu_has_apic) | 709 | if (!cpu_has_apic) |
698 | return -ENODEV; | 710 | return -ENODEV; |
699 | 711 | ||
712 | if (force_cpu_type == timer) | ||
713 | return -ENODEV; | ||
714 | |||
700 | switch (vendor) { | 715 | switch (vendor) { |
701 | case X86_VENDOR_AMD: | 716 | case X86_VENDOR_AMD: |
702 | /* Needs to be at least an Athlon (or hammer in 32bit mode) */ | 717 | /* Needs to be at least an Athlon (or hammer in 32bit mode) */ |