History

perf/headers: Clean up <linux/perf_event.h> a bit

Do a bit of readability spring cleaning: - Fix misaligned structure member in perf_addr_filter: the new struct perf_addr_filter::action member was too long, but when it was added it was not aligned properly. Align all fields to the customary column 41 alignment of most of the rest of the header. - Adjust the vertical alignment of the definition of other structures and definitions as well, so that the 'most of' in the previous paragraph changes to 'all of'. ;-) - Prettify the assignments in perf_clear_branch_entry_bitfields() - Move comments from CPP definitions to outside the macro - Move perf_guest_info_callbacks and related defines from the front of the header closer to where it's used within the header. - And more #endif markers for larger CPP blocks and standardize #if/#else/#endif blocks to the following nomenclature: #ifdef CONFIG_FOO ... #else /* !CONFIG_FOO: */ ... #endif /* !CONFIG_FOO */ - Standardize on consistently using the 'extern' storage class where appropriate, we had cases where method prototypes sometimes omitted the storage class: extern void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu); int perf_event_read_local(struct perf_event *event, u64 *value, u64 *enabled, u64 *running); extern u64 perf_event_read_value(struct perf_event *event, u64 *enabled, u64 *running); Which is obviously a bit confusing and adds unnecessary noise. - s/__u64/u64 and similar cleanups: there's no point in using __u64 in non-UAPI headers, and doing so only adds unnecessary visual noise. - Harmonize all multi-parameter function prototypes along the following style: extern struct perf_event * perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu, struct task_struct *task, perf_overflow_handler_t callback, void *context); - etc.

Ingo Molnar committed 1 year ago

Commit e7d952c1 parent 44889ff1 file · +155 −127Browse files

Unified · Split

include/linux/perf_event.h+155−127
@@ -26,18 +26,9 @@ · 25 unmodified lines
26# include <asm/local64.h>26# include <asm/local64.h>
27#endif27#endif
28 28
29#define PERF_GUEST_ACTIVE 0x01
30#define PERF_GUEST_USER 0x02
31
32struct perf_guest_info_callbacks {
33 unsigned int (*state)(void);
34 unsigned long (*get_ip)(void);
35 unsigned int (*handle_intel_pt_intr)(void);
36};
37
38#ifdef CONFIG_HAVE_HW_BREAKPOINT29#ifdef CONFIG_HAVE_HW_BREAKPOINT
39#include <linux/rhashtable-types.h>30# include <linux/rhashtable-types.h>
40#include <asm/hw_breakpoint.h>31# include <asm/hw_breakpoint.h>
41#endif32#endif
42 33
43#include <linux/list.h>34#include <linux/list.h>
@@ -62,19 +53,20 @@ struct perf_guest_info_callbacks { · 18 unmodified lines
62#include <linux/security.h>53#include <linux/security.h>
63#include <linux/static_call.h>54#include <linux/static_call.h>
64#include <linux/lockdep.h>55#include <linux/lockdep.h>
56
65#include <asm/local.h>57#include <asm/local.h>
66 58
67struct perf_callchain_entry {59struct perf_callchain_entry {
68 __u64 nr;60 u64 nr;
69 __u64 ip[]; /* /proc/sys/kernel/perf_event_max_stack */61 u64 ip[]; /* /proc/sys/kernel/perf_event_max_stack */
70};62};
71 63
72struct perf_callchain_entry_ctx {64struct perf_callchain_entry_ctx {
73 struct perf_callchain_entry *entry;65 struct perf_callchain_entry *entry;
74 u32 max_stack;66 u32 max_stack;
75 u32 nr;67 u32 nr;
76 short contexts;68 short contexts;
77 bool contexts_maxed;69 bool contexts_maxed;
78};70};
79 71
80typedef unsigned long (*perf_copy_f)(void *dst, const void *src,72typedef unsigned long (*perf_copy_f)(void *dst, const void *src,
@@ -121,8 +113,8 @@ static __always_inline bool perf_raw_frag_last(const struct perf_raw_frag *frag) · 40 unmodified lines
121 * already stored in age order, the hw_idx should be 0.113 * already stored in age order, the hw_idx should be 0.
122 */114 */
123struct perf_branch_stack {115struct perf_branch_stack {
124 __u64 nr;116 u64 nr;
125 __u64 hw_idx;117 u64 hw_idx;
126 struct perf_branch_entry entries[];118 struct perf_branch_entry entries[];
127};119};
128 120
@@ -132,10 +124,10 @@ struct task_struct; · 3 unmodified lines
132 * extra PMU register associated with an event124 * extra PMU register associated with an event
133 */125 */
134struct hw_perf_event_extra {126struct hw_perf_event_extra {
135 u64 config; /* register value */127 u64 config; /* register value */
136 unsigned int reg; /* register address or index */128 unsigned int reg; /* register address or index */
137 int alloc; /* extra register already allocated */129 int alloc; /* extra register already allocated */
138 int idx; /* index in shared_regs->regs[] */130 int idx; /* index in shared_regs->regs[] */
139};131};
140 132
141/**133/**
@@ -144,8 +136,8 @@ struct hw_perf_event_extra { · 2 unmodified lines
144 * PERF_EVENT_FLAG_ARCH bits are reserved for architecture-specific136 * PERF_EVENT_FLAG_ARCH bits are reserved for architecture-specific
145 * usage.137 * usage.
146 */138 */
147#define PERF_EVENT_FLAG_ARCH 0x0fffffff139#define PERF_EVENT_FLAG_ARCH 0x0fffffff
148#define PERF_EVENT_FLAG_USER_READ_CNT 0x80000000140#define PERF_EVENT_FLAG_USER_READ_CNT 0x80000000
149 141
150static_assert((PERF_EVENT_FLAG_USER_READ_CNT & PERF_EVENT_FLAG_ARCH) == 0);142static_assert((PERF_EVENT_FLAG_USER_READ_CNT & PERF_EVENT_FLAG_ARCH) == 0);
151 143
@@ -227,9 +219,14 @@ struct hw_perf_event { · 75 unmodified lines
227/*219/*
228 * hw_perf_event::state flags; used to track the PERF_EF_* state.220 * hw_perf_event::state flags; used to track the PERF_EF_* state.
229 */221 */
230#define PERF_HES_STOPPED 0x01 /* the counter is stopped */222
231#define PERF_HES_UPTODATE 0x02 /* event->count up-to-date */223/* the counter is stopped */
232#define PERF_HES_ARCH 0x04224#define PERF_HES_STOPPED 0x01
225
226/* event->count up-to-date */
227#define PERF_HES_UPTODATE 0x02
228
229#define PERF_HES_ARCH 0x04
233 230
234 int state;231 int state;
235 232
@@ -278,7 +275,7 @@ struct hw_perf_event { · 42 unmodified lines
278 */275 */
279 u64 freq_time_stamp;276 u64 freq_time_stamp;
280 u64 freq_count_stamp;277 u64 freq_count_stamp;
281#endif278#endif /* CONFIG_PERF_EVENTS */
282};279};
283 280
284struct perf_event;281struct perf_event;
@@ -287,29 +284,33 @@ struct perf_event_pmu_context; · 2 unmodified lines
287/*284/*
288 * Common implementation detail of pmu::{start,commit,cancel}_txn285 * Common implementation detail of pmu::{start,commit,cancel}_txn
289 */286 */
290#define PERF_PMU_TXN_ADD 0x1 /* txn to add/schedule event on PMU */287
291#define PERF_PMU_TXN_READ 0x2 /* txn to read event group from PMU */288/* txn to add/schedule event on PMU */
289#define PERF_PMU_TXN_ADD 0x1
290
291/* txn to read event group from PMU */
292#define PERF_PMU_TXN_READ 0x2
292 293
293/**294/**
294 * pmu::capabilities flags295 * pmu::capabilities flags
295 */296 */
296#define PERF_PMU_CAP_NO_INTERRUPT 0x0001297#define PERF_PMU_CAP_NO_INTERRUPT 0x0001
297#define PERF_PMU_CAP_NO_NMI 0x0002298#define PERF_PMU_CAP_NO_NMI 0x0002
298#define PERF_PMU_CAP_AUX_NO_SG 0x0004299#define PERF_PMU_CAP_AUX_NO_SG 0x0004
299#define PERF_PMU_CAP_EXTENDED_REGS 0x0008300#define PERF_PMU_CAP_EXTENDED_REGS 0x0008
300#define PERF_PMU_CAP_EXCLUSIVE 0x0010301#define PERF_PMU_CAP_EXCLUSIVE 0x0010
301#define PERF_PMU_CAP_ITRACE 0x0020302#define PERF_PMU_CAP_ITRACE 0x0020
302#define PERF_PMU_CAP_NO_EXCLUDE 0x0040303#define PERF_PMU_CAP_NO_EXCLUDE 0x0040
303#define PERF_PMU_CAP_AUX_OUTPUT 0x0080304#define PERF_PMU_CAP_AUX_OUTPUT 0x0080
304#define PERF_PMU_CAP_EXTENDED_HW_TYPE 0x0100305#define PERF_PMU_CAP_EXTENDED_HW_TYPE 0x0100
305#define PERF_PMU_CAP_AUX_PAUSE 0x0200306#define PERF_PMU_CAP_AUX_PAUSE 0x0200
306#define PERF_PMU_CAP_AUX_PREFER_LARGE 0x0400307#define PERF_PMU_CAP_AUX_PREFER_LARGE 0x0400
307 308
308/**309/**
309 * pmu::scope310 * pmu::scope
310 */311 */
311enum perf_pmu_scope {312enum perf_pmu_scope {
312 PERF_PMU_SCOPE_NONE = 0,313 PERF_PMU_SCOPE_NONE = 0,
313 PERF_PMU_SCOPE_CORE,314 PERF_PMU_SCOPE_CORE,
314 PERF_PMU_SCOPE_DIE,315 PERF_PMU_SCOPE_DIE,
315 PERF_PMU_SCOPE_CLUSTER,316 PERF_PMU_SCOPE_CLUSTER,
@@ -393,11 +394,21 @@ struct pmu { · 77 unmodified lines
393 * Flags for ->add()/->del()/ ->start()/->stop(). There are394 * Flags for ->add()/->del()/ ->start()/->stop(). There are
394 * matching hw_perf_event::state flags.395 * matching hw_perf_event::state flags.
395 */396 */
396#define PERF_EF_START 0x01 /* start the counter when adding */397
397#define PERF_EF_RELOAD 0x02 /* reload the counter when starting */398/* start the counter when adding */
398#define PERF_EF_UPDATE 0x04 /* update the counter when stopping */399#define PERF_EF_START 0x01
399#define PERF_EF_PAUSE 0x08 /* AUX area event, pause tracing */400
400#define PERF_EF_RESUME 0x10 /* AUX area event, resume tracing */401/* reload the counter when starting */
402#define PERF_EF_RELOAD 0x02
403
404/* update the counter when stopping */
405#define PERF_EF_UPDATE 0x04
406
407/* AUX area event, pause tracing */
408#define PERF_EF_PAUSE 0x08
409
410/* AUX area event, resume tracing */
411#define PERF_EF_RESUME 0x10
401 412
402 /*413 /*
403 * Adds/Removes a counter to/from the PMU, can be done inside a414 * Adds/Removes a counter to/from the PMU, can be done inside a
@@ -596,10 +607,10 @@ enum perf_addr_filter_action_t { · 192 unmodified lines
596 * This is a hardware-agnostic filter configuration as specified by the user.607 * This is a hardware-agnostic filter configuration as specified by the user.
597 */608 */
598struct perf_addr_filter {609struct perf_addr_filter {
599 struct list_head entry;610 struct list_head entry;
600 struct path path;611 struct path path;
601 unsigned long offset;612 unsigned long offset;
602 unsigned long size;613 unsigned long size;
603 enum perf_addr_filter_action_t action;614 enum perf_addr_filter_action_t action;
604};615};
605 616
@@ -614,14 +625,14 @@ struct perf_addr_filter { · 8 unmodified lines
614 * bundled together; see perf_event_addr_filters().625 * bundled together; see perf_event_addr_filters().
615 */626 */
616struct perf_addr_filters_head {627struct perf_addr_filters_head {
617 struct list_head list;628 struct list_head list;
618 raw_spinlock_t lock;629 raw_spinlock_t lock;
619 unsigned int nr_file_filters;630 unsigned int nr_file_filters;
620};631};
621 632
622struct perf_addr_filter_range {633struct perf_addr_filter_range {
623 unsigned long start;634 unsigned long start;
624 unsigned long size;635 unsigned long size;
625};636};
626 637
627/**638/**
@@ -669,24 +680,24 @@ struct swevent_hlist { · 41 unmodified lines
669 struct rcu_head rcu_head;680 struct rcu_head rcu_head;
670};681};
671 682
672#define PERF_ATTACH_CONTEXT 0x0001683#define PERF_ATTACH_CONTEXT 0x0001
673#define PERF_ATTACH_GROUP 0x0002684#define PERF_ATTACH_GROUP 0x0002
674#define PERF_ATTACH_TASK 0x0004685#define PERF_ATTACH_TASK 0x0004
675#define PERF_ATTACH_TASK_DATA 0x0008686#define PERF_ATTACH_TASK_DATA 0x0008
676#define PERF_ATTACH_GLOBAL_DATA 0x0010687#define PERF_ATTACH_GLOBAL_DATA 0x0010
677#define PERF_ATTACH_SCHED_CB 0x0020688#define PERF_ATTACH_SCHED_CB 0x0020
678#define PERF_ATTACH_CHILD 0x0040689#define PERF_ATTACH_CHILD 0x0040
679#define PERF_ATTACH_EXCLUSIVE 0x0080690#define PERF_ATTACH_EXCLUSIVE 0x0080
680#define PERF_ATTACH_CALLCHAIN 0x0100691#define PERF_ATTACH_CALLCHAIN 0x0100
681#define PERF_ATTACH_ITRACE 0x0200692#define PERF_ATTACH_ITRACE 0x0200
682 693
683struct bpf_prog;694struct bpf_prog;
684struct perf_cgroup;695struct perf_cgroup;
685struct perf_buffer;696struct perf_buffer;
686 697
687struct pmu_event_list {698struct pmu_event_list {
688 raw_spinlock_t lock;699 raw_spinlock_t lock;
689 struct list_head list;700 struct list_head list;
690};701};
691 702
692/*703/*
@@ -696,12 +707,12 @@ struct pmu_event_list { · 3 unmodified lines
696 * disabled is sufficient since it will hold-off the IPIs.707 * disabled is sufficient since it will hold-off the IPIs.
697 */708 */
698#ifdef CONFIG_PROVE_LOCKING709#ifdef CONFIG_PROVE_LOCKING
699#define lockdep_assert_event_ctx(event) \710# define lockdep_assert_event_ctx(event) \
700 WARN_ON_ONCE(__lockdep_enabled && \711 WARN_ON_ONCE(__lockdep_enabled && \
701 (this_cpu_read(hardirqs_enabled) && \712 (this_cpu_read(hardirqs_enabled) && \
702 lockdep_is_held(&(event)->ctx->mutex) != LOCK_STATE_HELD))713 lockdep_is_held(&(event)->ctx->mutex) != LOCK_STATE_HELD))
703#else714#else
704#define lockdep_assert_event_ctx(event)715# define lockdep_assert_event_ctx(event)
705#endif716#endif
706 717
707#define for_each_sibling_event(sibling, event) \718#define for_each_sibling_event(sibling, event) \
@@ -859,9 +870,9 @@ struct perf_event { · 151 unmodified lines
859#ifdef CONFIG_EVENT_TRACING870#ifdef CONFIG_EVENT_TRACING
860 struct trace_event_call *tp_event;871 struct trace_event_call *tp_event;
861 struct event_filter *filter;872 struct event_filter *filter;
862#ifdef CONFIG_FUNCTION_TRACER873# ifdef CONFIG_FUNCTION_TRACER
863 struct ftrace_ops ftrace_ops;874 struct ftrace_ops ftrace_ops;
864#endif875# endif
865#endif876#endif
866 877
867#ifdef CONFIG_CGROUP_PERF878#ifdef CONFIG_CGROUP_PERF
@@ -880,7 +891,7 @@ struct perf_event { · 12 unmodified lines
880 * of it. event->orig_type contains original 'type' requested by891 * of it. event->orig_type contains original 'type' requested by
881 * user.892 * user.
882 */893 */
883 __u32 orig_type;894 u32 orig_type;
884#endif /* CONFIG_PERF_EVENTS */895#endif /* CONFIG_PERF_EVENTS */
885};896};
886 897
@@ -945,8 +956,8 @@ static inline bool perf_pmu_ctx_is_active(struct perf_event_pmu_context *epc) · 58 unmodified lines
945}956}
946 957
947struct perf_event_groups {958struct perf_event_groups {
948 struct rb_root tree;959 struct rb_root tree;
949 u64 index;960 u64 index;
950};961};
951 962
952 963
@@ -1189,16 +1200,18 @@ extern void perf_pmu_resched(struct pmu *pmu); · 236 unmodified lines
1189extern int perf_event_refresh(struct perf_event *event, int refresh);1200extern int perf_event_refresh(struct perf_event *event, int refresh);
1190extern void perf_event_update_userpage(struct perf_event *event);1201extern void perf_event_update_userpage(struct perf_event *event);
1191extern int perf_event_release_kernel(struct perf_event *event);1202extern int perf_event_release_kernel(struct perf_event *event);
1203
1192extern struct perf_event *1204extern struct perf_event *
1193perf_event_create_kernel_counter(struct perf_event_attr *attr,1205perf_event_create_kernel_counter(struct perf_event_attr *attr,
1194 int cpu,1206 int cpu,
1195 struct task_struct *task,1207 struct task_struct *task,
1196 perf_overflow_handler_t callback,1208 perf_overflow_handler_t callback,
1197 void *context);1209 void *context);
1210
1198extern void perf_pmu_migrate_context(struct pmu *pmu,1211extern void perf_pmu_migrate_context(struct pmu *pmu,
1199 int src_cpu, int dst_cpu);1212 int src_cpu, int dst_cpu);
1200int perf_event_read_local(struct perf_event *event, u64 *value,1213extern int perf_event_read_local(struct perf_event *event, u64 *value,
1201 u64 *enabled, u64 *running);1214 u64 *enabled, u64 *running);
1202extern u64 perf_event_read_value(struct perf_event *event,1215extern u64 perf_event_read_value(struct perf_event *event,
1203 u64 *enabled, u64 *running);1216 u64 *enabled, u64 *running);
1204 1217
@@ -1415,14 +1428,14 @@ static inline u32 perf_sample_data_size(struct perf_sample_data *data, · 210 unmodified lines
1415 */1428 */
1416static inline void perf_clear_branch_entry_bitfields(struct perf_branch_entry *br)1429static inline void perf_clear_branch_entry_bitfields(struct perf_branch_entry *br)
1417{1430{
1418 br->mispred = 0;1431 br->mispred = 0;
1419 br->predicted = 0;1432 br->predicted = 0;
1420 br->in_tx = 0;1433 br->in_tx = 0;
1421 br->abort = 0;1434 br->abort = 0;
1422 br->cycles = 0;1435 br->cycles = 0;
1423 br->type = 0;1436 br->type = 0;
1424 br->spec = PERF_BR_SPEC_NA;1437 br->spec = PERF_BR_SPEC_NA;
1425 br->reserved = 0;1438 br->reserved = 0;
1426}1439}
1427 1440
1428extern void perf_output_sample(struct perf_output_handle *handle,1441extern void perf_output_sample(struct perf_output_handle *handle,
@@ -1611,7 +1624,17 @@ extern void perf_event_bpf_event(struct bpf_prog *prog, · 182 unmodified lines
1611 enum perf_bpf_event_type type,1624 enum perf_bpf_event_type type,
1612 u16 flags);1625 u16 flags);
1613 1626
1627#define PERF_GUEST_ACTIVE 0x01
1628#define PERF_GUEST_USER 0x02
1629
1630struct perf_guest_info_callbacks {
1631 unsigned int (*state)(void);
1632 unsigned long (*get_ip)(void);
1633 unsigned int (*handle_intel_pt_intr)(void);
1634};
1635
1614#ifdef CONFIG_GUEST_PERF_EVENTS1636#ifdef CONFIG_GUEST_PERF_EVENTS
1637
1615extern struct perf_guest_info_callbacks __rcu *perf_guest_cbs;1638extern struct perf_guest_info_callbacks __rcu *perf_guest_cbs;
1616 1639
1617DECLARE_STATIC_CALL(__perf_guest_state, *perf_guest_cbs->state);1640DECLARE_STATIC_CALL(__perf_guest_state, *perf_guest_cbs->state);
@@ -1622,21 +1645,27 @@ static inline unsigned int perf_guest_state(void) · 4 unmodified lines
1622{1645{
1623 return static_call(__perf_guest_state)();1646 return static_call(__perf_guest_state)();
1624}1647}
1648
1625static inline unsigned long perf_guest_get_ip(void)1649static inline unsigned long perf_guest_get_ip(void)
1626{1650{
1627 return static_call(__perf_guest_get_ip)();1651 return static_call(__perf_guest_get_ip)();
1628}1652}
1653
1629static inline unsigned int perf_guest_handle_intel_pt_intr(void)1654static inline unsigned int perf_guest_handle_intel_pt_intr(void)
1630{1655{
1631 return static_call(__perf_guest_handle_intel_pt_intr)();1656 return static_call(__perf_guest_handle_intel_pt_intr)();
1632}1657}
1658
1633extern void perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *cbs);1659extern void perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *cbs);
1634extern void perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *cbs);1660extern void perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *cbs);
1635#else1661
1662#else /* !CONFIG_GUEST_PERF_EVENTS: */
1663
1636static inline unsigned int perf_guest_state(void) { return 0; }1664static inline unsigned int perf_guest_state(void) { return 0; }
1637static inline unsigned long perf_guest_get_ip(void) { return 0; }1665static inline unsigned long perf_guest_get_ip(void) { return 0; }
1638static inline unsigned int perf_guest_handle_intel_pt_intr(void) { return 0; }1666static inline unsigned int perf_guest_handle_intel_pt_intr(void) { return 0; }
1639#endif /* CONFIG_GUEST_PERF_EVENTS */1667
1668#endif /* !CONFIG_GUEST_PERF_EVENTS */
1640 1669
1641extern void perf_event_exec(void);1670extern void perf_event_exec(void);
1642extern void perf_event_comm(struct task_struct *tsk, bool exec);1671extern void perf_event_comm(struct task_struct *tsk, bool exec);
@@ -1666,6 +1695,7 @@ static inline int perf_callchain_store_context(struct perf_callchain_entry_ctx * · 23 unmodified lines
1666{1695{
1667 if (ctx->contexts < sysctl_perf_event_max_contexts_per_stack) {1696 if (ctx->contexts < sysctl_perf_event_max_contexts_per_stack) {
1668 struct perf_callchain_entry *entry = ctx->entry;1697 struct perf_callchain_entry *entry = ctx->entry;
1698
1669 entry->ip[entry->nr++] = ip;1699 entry->ip[entry->nr++] = ip;
1670 ++ctx->contexts;1700 ++ctx->contexts;
1671 return 0;1701 return 0;
@@ -1679,6 +1709,7 @@ static inline int perf_callchain_store(struct perf_callchain_entry_ctx *ctx, u64 · 7 unmodified lines
1679{1709{
1680 if (ctx->nr < ctx->max_stack && !ctx->contexts_maxed) {1710 if (ctx->nr < ctx->max_stack && !ctx->contexts_maxed) {
1681 struct perf_callchain_entry *entry = ctx->entry;1711 struct perf_callchain_entry *entry = ctx->entry;
1712
1682 entry->ip[entry->nr++] = ip;1713 entry->ip[entry->nr++] = ip;
1683 ++ctx->nr;1714 ++ctx->nr;
1684 return 0;1715 return 0;
@@ -1705,7 +1736,7 @@ static inline int perf_is_paranoid(void) · 20 unmodified lines
1705 return sysctl_perf_event_paranoid > -1;1736 return sysctl_perf_event_paranoid > -1;
1706}1737}
1707 1738
1708int perf_allow_kernel(void);1739extern int perf_allow_kernel(void);
1709 1740
1710static inline int perf_allow_cpu(void)1741static inline int perf_allow_cpu(void)
1711{1742{
@@ -1827,7 +1858,7 @@ extern int perf_output_begin_backward(struct perf_output_handle *handle, · 115 unmodified lines
1827 1858
1828extern void perf_output_end(struct perf_output_handle *handle);1859extern void perf_output_end(struct perf_output_handle *handle);
1829extern unsigned int perf_output_copy(struct perf_output_handle *handle,1860extern unsigned int perf_output_copy(struct perf_output_handle *handle,
1830 const void *buf, unsigned int len);1861 const void *buf, unsigned int len);
1831extern unsigned int perf_output_skip(struct perf_output_handle *handle,1862extern unsigned int perf_output_skip(struct perf_output_handle *handle,
1832 unsigned int len);1863 unsigned int len);
1833extern long perf_output_copy_aux(struct perf_output_handle *aux_handle,1864extern long perf_output_copy_aux(struct perf_output_handle *aux_handle,
@@ -1844,7 +1875,9 @@ extern void perf_event_task_tick(void); · 10 unmodified lines
1844extern int perf_event_account_interrupt(struct perf_event *event);1875extern int perf_event_account_interrupt(struct perf_event *event);
1845extern int perf_event_period(struct perf_event *event, u64 value);1876extern int perf_event_period(struct perf_event *event, u64 value);
1846extern u64 perf_event_pause(struct perf_event *event, bool reset);1877extern u64 perf_event_pause(struct perf_event *event, bool reset);
1878
1847#else /* !CONFIG_PERF_EVENTS: */1879#else /* !CONFIG_PERF_EVENTS: */
1880
1848static inline void *1881static inline void *
1849perf_aux_output_begin(struct perf_output_handle *handle,1882perf_aux_output_begin(struct perf_output_handle *handle,
1850 struct perf_event *event) { return NULL; }1883 struct perf_event *event) { return NULL; }
@@ -1922,19 +1955,14 @@ static inline void perf_event_disable(struct perf_event *event) { } · 71 unmodified lines
1922static inline int __perf_event_disable(void *info) { return -1; }1955static inline int __perf_event_disable(void *info) { return -1; }
1923static inline void perf_event_task_tick(void) { }1956static inline void perf_event_task_tick(void) { }
1924static inline int perf_event_release_kernel(struct perf_event *event) { return 0; }1957static inline int perf_event_release_kernel(struct perf_event *event) { return 0; }
1925static inline int perf_event_period(struct perf_event *event, u64 value)1958static inline int
1926{1959perf_event_period(struct perf_event *event, u64 value) { return -EINVAL; }
1927 return -EINVAL;1960static inline u64
1928}1961perf_event_pause(struct perf_event *event, bool reset) { return 0; }
1929static inline u64 perf_event_pause(struct perf_event *event, bool reset)1962static inline int
1930{1963perf_exclude_event(struct perf_event *event, struct pt_regs *regs) { return 0; }
1931 return 0;1964
1932}1965#endif /* !CONFIG_PERF_EVENTS */
1933static inline int perf_exclude_event(struct perf_event *event, struct pt_regs *regs)
1934{
1935 return 0;
1936}
1937#endif
1938 1966
1939#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL)1967#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL)
1940extern void perf_restore_debug_store(void);1968extern void perf_restore_debug_store(void);
@@ -1942,31 +1970,31 @@ extern void perf_restore_debug_store(void); · 1 unmodified line
1942static inline void perf_restore_debug_store(void) { }1970static inline void perf_restore_debug_store(void) { }
1943#endif1971#endif
1944 1972
1945#define perf_output_put(handle, x) perf_output_copy((handle), &(x), sizeof(x))1973#define perf_output_put(handle, x) perf_output_copy((handle), &(x), sizeof(x))
1946 1974
1947struct perf_pmu_events_attr {1975struct perf_pmu_events_attr {
1948 struct device_attribute attr;1976 struct device_attribute attr;
1949 u64 id;1977 u64 id;
1950 const char *event_str;1978 const char *event_str;
1951};1979};
1952 1980
1953struct perf_pmu_events_ht_attr {1981struct perf_pmu_events_ht_attr {
1954 struct device_attribute attr;1982 struct device_attribute attr;
1955 u64 id;1983 u64 id;
1956 const char *event_str_ht;1984 const char *event_str_ht;
1957 const char *event_str_noht;1985 const char *event_str_noht;
1958};1986};
1959 1987
1960struct perf_pmu_events_hybrid_attr {1988struct perf_pmu_events_hybrid_attr {
1961 struct device_attribute attr;1989 struct device_attribute attr;
1962 u64 id;1990 u64 id;
1963 const char *event_str;1991 const char *event_str;
1964 u64 pmu_type;1992 u64 pmu_type;
1965};1993};
1966 1994
1967struct perf_pmu_format_hybrid_attr {1995struct perf_pmu_format_hybrid_attr {
1968 struct device_attribute attr;1996 struct device_attribute attr;
1969 u64 pmu_type;1997 u64 pmu_type;
1970};1998};
1971 1999
1972ssize_t perf_event_sysfs_show(struct device *dev, struct device_attribute *attr,2000ssize_t perf_event_sysfs_show(struct device *dev, struct device_attribute *attr,
@@ -2008,11 +2036,11 @@ static struct device_attribute format_attr_##_name = __ATTR_RO(_name) · 35 unmodified lines
2008 2036
2009/* Performance counter hotplug functions */2037/* Performance counter hotplug functions */
2010#ifdef CONFIG_PERF_EVENTS2038#ifdef CONFIG_PERF_EVENTS
2011int perf_event_init_cpu(unsigned int cpu);2039extern int perf_event_init_cpu(unsigned int cpu);
2012int perf_event_exit_cpu(unsigned int cpu);2040extern int perf_event_exit_cpu(unsigned int cpu);
2013#else2041#else
2014#define perf_event_init_cpu NULL2042# define perf_event_init_cpu NULL
2015#define perf_event_exit_cpu NULL2043# define perf_event_exit_cpu NULL
2016#endif2044#endif
2017 2045
2018extern void arch_perf_update_userpage(struct perf_event *event,2046extern void arch_perf_update_userpage(struct perf_event *event,