Skip to contentSkip to conversation

perf_counters: start documenting HAVE_PERF_COUNTERS requirements

PATCH Applied Mike Frysinger 6 participants 14 messages Jun 12, 2009 – Jun 14, 2009 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf_counters: start documenting HAVE_PERF_COUNTERS requirements

Help out arch porters who want to support perf counters by listing some basic requirements.

---
i imagine more details would be good, but this is a starting point and better than nothing

 init/Kconfig          |    2 ++
 tools/perf/design.txt |   15 +++++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)
init/Kconfig +2 -0
index c649657..20f85b1 100644
@@ -936,6 +936,8 @@ config AIO
 
 config HAVE_PERF_COUNTERS
 	bool
+	help
+	  See end of tools/perf/design.txt
 
 menu "Performance Counters"
 
tools/perf/design.txt +15 -0
index 860e116..f71e0d2 100644
@@ -440,3 +440,18 @@ by this process or by another, and doesn't affect any counters that
 this process has created on other processes.  It only enables or
 disables the group leaders, not any other members in the groups.
 
+
+Arch requirements
+-----------------
+
+If your architecture does not have hardware performance metrics, you can
+still use the generic software counters based on hrtimers for sampling.
+
+So to start with, in order to add HAVE_PERF_COUNTERS to your Kconfig, you
+will need at least this:
+	- asm/perf_counter.h - a basic stub will suffice at first
+	- support for atomic64 types (and associated helper functions)
+	- set_perf_counter_pending() implemented
+
+If your architecture does have hardware capabilities, you can override the
+weak stub hw_perf_counter_init() to register hardware counters.
Signature · 1 line
1.6.3.1
#1 lore raw
Quoted 17 lines · Mike Frysinger

Help out arch porters who want to support perf counters by listing some basic requirements.

---
i imagine more details would be good, but this is a starting point and better than nothing

 init/Kconfig          |    2 ++
 tools/perf/design.txt |   15 +++++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)
init/Kconfig +0 -0
index c649657..20f85b1 100644

init/Kconfig config AIO · line 940

Quoted 5 lines
init/Kconfig +2 -0
@@ -936,6 +936,8 @@ config AIO
 
 config HAVE_PERF_COUNTERS
 	bool
+	help
+	  See end of tools/perf/design.txt

How about
See "Arch requirements" in tools/perf/design.txt
since it doesn't need to be at the end of the file forever.

Quoted 26 lines
init/Kconfig +0 -0
 menu "Performance Counters"
 
tools/perf/design.txt +15 -0
index 860e116..f71e0d2 100644
@@ -440,3 +440,18 @@ by this process or by another, and doesn't affect any counters that
 this process has created on other processes.  It only enables or
 disables the group leaders, not any other members in the groups.
 
+
+Arch requirements
+-----------------
+
+If your architecture does not have hardware performance metrics, you can
+still use the generic software counters based on hrtimers for sampling.
+
+So to start with, in order to add HAVE_PERF_COUNTERS to your Kconfig, you
+will need at least this:
+	- asm/perf_counter.h - a basic stub will suffice at first
+	- support for atomic64 types (and associated helper functions)
+	- set_perf_counter_pending() implemented
+
+If your architecture does have hardware capabilities, you can override the
+weak stub hw_perf_counter_init() to register hardware counters.
Signature · 3 lines
~Randy
LPC 2009, Sept. 23-25, Portland, Oregon
http://linuxplumbersconf.org/2009/
#2 lore raw

PATCH 1/1 perf_counters: start documenting HAVE_PERF_COUNTERS requirements

Help out arch porters who want to support perf counters by listing some basic requirements.

---
 init/Kconfig          |    2 ++
 tools/perf/design.txt |   15 +++++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)
init/Kconfig +2 -0
index c649657..ee2e3c2 100644
@@ -936,6 +936,8 @@ config AIO
 
 config HAVE_PERF_COUNTERS
 	bool
+	help
+	  See "Arch requirements" in tools/perf/design.txt
 
 menu "Performance Counters"
 
tools/perf/design.txt +15 -0
index 860e116..f71e0d2 100644
@@ -440,3 +440,18 @@ by this process or by another, and doesn't affect any counters that
 this process has created on other processes.  It only enables or
 disables the group leaders, not any other members in the groups.
 
+
+Arch requirements
+-----------------
+
+If your architecture does not have hardware performance metrics, you can
+still use the generic software counters based on hrtimers for sampling.
+
+So to start with, in order to add HAVE_PERF_COUNTERS to your Kconfig, you
+will need at least this:
+	- asm/perf_counter.h - a basic stub will suffice at first
+	- support for atomic64 types (and associated helper functions)
+	- set_perf_counter_pending() implemented
+
+If your architecture does have hardware capabilities, you can override the
+weak stub hw_perf_counter_init() to register hardware counters.
Signature · 1 line
1.6.3.1
#3 lore raw
Quoted 13 lines · Mike Frysinger
tools/perf/design.txt +5 -0
index 860e116..f71e0d2 100644
@@ -440,3 +440,18 @@ by this process or by another, and doesn't affect any counters that
 this process has created on other processes.  It only enables or
 disables the group leaders, not any other members in the groups.
 
+
+Arch requirements
+-----------------
+
+If your architecture does not have hardware performance metrics, you can

tools/perf/design.txt by this process or by another, and doesn't affect any counters that · line 457

Quoted 10 lines
tools/perf/design.txt +10 -0
+still use the generic software counters based on hrtimers for sampling.
+
+So to start with, in order to add HAVE_PERF_COUNTERS to your Kconfig, you
+will need at least this:
+	- asm/perf_counter.h - a basic stub will suffice at first
+	- support for atomic64 types (and associated helper functions)
+	- set_perf_counter_pending() implemented
+
+If your architecture does have hardware capabilities, you can override the
+weak stub hw_perf_counter_init() to register hardware counters.

It would be nice to see this in arch/Kconfig instead, as that tends to provide a centralized checklist for new features, especially when they are non-trivial. At least I found the arch/Kconfig bits very helpful for things like tracehook support, without having to grovel around Documentation for verbose design documents that I otherwise couldn't care less about.

#4 lore raw
Quoted 23 lines · Paul Mundt
Quoted 22 lines · Mike Frysinger
tools/perf/design.txt +0 -0
index 860e116..f71e0d2 100644
@@ -440,3 +440,18 @@ by this process or by another, and doesn't affect any counters that

 this process has created on other processes.  It only enables or disables the group leaders, not any other members in the groups.

tools/perf/design.txt +14 -0
+
+Arch requirements
+-----------------
+
+If your architecture does not have hardware performance metrics, you can
+still use the generic software counters based on hrtimers for sampling.
+
+So to start with, in order to add HAVE_PERF_COUNTERS to your Kconfig, you
+will need at least this:
+     - asm/perf_counter.h - a basic stub will suffice at first
+     - support for atomic64 types (and associated helper functions)
+     - set_perf_counter_pending() implemented
+
+If your architecture does have hardware capabilities, you can override the
Quoted 8 lines
Quoted 1 line

+weak stub hw_perf_counter_init() to register hardware counters.

It would be nice to see this in arch/Kconfig instead, as that tends to provide a centralized checklist for new features, especially when they are non-trivial. At least I found the arch/Kconfig bits very helpful for things like tracehook support, without having to grovel around Documentation for verbose design documents that I otherwise couldn't care less about.

i wouldnt mind moving all of the hidden HAVE_XXX stubs moved to arch/Kconfig, but documentation doesnt really belong there. especially in the case of ftrace where the document specifically for arch porters is pages long (233 lines atm and it doesnt even cover the really hard stuff). the Kconfig help tip pointing to the right document should be fine though of course.
config HAVE_XXXX
bool
help
See some/place/where/the/arch/info/is/at/foo.txt

then there is no need to wade through irrelevant crap -- the Kconfig pointed you to the right place
-mike

Applied
#5 lore raw
In reply to Mike Frysinger
Quoted 17 lines · Mike Frysinger

Help out arch porters who want to support perf counters by listing some basic requirements.

---
i imagine more details would be good, but this is a starting point and better than nothing

 init/Kconfig          |    2 ++
 tools/perf/design.txt |   15 +++++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)
init/Kconfig +0 -0
index c649657..20f85b1 100644

init/Kconfig config AIO · line 942

Quoted 7 lines
init/Kconfig +2 -0
@@ -936,6 +936,8 @@ config AIO
 
 config HAVE_PERF_COUNTERS
 	bool
+	help
+	  See end of tools/perf/design.txt
 
 menu "Performance Counters"

Applied, thanks Mike! I have made a small change: i changed it from help text into a regular comment. We usually use help texts for interactive Kconfig options - but this is not one.

Thanks,

Ingo

#6 lore raw
Quoted 24 lines · Ingo Molnar
Quoted 23 lines · Mike Frysinger

Help out arch porters who want to support perf counters by listing some basic requirements.

---
i imagine more details would be good, but this is a starting point and better than nothing

 init/Kconfig          |    2 ++
 tools/perf/design.txt |   15 +++++++++++++++

 2 files changed, 17 insertions(+), 0 deletions(-)
init/Kconfig +0 -0
index c649657..20f85b1 100644
@@ -936,6 +936,8 @@ config AIO
 

 config HAVE_PERF_COUNTERS
      bool
+     help
+       See end of tools/perf/design.txt

Quoted 5 lines
Quoted 1 line

 menu "Performance Counters"

Applied, thanks Mike! I have made a small change: i changed it from help text into a regular comment. We usually use help texts for interactive Kconfig options - but this is not one.

yes, but i like the help text because when i use the kconfig search option, it shows up. otherwise doing a search for HAVE_PERF_COUNTERS shows nothing useful.
-mike

#7 lore raw
Quoted 31 lines · Mike Frysinger
Quoted 24 lines · Ingo Molnar
Quoted 23 lines · Mike Frysinger

Help out arch porters who want to support perf counters by listing some basic requirements.

---
i imagine more details would be good, but this is a starting point and better than nothing

 init/Kconfig          |    2 ++
 tools/perf/design.txt |   15 +++++++++++++++

 2 files changed, 17 insertions(+), 0 deletions(-)
init/Kconfig +0 -0
index c649657..20f85b1 100644
@@ -936,6 +936,8 @@ config AIO
 

 config HAVE_PERF_COUNTERS
      bool
+     help
+       See end of tools/perf/design.txt

Quoted 5 lines
Quoted 1 line

 menu "Performance Counters"

Applied, thanks Mike! I have made a small change: i changed it from help text into a regular comment. We usually use help texts for interactive Kconfig options - but this is not one.

Quoted 3 lines

yes, but i like the help text because when i use the kconfig search option, it shows up. otherwise doing a search for HAVE_PERF_COUNTERS shows nothing useful.

When i did this modification i tried that in 'make menuconfig' and the help didnt show up. Is it only available in certain kconfig methods?

Ingo

#8 lore raw
Quoted 32 lines · Ingo Molnar
Quoted 31 lines · Mike Frysinger
Quoted 29 lines · Ingo Molnar
Quoted 23 lines · Mike Frysinger

Help out arch porters who want to support perf counters by listing some basic requirements.

---
i imagine more details would be good, but this is a starting point and better than nothing

 init/Kconfig          |    2 ++
 tools/perf/design.txt |   15 +++++++++++++++

 2 files changed, 17 insertions(+), 0 deletions(-)
init/Kconfig +0 -0
index c649657..20f85b1 100644
@@ -936,6 +936,8 @@ config AIO
 

 config HAVE_PERF_COUNTERS
      bool
+     help
+       See end of tools/perf/design.txt

Quoted 1 line

 menu "Performance Counters"

Applied, thanks Mike! I have made a small change: i changed it from help text into a regular comment. We usually use help texts for interactive Kconfig options - but this is not one.

Quoted 7 lines
Quoted 3 lines

yes, but i like the help text because when i use the kconfig search option, it shows up.  otherwise doing a search for HAVE_PERF_COUNTERS shows nothing useful.

When i did this modification i tried that in 'make menuconfig' and the help didnt show up. Is it only available in certain kconfig methods?

hrm, you're right. not sure what i was thinking of. sounds like an enhancement request though for kconfig.
-mike

#9 lore raw
Quoted 31 lines · Mike Frysinger
Quoted 30 lines · Ingo Molnar
Quoted 29 lines · Mike Frysinger
Quoted 28 lines · Ingo Molnar
Quoted 17 lines · Mike Frysinger

Help out arch porters who want to support perf counters by listing some basic requirements.

---
i imagine more details would be good, but this is a starting point and better than nothing

 init/Kconfig          |    2 ++
 tools/perf/design.txt |   15 +++++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)
init/Kconfig +0 -0
index c649657..20f85b1 100644

init/Kconfig config AIO · line 942

Quoted 7 lines
init/Kconfig +2 -0
@@ -936,6 +936,8 @@ config AIO
 
 config HAVE_PERF_COUNTERS
      bool
+     help
+       See end of tools/perf/design.txt
 
 menu "Performance Counters"

Applied, thanks Mike! I have made a small change: i changed it from help text into a regular comment. We usually use help texts for interactive Kconfig options - but this is not one.

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

yes, but i like the help text because when i use the kconfig search option, it shows up. otherwise doing a search for HAVE_PERF_COUNTERS shows nothing useful.

When i did this modification i tried that in 'make menuconfig' and the help didnt show up. Is it only available in certain kconfig methods?

There is no prompt string for it, so it's invisible in menuconfig. xconfig has View options that can show it.

Quoted 2 lines

hrm, you're right. not sure what i was thinking of. sounds like an enhancement request though for kconfig.

Could be. Cc: Sam added.

Signature · 3 lines
~Randy
LPC 2009, Sept. 23-25, Portland, Oregon
http://linuxplumbersconf.org/2009/
#10 lore raw
Quoted 39 lines · Randy Dunlap
Quoted 31 lines · Mike Frysinger
Quoted 30 lines · Ingo Molnar
Quoted 29 lines · Mike Frysinger
Quoted 28 lines · Ingo Molnar
Quoted 17 lines · Mike Frysinger

Help out arch porters who want to support perf counters by listing some basic requirements.

---
i imagine more details would be good, but this is a starting point and better than nothing

 init/Kconfig          |    2 ++
 tools/perf/design.txt |   15 +++++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)
init/Kconfig +0 -0
index c649657..20f85b1 100644

init/Kconfig config AIO · line 942

Quoted 7 lines
init/Kconfig +2 -0
@@ -936,6 +936,8 @@ config AIO
 
 config HAVE_PERF_COUNTERS
      bool
+     help
+       See end of tools/perf/design.txt
 
 menu "Performance Counters"

Applied, thanks Mike! I have made a small change: i changed it from help text into a regular comment. We usually use help texts for interactive Kconfig options - but this is not one.

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

yes, but i like the help text because when i use the kconfig search option, it shows up. otherwise doing a search for HAVE_PERF_COUNTERS shows nothing useful.

When i did this modification i tried that in 'make menuconfig' and the help didnt show up. Is it only available in certain kconfig methods?

Quoted 7 lines

There is no prompt string for it, so it's invisible in menuconfig. xconfig has View options that can show it.

Quoted 2 lines

hrm, you're right. not sure what i was thinking of. sounds like an enhancement request though for kconfig.

Could be. Cc: Sam added.

We do not want to show the invisible symbols.
But the added help text is still fine as it is there when you grep the Kconfig file.

Sam

#11 lore raw
Quoted 39 lines · Sam Ravnborg
Quoted 38 lines · Randy Dunlap
Quoted 37 lines · Mike Frysinger
Quoted 36 lines · Ingo Molnar
Quoted 25 lines · Mike Frysinger
Quoted 24 lines · Ingo Molnar
Quoted 23 lines · Mike Frysinger

Help out arch porters who want to support perf counters by listing some basic requirements.

---
i imagine more details would be good, but this is a starting point and better than nothing

 init/Kconfig          |    2 ++
 tools/perf/design.txt |   15 +++++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)
init/Kconfig +2 -0
index c649657..20f85b1 100644
@@ -936,6 +936,8 @@ config AIO
 
 config HAVE_PERF_COUNTERS
      bool
+     help
+       See end of tools/perf/design.txt
 
Quoted 7 lines
Quoted 4 lines

init/Kconfig config AIO · line 942

Quoted 1 line
init/Kconfig +0 -0
 menu "Performance Counters"

Applied, thanks Mike! I have made a small change: i changed it from help text into a regular comment. We usually use help texts for interactive Kconfig options - but this is not one.

yes, but i like the help text because when i use the kconfig search option, it shows up. otherwise doing a search for HAVE_PERF_COUNTERS shows nothing useful.

When i did this modification i tried that in 'make menuconfig' and the help didnt show up. Is it only available in certain kconfig methods?

Quoted 8 lines
Quoted 6 lines

There is no prompt string for it, so it's invisible in menuconfig. xconfig has View options that can show it.

Quoted 2 lines

hrm, you're right. not sure what i was thinking of. sounds like an enhancement request though for kconfig.

Could be. Cc: Sam added.

We do not want to show the invisible symbols.

usually, yes. But it can be very helpful to developers. I use xconfig showing all symbols All Of The Time (when not using menuconfig, that is).

Quoted 2 lines

But the added help text is still fine as it is there when you grep the Kconfig file.

Signature · 3 lines
~Randy
LPC 2009, Sept. 23-25, Portland, Oregon
http://linuxplumbersconf.org/2009/
#12 lore raw

[tip:perfcounters/core] perf_counter: Start documenting HAVE_PERF_COUNTERS requirements

In reply to Mike Frysinger
Commit-ID:  3c1f287bf974b05ad75df3c462fccace10035fbd
Gitweb:     http://git.kernel.org/tip/3c1f287bf974b05ad75df3c462fccace10035fbd
Author:     Mike Frysinger <[email protected]>
AuthorDate: Fri, 12 Jun 2009 13:17:43 -0400
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 12 Jun 2009 19:29:44 +0200

perf_counter: Start documenting HAVE_PERF_COUNTERS requirements

Help out arch porters who want to support perf counters by listing some basic requirements.

Cc Peter Zijlstra <[email protected]>
Cc Paul Mackerras <[email protected]>

LKML-Reference: <[email protected]>

---
 init/Kconfig          |    3 +++
 tools/perf/design.txt |   15 +++++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)
init/Kconfig +3 -0
index c649657..e03959d 100644
@@ -934,6 +934,9 @@ config AIO
           by some high performance threaded applications. Disabling
           this option saves about 7k.
 
+#
+# See tools/perf/design.txt about details:
+#
 config HAVE_PERF_COUNTERS
 	bool
 
tools/perf/design.txt +15 -0
index 860e116..f71e0d2 100644
@@ -440,3 +440,18 @@ by this process or by another, and doesn't affect any counters that
 this process has created on other processes.  It only enables or
 disables the group leaders, not any other members in the groups.
 
+
+Arch requirements
+-----------------
+
+If your architecture does not have hardware performance metrics, you can
+still use the generic software counters based on hrtimers for sampling.
+
+So to start with, in order to add HAVE_PERF_COUNTERS to your Kconfig, you
+will need at least this:
+	- asm/perf_counter.h - a basic stub will suffice at first
+	- support for atomic64 types (and associated helper functions)
+	- set_perf_counter_pending() implemented
+
+If your architecture does have hardware capabilities, you can override the
+weak stub hw_perf_counter_init() to register hardware counters.
#13 lore raw

[tip:perfcounters/core] perf_counter: Start documenting HAVE_PERF_COUNTERS requirements

In reply to Mike Frysinger
Commit-ID:  018df72dd01576ab199c6129233cdeaf1409958b
Gitweb:     http://git.kernel.org/tip/018df72dd01576ab199c6129233cdeaf1409958b
Author:     Mike Frysinger <[email protected]>
AuthorDate: Fri, 12 Jun 2009 13:17:43 -0400
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 12 Jun 2009 19:37:30 +0200

perf_counter: Start documenting HAVE_PERF_COUNTERS requirements

Help out arch porters who want to support perf counters by listing some basic requirements.

Cc Peter Zijlstra <[email protected]>
Cc Paul Mackerras <[email protected]>

LKML-Reference: <[email protected]>

---
 init/Kconfig          |    2 ++
 tools/perf/design.txt |   15 +++++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)
init/Kconfig +2 -0
index c649657..d3a5096 100644
@@ -936,6 +936,8 @@ config AIO
 
 config HAVE_PERF_COUNTERS
 	bool
+	help
+	  See tools/perf/design.txt for details.
 
 menu "Performance Counters"
 
tools/perf/design.txt +15 -0
index 860e116..f71e0d2 100644
@@ -440,3 +440,18 @@ by this process or by another, and doesn't affect any counters that
 this process has created on other processes.  It only enables or
 disables the group leaders, not any other members in the groups.
 
+
+Arch requirements
+-----------------
+
+If your architecture does not have hardware performance metrics, you can
+still use the generic software counters based on hrtimers for sampling.
+
+So to start with, in order to add HAVE_PERF_COUNTERS to your Kconfig, you
+will need at least this:
+	- asm/perf_counter.h - a basic stub will suffice at first
+	- support for atomic64 types (and associated helper functions)
+	- set_perf_counter_pending() implemented
+
+If your architecture does have hardware capabilities, you can override the
+weak stub hw_perf_counter_init() to register hardware counters.