public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [1/3] oprofile: re-add force_arch_perfmon option
@ 2009-04-27 15:44 Andi Kleen
  2009-04-27 15:44 ` [PATCH] [2/3] oprofile: remove undocumented oprofile.p4force option Andi Kleen
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andi Kleen @ 2009-04-27 15:44 UTC (permalink / raw)
  To: oprofile-list, robert.richter, linux-kernel


This re-adds the force_arch_perfmon option that was in the original
arch perfmon patchkit. Originally this was rejected in favour 
of a generalized perfmon=name option, but it turned out implementing
the later in a reliable way is hard (and it would have been easy
to crash the kernel if a user gets it wrong) 

But now Atom and Core i7 support being readded a user would
need to update their oprofile userland to beyond 0.9.4 to use oprofile again
on Atom or Core i7.

To avoid this problem readd the force_arch_perfmon option.
Signed-off-by: Andi Kleen <ak@linux.intel.com>

---
 Documentation/kernel-parameters.txt |    6 ++++++
 arch/x86/oprofile/nmi_int.c         |    6 ++++++
 2 files changed, 12 insertions(+)

Index: linux-2.6.30-rc3-ak/Documentation/kernel-parameters.txt
===================================================================
--- linux-2.6.30-rc3-ak.orig/Documentation/kernel-parameters.txt	2009-04-25 19:11:59.000000000 +0200
+++ linux-2.6.30-rc3-ak/Documentation/kernel-parameters.txt	2009-04-27 13:20:29.000000000 +0200
@@ -1648,6 +1648,12 @@
 	oprofile.timer=	[HW]
 			Use timer interrupt instead of performance counters
 
+	oprofile.force_arch_perfmon=1	[X86]
+			Force use of architectural perfmon instead of
+			the CPU specific event set.
+			This might be useful if you have older oprofile
+			userland or if you want common events over Intel CPUs.
+
 	osst=		[HW,SCSI] SCSI Tape Driver
 			Format: <buffer_size>,<write_threshold>
 			See also Documentation/scsi/st.txt.
Index: linux-2.6.30-rc3-ak/arch/x86/oprofile/nmi_int.c
===================================================================
--- linux-2.6.30-rc3-ak.orig/arch/x86/oprofile/nmi_int.c	2009-02-15 12:09:09.000000000 +0100
+++ linux-2.6.30-rc3-ak/arch/x86/oprofile/nmi_int.c	2009-04-27 13:20:29.000000000 +0200
@@ -389,10 +389,16 @@
 	return 0;
 }
 
+int force_arch_perfmon;
+module_param(force_arch_perfmon, int, 0);
+
 static int __init ppro_init(char **cpu_type)
 {
 	__u8 cpu_model = boot_cpu_data.x86_model;
 
+	if (force_arch_perfmon && cpu_has_arch_perfmon)
+		return 0;
+
 	switch (cpu_model) {
 	case 0 ... 2:
 		*cpu_type = "i386/ppro";

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] [2/3] oprofile: remove undocumented oprofile.p4force option
  2009-04-27 15:44 [PATCH] [1/3] oprofile: re-add force_arch_perfmon option Andi Kleen
@ 2009-04-27 15:44 ` Andi Kleen
  2009-04-27 15:44 ` [PATCH] [3/3] oprofile: add support for Core i7 and Atom Andi Kleen
  2009-05-06 12:50 ` [PATCH] [1/3] oprofile: re-add force_arch_perfmon option Robert Richter
  2 siblings, 0 replies; 5+ messages in thread
From: Andi Kleen @ 2009-04-27 15:44 UTC (permalink / raw)
  To: oprofile-list, robert.richter, linux-kernel


There are no new P4s and the oprofile code knows about all existing
ones, so we don't really need the p4force option anymore.

Remove it.

Signed-off-by: Andi Kleen <ak@linux.intel.com>

---
 arch/x86/oprofile/nmi_int.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Index: linux-2.6.28-test/arch/x86/oprofile/nmi_int.c
===================================================================
--- linux-2.6.28-test.orig/arch/x86/oprofile/nmi_int.c	2009-01-03 00:57:30.000000000 +0100
+++ linux-2.6.28-test/arch/x86/oprofile/nmi_int.c	2009-01-03 00:58:25.000000000 +0100
@@ -356,14 +356,11 @@
 #define exit_sysfs() do { } while (0)
 #endif /* CONFIG_PM */
 
-static int p4force;
-module_param(p4force, int, 0);
-
 static int __init p4_init(char **cpu_type)
 {
 	__u8 cpu_model = boot_cpu_data.x86_model;
 
-	if (!p4force && (cpu_model > 6 || cpu_model == 5))
+	if (cpu_model > 6 || cpu_model == 5)
 		return 0;
 
 #ifndef CONFIG_SMP

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] [3/3] oprofile: add support for Core i7 and Atom
  2009-04-27 15:44 [PATCH] [1/3] oprofile: re-add force_arch_perfmon option Andi Kleen
  2009-04-27 15:44 ` [PATCH] [2/3] oprofile: remove undocumented oprofile.p4force option Andi Kleen
@ 2009-04-27 15:44 ` Andi Kleen
  2009-05-06 12:50 ` [PATCH] [1/3] oprofile: re-add force_arch_perfmon option Robert Richter
  2 siblings, 0 replies; 5+ messages in thread
From: Andi Kleen @ 2009-04-27 15:44 UTC (permalink / raw)
  To: oprofile-list, robert.richter, linux-kernel


The registers are about the same as other Family 6 CPUs 
so we only need to add detection.

I'm not completely happy with calling Nehalem Core i7 because
there will be undoubtedly other Nehalem based CPUs
in the future with different marketing names, but it's
the best we got for now.

Requires updated oprofile userland for the new event files.

If you don't want to update right now you can also use 
oprofile.force_arch_perfmon=1 (added in the next patch) with 0.9.4

Signed-off-by: Andi Kleen <ak@linux.intel.com>

---
 arch/x86/oprofile/nmi_int.c |    7 +++++++
 1 file changed, 7 insertions(+)

Index: linux-2.6.30-rc3-ak/arch/x86/oprofile/nmi_int.c
===================================================================
--- linux-2.6.30-rc3-ak.orig/arch/x86/oprofile/nmi_int.c	2009-04-27 13:25:08.000000000 +0200
+++ linux-2.6.30-rc3-ak/arch/x86/oprofile/nmi_int.c	2009-04-27 15:36:22.000000000 +0200
@@ -417,6 +417,13 @@
 	case 15: case 23:
 		*cpu_type = "i386/core_2";
 		break;
+	case 26:
+		arch_perfmon_setup_counters();
+		*cpu_type = "i386/core_i7";
+		break;
+	case 28:
+		*cpu_type = "i386/atom";
+		break;
 	default:
 		/* Unknown */
 		return 0;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] [1/3] oprofile: re-add force_arch_perfmon option
  2009-04-27 15:44 [PATCH] [1/3] oprofile: re-add force_arch_perfmon option Andi Kleen
  2009-04-27 15:44 ` [PATCH] [2/3] oprofile: remove undocumented oprofile.p4force option Andi Kleen
  2009-04-27 15:44 ` [PATCH] [3/3] oprofile: add support for Core i7 and Atom Andi Kleen
@ 2009-05-06 12:50 ` Robert Richter
  2009-05-06 14:48   ` Andi Kleen
  2 siblings, 1 reply; 5+ messages in thread
From: Robert Richter @ 2009-05-06 12:50 UTC (permalink / raw)
  To: Andi Kleen; +Cc: oprofile-list, linux-kernel

Andi,

I applied your patches. Please see my follow on patches and test them.

Thanks,

-Robert

On 27.04.09 17:44:11, Andi Kleen wrote:
> 
> This re-adds the force_arch_perfmon option that was in the original
> arch perfmon patchkit. Originally this was rejected in favour 
> of a generalized perfmon=name option, but it turned out implementing
> the later in a reliable way is hard (and it would have been easy
> to crash the kernel if a user gets it wrong) 
> 
> But now Atom and Core i7 support being readded a user would
> need to update their oprofile userland to beyond 0.9.4 to use oprofile again
> on Atom or Core i7.
> 
> To avoid this problem readd the force_arch_perfmon option.
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> 
> ---
>  Documentation/kernel-parameters.txt |    6 ++++++
>  arch/x86/oprofile/nmi_int.c         |    6 ++++++
>  2 files changed, 12 insertions(+)
> 
> Index: linux-2.6.30-rc3-ak/Documentation/kernel-parameters.txt
> ===================================================================
> --- linux-2.6.30-rc3-ak.orig/Documentation/kernel-parameters.txt	2009-04-25 19:11:59.000000000 +0200
> +++ linux-2.6.30-rc3-ak/Documentation/kernel-parameters.txt	2009-04-27 13:20:29.000000000 +0200
> @@ -1648,6 +1648,12 @@
>  	oprofile.timer=	[HW]
>  			Use timer interrupt instead of performance counters
>  
> +	oprofile.force_arch_perfmon=1	[X86]
> +			Force use of architectural perfmon instead of
> +			the CPU specific event set.
> +			This might be useful if you have older oprofile
> +			userland or if you want common events over Intel CPUs.
> +
>  	osst=		[HW,SCSI] SCSI Tape Driver
>  			Format: <buffer_size>,<write_threshold>
>  			See also Documentation/scsi/st.txt.
> Index: linux-2.6.30-rc3-ak/arch/x86/oprofile/nmi_int.c
> ===================================================================
> --- linux-2.6.30-rc3-ak.orig/arch/x86/oprofile/nmi_int.c	2009-02-15 12:09:09.000000000 +0100
> +++ linux-2.6.30-rc3-ak/arch/x86/oprofile/nmi_int.c	2009-04-27 13:20:29.000000000 +0200
> @@ -389,10 +389,16 @@
>  	return 0;
>  }
>  
> +int force_arch_perfmon;
> +module_param(force_arch_perfmon, int, 0);
> +
>  static int __init ppro_init(char **cpu_type)
>  {
>  	__u8 cpu_model = boot_cpu_data.x86_model;
>  
> +	if (force_arch_perfmon && cpu_has_arch_perfmon)
> +		return 0;
> +
>  	switch (cpu_model) {
>  	case 0 ... 2:
>  		*cpu_type = "i386/ppro";
> 

-- 
Advanced Micro Devices, Inc.
Operating System Research Center
email: robert.richter@amd.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] [1/3] oprofile: re-add force_arch_perfmon option
  2009-05-06 12:50 ` [PATCH] [1/3] oprofile: re-add force_arch_perfmon option Robert Richter
@ 2009-05-06 14:48   ` Andi Kleen
  0 siblings, 0 replies; 5+ messages in thread
From: Andi Kleen @ 2009-05-06 14:48 UTC (permalink / raw)
  To: Robert Richter; +Cc: Andi Kleen, oprofile-list, linux-kernel

On Wed, May 06, 2009 at 02:50:27PM +0200, Robert Richter wrote:
> Andi,
> 
> I applied your patches. Please see my follow on patches and test them.

Thanks.

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-05-06 14:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-27 15:44 [PATCH] [1/3] oprofile: re-add force_arch_perfmon option Andi Kleen
2009-04-27 15:44 ` [PATCH] [2/3] oprofile: remove undocumented oprofile.p4force option Andi Kleen
2009-04-27 15:44 ` [PATCH] [3/3] oprofile: add support for Core i7 and Atom Andi Kleen
2009-05-06 12:50 ` [PATCH] [1/3] oprofile: re-add force_arch_perfmon option Robert Richter
2009-05-06 14:48   ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox