2005-04-16 22:20:36 +00:00
|
|
|
/**
|
|
|
|
* @file op_x86_model.h
|
|
|
|
* interface to x86 model-specific MSR operations
|
|
|
|
*
|
|
|
|
* @remark Copyright 2002 OProfile authors
|
|
|
|
* @remark Read the file COPYING
|
|
|
|
*
|
|
|
|
* @author Graydon Hoare
|
2009-05-25 13:10:32 +00:00
|
|
|
* @author Robert Richter <robert.richter@amd.com>
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OP_X86_MODEL_H
|
|
|
|
#define OP_X86_MODEL_H
|
|
|
|
|
2009-05-25 13:10:32 +00:00
|
|
|
#include <asm/types.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 10:02:48 +00:00
|
|
|
#include <asm/perf_event.h>
|
2009-05-25 13:05:50 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
struct op_msr {
|
2009-06-03 17:09:27 +00:00
|
|
|
unsigned long addr;
|
|
|
|
u64 saved;
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct op_msrs {
|
2008-09-05 15:12:36 +00:00
|
|
|
struct op_msr *counters;
|
|
|
|
struct op_msr *controls;
|
2009-07-08 11:49:38 +00:00
|
|
|
struct op_msr *multiplex;
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct pt_regs;
|
|
|
|
|
2009-05-25 13:10:32 +00:00
|
|
|
struct oprofile_operations;
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* The model vtable abstracts the differences between
|
2007-10-19 23:13:56 +00:00
|
|
|
* various x86 CPU models' perfctr support.
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
|
|
|
struct op_x86_model_spec {
|
2009-05-28 00:12:36 +00:00
|
|
|
unsigned int num_counters;
|
|
|
|
unsigned int num_controls;
|
2009-07-08 11:49:38 +00:00
|
|
|
unsigned int num_virt_counters;
|
2009-05-25 13:10:32 +00:00
|
|
|
u64 reserved;
|
|
|
|
u16 event_mask;
|
2009-05-28 00:12:36 +00:00
|
|
|
int (*init)(struct oprofile_operations *ops);
|
2010-02-26 16:20:55 +00:00
|
|
|
int (*fill_in_addresses)(struct op_msrs * const msrs);
|
2009-05-25 17:31:44 +00:00
|
|
|
void (*setup_ctrs)(struct op_x86_model_spec const *model,
|
|
|
|
struct op_msrs const * const msrs);
|
2010-05-05 15:47:17 +00:00
|
|
|
void (*cpu_down)(void);
|
2009-05-28 00:12:36 +00:00
|
|
|
int (*check_ctrs)(struct pt_regs * const regs,
|
|
|
|
struct op_msrs const * const msrs);
|
|
|
|
void (*start)(struct op_msrs const * const msrs);
|
|
|
|
void (*stop)(struct op_msrs const * const msrs);
|
|
|
|
void (*shutdown)(struct op_msrs const * const msrs);
|
2009-07-08 11:49:38 +00:00
|
|
|
#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
|
|
|
|
void (*switch_ctrl)(struct op_x86_model_spec const *model,
|
|
|
|
struct op_msrs const * const msrs);
|
|
|
|
#endif
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|
|
|
|
|
2009-05-25 13:10:32 +00:00
|
|
|
struct op_counter_config;
|
|
|
|
|
2010-02-23 17:14:58 +00:00
|
|
|
static inline void op_x86_warn_in_use(int counter)
|
|
|
|
{
|
2010-02-23 17:14:58 +00:00
|
|
|
/*
|
|
|
|
* The warning indicates an already running counter. If
|
|
|
|
* oprofile doesn't collect data, then try using a different
|
|
|
|
* performance counter on your platform to monitor the desired
|
|
|
|
* event. Delete counter #%d from the desired event by editing
|
|
|
|
* the /usr/share/oprofile/%s/<cpu>/events file. If the event
|
|
|
|
* cannot be monitored by any other counter, contact your
|
|
|
|
* hardware or BIOS vendor.
|
|
|
|
*/
|
2010-02-23 17:14:58 +00:00
|
|
|
pr_warning("oprofile: counter #%d on cpu #%d may already be used\n",
|
|
|
|
counter, smp_processor_id());
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void op_x86_warn_reserved(int counter)
|
|
|
|
{
|
|
|
|
pr_warning("oprofile: counter #%d is already reserved\n", counter);
|
|
|
|
}
|
|
|
|
|
2009-05-25 13:10:32 +00:00
|
|
|
extern u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
|
|
|
|
struct op_counter_config *counter_config);
|
2009-07-16 11:04:43 +00:00
|
|
|
extern int op_x86_phys_to_virt(int phys);
|
2009-07-10 13:47:17 +00:00
|
|
|
extern int op_x86_virt_to_phys(int virt);
|
2009-05-25 13:10:32 +00:00
|
|
|
|
2009-07-09 13:12:35 +00:00
|
|
|
extern struct op_x86_model_spec op_ppro_spec;
|
|
|
|
extern struct op_x86_model_spec op_p4_spec;
|
|
|
|
extern struct op_x86_model_spec op_p4_ht2_spec;
|
|
|
|
extern struct op_x86_model_spec op_amd_spec;
|
2008-08-18 12:50:31 +00:00
|
|
|
extern struct op_x86_model_spec op_arch_perfmon_spec;
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif /* OP_X86_MODEL_H */
|