perf: Do the big rename: Performance Counters -> Performance Events
Bye-bye Performance Counters, welcome Performance Events!
In the past few months the perfcounters subsystem has grown out its
initial role of counting hardware events, and has become (and is
becoming) a much broader generic event enumeration, reporting, logging,
monitoring, analysis facility.
Naming its core object 'perf_counter' and naming the subsystem
'perfcounters' has become more and more of a misnomer. With pending
code like hw-breakpoints support the 'counter' name is less and
less appropriate.
All in one, we've decided to rename the subsystem to 'performance
events' and to propagate this rename through all fields, variables
and API names. (in an ABI compatible fashion)
The word 'event' is also a bit shorter than 'counter' - which makes
it slightly more convenient to write/handle as well.
Thanks goes to Stephane Eranian who first observed this misnomer and
suggested a rename.
User-space tooling and ABI compatibility is not affected - this patch
should be function-invariant. (Also, defconfigs were not touched to
keep the size down.)
This patch has been generated via the following script:
FILES=$(find * -type f | grep -vE 'oprofile|[^K]config')
sed -i \
-e 's/PERF_EVENT_/PERF_RECORD_/g' \
-e 's/PERF_COUNTER/PERF_EVENT/g' \
-e 's/perf_counter/perf_event/g' \
-e 's/nb_counters/nb_events/g' \
-e 's/swcounter/swevent/g' \
-e 's/tpcounter_event/tp_event/g' \
$FILES
for N in $(find . -name perf_counter.[ch]); do
M=$(echo $N | sed 's/perf_counter/perf_event/g')
mv $N $M
done
FILES=$(find . -name perf_event.*)
sed -i \
-e 's/COUNTER_MASK/REG_MASK/g' \
-e 's/COUNTER/EVENT/g' \
-e 's/\<event\>/event_id/g' \
-e 's/counter/event/g' \
-e 's/Counter/Event/g' \
$FILES
... to keep it as correct as possible. This script can also be
used by anyone who has pending perfcounters patches - it converts
a Linux kernel tree over to the new naming. We tried to time this
change to the point in time where the amount of pending patches
is the smallest: the end of the merge window.
Namespace clashes were fixed up in a preparatory patch - and some
stylistic fallout will be fixed up in a subsequent patch.
( NOTE: 'counters' are still the proper terminology when we deal
with hardware registers - and these sed scripts are a bit
over-eager in renaming them. I've undone some of that, but
in case there's something left where 'counter' would be
better than 'event' we can undo that on an individual basis
instead of touching an otherwise nicely automated patch. )
Suggested-by: Stephane Eranian <eranian@google.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Paul Mackerras <paulus@samba.org>
Reviewed-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: <linux-arch@vger.kernel.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-09-21 17:02:48 +07:00
|
|
|
/*
|
|
|
|
* Performance event support - s390 specific definitions.
|
|
|
|
*
|
2013-12-11 18:44:40 +07:00
|
|
|
* Copyright IBM Corp. 2009, 2013
|
2012-03-23 17:13:06 +07:00
|
|
|
* Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
|
|
|
|
* Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
|
perf: Do the big rename: Performance Counters -> Performance Events
Bye-bye Performance Counters, welcome Performance Events!
In the past few months the perfcounters subsystem has grown out its
initial role of counting hardware events, and has become (and is
becoming) a much broader generic event enumeration, reporting, logging,
monitoring, analysis facility.
Naming its core object 'perf_counter' and naming the subsystem
'perfcounters' has become more and more of a misnomer. With pending
code like hw-breakpoints support the 'counter' name is less and
less appropriate.
All in one, we've decided to rename the subsystem to 'performance
events' and to propagate this rename through all fields, variables
and API names. (in an ABI compatible fashion)
The word 'event' is also a bit shorter than 'counter' - which makes
it slightly more convenient to write/handle as well.
Thanks goes to Stephane Eranian who first observed this misnomer and
suggested a rename.
User-space tooling and ABI compatibility is not affected - this patch
should be function-invariant. (Also, defconfigs were not touched to
keep the size down.)
This patch has been generated via the following script:
FILES=$(find * -type f | grep -vE 'oprofile|[^K]config')
sed -i \
-e 's/PERF_EVENT_/PERF_RECORD_/g' \
-e 's/PERF_COUNTER/PERF_EVENT/g' \
-e 's/perf_counter/perf_event/g' \
-e 's/nb_counters/nb_events/g' \
-e 's/swcounter/swevent/g' \
-e 's/tpcounter_event/tp_event/g' \
$FILES
for N in $(find . -name perf_counter.[ch]); do
M=$(echo $N | sed 's/perf_counter/perf_event/g')
mv $N $M
done
FILES=$(find . -name perf_event.*)
sed -i \
-e 's/COUNTER_MASK/REG_MASK/g' \
-e 's/COUNTER/EVENT/g' \
-e 's/\<event\>/event_id/g' \
-e 's/counter/event/g' \
-e 's/Counter/Event/g' \
$FILES
... to keep it as correct as possible. This script can also be
used by anyone who has pending perfcounters patches - it converts
a Linux kernel tree over to the new naming. We tried to time this
change to the point in time where the amount of pending patches
is the smallest: the end of the merge window.
Namespace clashes were fixed up in a preparatory patch - and some
stylistic fallout will be fixed up in a subsequent patch.
( NOTE: 'counters' are still the proper terminology when we deal
with hardware registers - and these sed scripts are a bit
over-eager in renaming them. I've undone some of that, but
in case there's something left where 'counter' would be
better than 'event' we can undo that on an individual basis
instead of touching an otherwise nicely automated patch. )
Suggested-by: Stephane Eranian <eranian@google.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Paul Mackerras <paulus@samba.org>
Reviewed-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: <linux-arch@vger.kernel.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-09-21 17:02:48 +07:00
|
|
|
*/
|
|
|
|
|
2013-12-11 18:44:40 +07:00
|
|
|
#ifndef _ASM_S390_PERF_EVENT_H
|
|
|
|
#define _ASM_S390_PERF_EVENT_H
|
|
|
|
|
|
|
|
#ifdef CONFIG_64BIT
|
|
|
|
|
|
|
|
#include <linux/perf_event.h>
|
|
|
|
#include <linux/device.h>
|
2012-03-23 17:13:06 +07:00
|
|
|
#include <asm/cpu_mf.h>
|
perf: Do the big rename: Performance Counters -> Performance Events
Bye-bye Performance Counters, welcome Performance Events!
In the past few months the perfcounters subsystem has grown out its
initial role of counting hardware events, and has become (and is
becoming) a much broader generic event enumeration, reporting, logging,
monitoring, analysis facility.
Naming its core object 'perf_counter' and naming the subsystem
'perfcounters' has become more and more of a misnomer. With pending
code like hw-breakpoints support the 'counter' name is less and
less appropriate.
All in one, we've decided to rename the subsystem to 'performance
events' and to propagate this rename through all fields, variables
and API names. (in an ABI compatible fashion)
The word 'event' is also a bit shorter than 'counter' - which makes
it slightly more convenient to write/handle as well.
Thanks goes to Stephane Eranian who first observed this misnomer and
suggested a rename.
User-space tooling and ABI compatibility is not affected - this patch
should be function-invariant. (Also, defconfigs were not touched to
keep the size down.)
This patch has been generated via the following script:
FILES=$(find * -type f | grep -vE 'oprofile|[^K]config')
sed -i \
-e 's/PERF_EVENT_/PERF_RECORD_/g' \
-e 's/PERF_COUNTER/PERF_EVENT/g' \
-e 's/perf_counter/perf_event/g' \
-e 's/nb_counters/nb_events/g' \
-e 's/swcounter/swevent/g' \
-e 's/tpcounter_event/tp_event/g' \
$FILES
for N in $(find . -name perf_counter.[ch]); do
M=$(echo $N | sed 's/perf_counter/perf_event/g')
mv $N $M
done
FILES=$(find . -name perf_event.*)
sed -i \
-e 's/COUNTER_MASK/REG_MASK/g' \
-e 's/COUNTER/EVENT/g' \
-e 's/\<event\>/event_id/g' \
-e 's/counter/event/g' \
-e 's/Counter/Event/g' \
$FILES
... to keep it as correct as possible. This script can also be
used by anyone who has pending perfcounters patches - it converts
a Linux kernel tree over to the new naming. We tried to time this
change to the point in time where the amount of pending patches
is the smallest: the end of the merge window.
Namespace clashes were fixed up in a preparatory patch - and some
stylistic fallout will be fixed up in a subsequent patch.
( NOTE: 'counters' are still the proper terminology when we deal
with hardware registers - and these sed scripts are a bit
over-eager in renaming them. I've undone some of that, but
in case there's something left where 'counter' would be
better than 'event' we can undo that on an individual basis
instead of touching an otherwise nicely automated patch. )
Suggested-by: Stephane Eranian <eranian@google.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Paul Mackerras <paulus@samba.org>
Reviewed-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: <linux-arch@vger.kernel.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-09-21 17:02:48 +07:00
|
|
|
|
2012-03-23 17:13:06 +07:00
|
|
|
/* Per-CPU flags for PMU states */
|
|
|
|
#define PMU_F_RESERVED 0x1000
|
|
|
|
#define PMU_F_ENABLED 0x2000
|
2013-12-12 22:32:47 +07:00
|
|
|
#define PMU_F_IN_USE 0x4000
|
|
|
|
#define PMU_F_ERR_IBE 0x0100
|
|
|
|
#define PMU_F_ERR_LSDA 0x0200
|
|
|
|
#define PMU_F_ERR_MASK (PMU_F_ERR_IBE|PMU_F_ERR_LSDA)
|
2013-06-12 18:54:56 +07:00
|
|
|
|
2013-12-11 18:44:40 +07:00
|
|
|
/* Perf defintions for PMU event attributes in sysfs */
|
|
|
|
extern __init const struct attribute_group **cpumf_cf_event_group(void);
|
|
|
|
extern ssize_t cpumf_events_sysfs_show(struct device *dev,
|
|
|
|
struct device_attribute *attr,
|
|
|
|
char *page);
|
|
|
|
#define EVENT_VAR(_cat, _name) event_attr_##_cat##_##_name
|
|
|
|
#define EVENT_PTR(_cat, _name) (&EVENT_VAR(_cat, _name).attr.attr)
|
|
|
|
|
|
|
|
#define CPUMF_EVENT_ATTR(cat, name, id) \
|
|
|
|
PMU_EVENT_ATTR(name, EVENT_VAR(cat, name), id, cpumf_events_sysfs_show)
|
|
|
|
#define CPUMF_EVENT_PTR(cat, name) EVENT_PTR(cat, name)
|
|
|
|
|
2013-06-12 18:54:56 +07:00
|
|
|
|
|
|
|
/* Perf callbacks */
|
|
|
|
struct pt_regs;
|
|
|
|
extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
|
|
|
|
extern unsigned long perf_misc_flags(struct pt_regs *regs);
|
|
|
|
#define perf_misc_flags(regs) perf_misc_flags(regs)
|
|
|
|
|
2013-12-12 23:54:57 +07:00
|
|
|
/* Perf pt_regs extension for sample-data-entry indicators */
|
|
|
|
struct perf_sf_sde_regs {
|
|
|
|
unsigned char in_guest:1; /* guest sample */
|
|
|
|
unsigned long reserved:63; /* reserved */
|
|
|
|
};
|
|
|
|
|
2013-12-12 22:32:47 +07:00
|
|
|
/* Perf PMU definitions for the counter facility */
|
|
|
|
#define PERF_CPUM_CF_MAX_CTR 256
|
|
|
|
|
|
|
|
/* Perf PMU definitions for the sampling facility */
|
2013-12-13 17:42:44 +07:00
|
|
|
#define PERF_CPUM_SF_MAX_CTR 2
|
|
|
|
#define PERF_EVENT_CPUM_SF 0xB0000UL /* Event: Basic-sampling */
|
|
|
|
#define PERF_EVENT_CPUM_SF_DIAG 0xBD000UL /* Event: Combined-sampling */
|
|
|
|
#define PERF_CPUM_SF_BASIC_MODE 0x0001 /* Basic-sampling flag */
|
|
|
|
#define PERF_CPUM_SF_DIAG_MODE 0x0002 /* Diagnostic-sampling flag */
|
|
|
|
#define PERF_CPUM_SF_MODE_MASK (PERF_CPUM_SF_BASIC_MODE| \
|
|
|
|
PERF_CPUM_SF_DIAG_MODE)
|
2013-12-13 18:45:01 +07:00
|
|
|
#define PERF_CPUM_SF_FULL_BLOCKS 0x0004 /* Process full SDBs only */
|
2013-12-12 22:32:47 +07:00
|
|
|
|
2013-12-12 23:03:48 +07:00
|
|
|
#define REG_NONE 0
|
|
|
|
#define REG_OVERFLOW 1
|
|
|
|
#define OVERFLOW_REG(hwc) ((hwc)->extra_reg.config)
|
|
|
|
#define SFB_ALLOC_REG(hwc) ((hwc)->extra_reg.alloc)
|
2013-12-13 17:42:44 +07:00
|
|
|
#define RAWSAMPLE_REG(hwc) ((hwc)->config)
|
2013-12-12 22:32:47 +07:00
|
|
|
#define TEAR_REG(hwc) ((hwc)->last_tag)
|
|
|
|
#define SAMPL_RATE(hwc) ((hwc)->event_base)
|
2013-12-13 17:42:44 +07:00
|
|
|
#define SAMPL_FLAGS(hwc) ((hwc)->config_base)
|
|
|
|
#define SAMPL_DIAG_MODE(hwc) (SAMPL_FLAGS(hwc) & PERF_CPUM_SF_DIAG_MODE)
|
2013-12-13 18:45:01 +07:00
|
|
|
#define SDB_FULL_BLOCKS(hwc) (SAMPL_FLAGS(hwc) & PERF_CPUM_SF_FULL_BLOCKS)
|
2013-12-13 17:42:44 +07:00
|
|
|
|
|
|
|
/* Structure for sampling data entries to be passed as perf raw sample data
|
|
|
|
* to user space. Note that raw sample data must be aligned and, thus, might
|
|
|
|
* be padded with zeros.
|
|
|
|
*/
|
|
|
|
struct sf_raw_sample {
|
|
|
|
#define SF_RAW_SAMPLE_BASIC PERF_CPUM_SF_BASIC_MODE
|
|
|
|
#define SF_RAW_SAMPLE_DIAG PERF_CPUM_SF_DIAG_MODE
|
|
|
|
u64 format;
|
|
|
|
u32 size; /* Size of sf_raw_sample */
|
|
|
|
u16 bsdes; /* Basic-sampling data entry size */
|
|
|
|
u16 dsdes; /* Diagnostic-sampling data entry size */
|
|
|
|
struct hws_basic_entry basic; /* Basic-sampling data entry */
|
|
|
|
struct hws_diag_entry diag; /* Diagnostic-sampling data entry */
|
|
|
|
u8 padding[]; /* Padding to next multiple of 8 */
|
|
|
|
} __packed;
|
2013-12-12 22:32:47 +07:00
|
|
|
|
2013-12-12 22:52:48 +07:00
|
|
|
/* Perf hardware reserve and release functions */
|
|
|
|
int perf_reserve_sampling(void);
|
|
|
|
void perf_release_sampling(void);
|
|
|
|
|
2013-06-12 18:54:56 +07:00
|
|
|
#endif /* CONFIG_64BIT */
|
2013-12-11 18:44:40 +07:00
|
|
|
#endif /* _ASM_S390_PERF_EVENT_H */
|