]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - include/linux/perf_event.h
perf, arch: Add generic NODE cache events
[mirror_ubuntu-artful-kernel.git] / include / linux / perf_event.h
index 3412684ce5d541176ba1e5b64f09244e8d3cdc45..a5f54b973bdbd0150db6fb0cd0361a09fb16db47 100644 (file)
@@ -61,7 +61,7 @@ enum perf_hw_id {
 /*
  * Generalized hardware cache events:
  *
- *       { L1-D, L1-I, LLC, ITLB, DTLB, BPU } x
+ *       { L1-D, L1-I, LLC, ITLB, DTLB, BPU, NODE } x
  *       { read, write, prefetch } x
  *       { accesses, misses }
  */
@@ -72,6 +72,7 @@ enum perf_hw_cache_id {
        PERF_COUNT_HW_CACHE_DTLB                = 3,
        PERF_COUNT_HW_CACHE_ITLB                = 4,
        PERF_COUNT_HW_CACHE_BPU                 = 5,
+       PERF_COUNT_HW_CACHE_NODE                = 6,
 
        PERF_COUNT_HW_CACHE_MAX,                /* non-ABI */
 };
@@ -137,14 +138,14 @@ enum perf_event_sample_format {
  *
  * struct read_format {
  *     { u64           value;
- *       { u64         time_enabled; } && PERF_FORMAT_ENABLED
- *       { u64         time_running; } && PERF_FORMAT_RUNNING
+ *       { u64         time_enabled; } && PERF_FORMAT_TOTAL_TIME_ENABLED
+ *       { u64         time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING
  *       { u64         id;           } && PERF_FORMAT_ID
  *     } && !PERF_FORMAT_GROUP
  *
  *     { u64           nr;
- *       { u64         time_enabled; } && PERF_FORMAT_ENABLED
- *       { u64         time_running; } && PERF_FORMAT_RUNNING
+ *       { u64         time_enabled; } && PERF_FORMAT_TOTAL_TIME_ENABLED
+ *       { u64         time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING
  *       { u64         value;
  *         { u64       id;           } && PERF_FORMAT_ID
  *       }             cntr[nr];
@@ -536,6 +537,16 @@ struct perf_branch_stack {
 
 struct task_struct;
 
+/*
+ * extra PMU register associated with an event
+ */
+struct hw_perf_event_extra {
+       u64             config; /* register value */
+       unsigned int    reg;    /* register address or index */
+       int             alloc;  /* extra register already allocated */
+       int             idx;    /* index in shared_regs->regs[] */
+};
+
 /**
  * struct hw_perf_event - performance event hardware details:
  */
@@ -549,9 +560,7 @@ struct hw_perf_event {
                        unsigned long   event_base;
                        int             idx;
                        int             last_cpu;
-                       unsigned int    extra_reg;
-                       u64             extra_config;
-                       int             extra_alloc;
+                       struct hw_perf_event_extra extra_reg;
                };
                struct { /* software */
                        struct hrtimer  hrtimer;
@@ -680,36 +689,9 @@ enum perf_event_active_state {
 };
 
 struct file;
-
-#define PERF_BUFFER_WRITABLE           0x01
-
-struct perf_buffer {
-       atomic_t                        refcount;
-       struct rcu_head                 rcu_head;
-#ifdef CONFIG_PERF_USE_VMALLOC
-       struct work_struct              work;
-       int                             page_order;     /* allocation order  */
-#endif
-       int                             nr_pages;       /* nr of data pages  */
-       int                             writable;       /* are we writable   */
-
-       atomic_t                        poll;           /* POLL_ for wakeups */
-
-       local_t                         head;           /* write position    */
-       local_t                         nest;           /* nested writers    */
-       local_t                         events;         /* event limit       */
-       local_t                         wakeup;         /* wakeup stamp      */
-       local_t                         lost;           /* nr records lost   */
-
-       long                            watermark;      /* wakeup watermark  */
-
-       struct perf_event_mmap_page     *user_page;
-       void                            *data_pages[0];
-};
-
 struct perf_sample_data;
 
-typedef void (*perf_overflow_handler_t)(struct perf_event *, int,
+typedef void (*perf_overflow_handler_t)(struct perf_event *,
                                        struct perf_sample_data *,
                                        struct pt_regs *regs);
 
@@ -745,6 +727,8 @@ struct perf_cgroup {
 };
 #endif
 
+struct ring_buffer;
+
 /**
  * struct perf_event - performance event kernel representation:
  */
@@ -834,7 +818,7 @@ struct perf_event {
        atomic_t                        mmap_count;
        int                             mmap_locked;
        struct user_struct              *mmap_user;
-       struct perf_buffer              *buffer;
+       struct ring_buffer              *rb;
 
        /* poll related */
        wait_queue_head_t               waitq;
@@ -919,8 +903,8 @@ struct perf_event_context {
        u64                             parent_gen;
        u64                             generation;
        int                             pin_count;
-       struct rcu_head                 rcu_head;
        int                             nr_cgroups; /* cgroup events present */
+       struct rcu_head                 rcu_head;
 };
 
 /*
@@ -945,13 +929,11 @@ struct perf_cpu_context {
 
 struct perf_output_handle {
        struct perf_event               *event;
-       struct perf_buffer              *buffer;
+       struct ring_buffer              *rb;
        unsigned long                   wakeup;
        unsigned long                   size;
        void                            *addr;
        int                             page;
-       int                             nmi;
-       int                             sample;
 };
 
 #ifdef CONFIG_PERF_EVENTS
@@ -1018,7 +1000,7 @@ extern void perf_prepare_sample(struct perf_event_header *header,
                                struct perf_event *event,
                                struct pt_regs *regs);
 
-extern int perf_event_overflow(struct perf_event *event, int nmi,
+extern int perf_event_overflow(struct perf_event *event,
                                 struct perf_sample_data *data,
                                 struct pt_regs *regs);
 
@@ -1037,7 +1019,7 @@ static inline int is_software_event(struct perf_event *event)
 
 extern struct jump_label_key perf_swevent_enabled[PERF_COUNT_SW_MAX];
 
-extern void __perf_sw_event(u32, u64, int, struct pt_regs *, u64);
+extern void __perf_sw_event(u32, u64, struct pt_regs *, u64);
 
 #ifndef perf_arch_fetch_caller_regs
 static inline void perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip) { }
@@ -1059,7 +1041,7 @@ static inline void perf_fetch_caller_regs(struct pt_regs *regs)
 }
 
 static __always_inline void
-perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
+perf_sw_event(u32 event_id, u64 nr, struct pt_regs *regs, u64 addr)
 {
        struct pt_regs hot_regs;
 
@@ -1068,7 +1050,7 @@ perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
                        perf_fetch_caller_regs(&hot_regs);
                        regs = &hot_regs;
                }
-               __perf_sw_event(event_id, nr, nmi, regs, addr);
+               __perf_sw_event(event_id, nr, regs, addr);
        }
 }
 
@@ -1082,7 +1064,7 @@ static inline void perf_event_task_sched_in(struct task_struct *task)
 
 static inline void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next)
 {
-       perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, NULL, 0);
+       perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, NULL, 0);
 
        __perf_event_task_sched_out(task, next);
 }
@@ -1143,8 +1125,7 @@ extern void perf_bp_event(struct perf_event *event, void *data);
 #endif
 
 extern int perf_output_begin(struct perf_output_handle *handle,
-                            struct perf_event *event, unsigned int size,
-                            int nmi, int sample);
+                            struct perf_event *event, unsigned int size);
 extern void perf_output_end(struct perf_output_handle *handle);
 extern void perf_output_copy(struct perf_output_handle *handle,
                             const void *buf, unsigned int len);
@@ -1168,8 +1149,7 @@ static inline int perf_event_task_disable(void)                           { return -EINVAL; }
 static inline int perf_event_task_enable(void)                         { return -EINVAL; }
 
 static inline void
-perf_sw_event(u32 event_id, u64 nr, int nmi,
-                    struct pt_regs *regs, u64 addr)                    { }
+perf_sw_event(u32 event_id, u64 nr, struct pt_regs *regs, u64 addr)    { }
 static inline void
 perf_bp_event(struct perf_event *event, void *data)                    { }