diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/bpf.h | 20 | ||||
| -rw-r--r-- | include/linux/ftrace_event.h | 14 | ||||
| -rw-r--r-- | include/linux/perf_event.h | 121 | ||||
| -rw-r--r-- | include/linux/watchdog.h | 8 |
4 files changed, 153 insertions, 10 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h index bbfceb756452..c2e21113ecc0 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h | |||
| @@ -113,8 +113,6 @@ struct bpf_prog_type_list { | |||
| 113 | enum bpf_prog_type type; | 113 | enum bpf_prog_type type; |
| 114 | }; | 114 | }; |
| 115 | 115 | ||
| 116 | void bpf_register_prog_type(struct bpf_prog_type_list *tl); | ||
| 117 | |||
| 118 | struct bpf_prog; | 116 | struct bpf_prog; |
| 119 | 117 | ||
| 120 | struct bpf_prog_aux { | 118 | struct bpf_prog_aux { |
| @@ -129,11 +127,25 @@ struct bpf_prog_aux { | |||
| 129 | }; | 127 | }; |
| 130 | 128 | ||
| 131 | #ifdef CONFIG_BPF_SYSCALL | 129 | #ifdef CONFIG_BPF_SYSCALL |
| 130 | void bpf_register_prog_type(struct bpf_prog_type_list *tl); | ||
| 131 | |||
| 132 | void bpf_prog_put(struct bpf_prog *prog); | 132 | void bpf_prog_put(struct bpf_prog *prog); |
| 133 | struct bpf_prog *bpf_prog_get(u32 ufd); | ||
| 133 | #else | 134 | #else |
| 134 | static inline void bpf_prog_put(struct bpf_prog *prog) {} | 135 | static inline void bpf_register_prog_type(struct bpf_prog_type_list *tl) |
| 136 | { | ||
| 137 | } | ||
| 138 | |||
| 139 | static inline struct bpf_prog *bpf_prog_get(u32 ufd) | ||
| 140 | { | ||
| 141 | return ERR_PTR(-EOPNOTSUPP); | ||
| 142 | } | ||
| 143 | |||
| 144 | static inline void bpf_prog_put(struct bpf_prog *prog) | ||
| 145 | { | ||
| 146 | } | ||
| 135 | #endif | 147 | #endif |
| 136 | struct bpf_prog *bpf_prog_get(u32 ufd); | 148 | |
| 137 | /* verify correctness of eBPF program */ | 149 | /* verify correctness of eBPF program */ |
| 138 | int bpf_check(struct bpf_prog *fp, union bpf_attr *attr); | 150 | int bpf_check(struct bpf_prog *fp, union bpf_attr *attr); |
| 139 | 151 | ||
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 112cf49d9576..46e83c2156c6 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
| @@ -13,6 +13,7 @@ struct trace_array; | |||
| 13 | struct trace_buffer; | 13 | struct trace_buffer; |
| 14 | struct tracer; | 14 | struct tracer; |
| 15 | struct dentry; | 15 | struct dentry; |
| 16 | struct bpf_prog; | ||
| 16 | 17 | ||
| 17 | struct trace_print_flags { | 18 | struct trace_print_flags { |
| 18 | unsigned long mask; | 19 | unsigned long mask; |
| @@ -252,6 +253,7 @@ enum { | |||
| 252 | TRACE_EVENT_FL_WAS_ENABLED_BIT, | 253 | TRACE_EVENT_FL_WAS_ENABLED_BIT, |
| 253 | TRACE_EVENT_FL_USE_CALL_FILTER_BIT, | 254 | TRACE_EVENT_FL_USE_CALL_FILTER_BIT, |
| 254 | TRACE_EVENT_FL_TRACEPOINT_BIT, | 255 | TRACE_EVENT_FL_TRACEPOINT_BIT, |
| 256 | TRACE_EVENT_FL_KPROBE_BIT, | ||
| 255 | }; | 257 | }; |
| 256 | 258 | ||
| 257 | /* | 259 | /* |
| @@ -265,6 +267,7 @@ enum { | |||
| 265 | * it is best to clear the buffers that used it). | 267 | * it is best to clear the buffers that used it). |
| 266 | * USE_CALL_FILTER - For ftrace internal events, don't use file filter | 268 | * USE_CALL_FILTER - For ftrace internal events, don't use file filter |
| 267 | * TRACEPOINT - Event is a tracepoint | 269 | * TRACEPOINT - Event is a tracepoint |
| 270 | * KPROBE - Event is a kprobe | ||
| 268 | */ | 271 | */ |
| 269 | enum { | 272 | enum { |
| 270 | TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), | 273 | TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), |
| @@ -274,6 +277,7 @@ enum { | |||
| 274 | TRACE_EVENT_FL_WAS_ENABLED = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT), | 277 | TRACE_EVENT_FL_WAS_ENABLED = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT), |
| 275 | TRACE_EVENT_FL_USE_CALL_FILTER = (1 << TRACE_EVENT_FL_USE_CALL_FILTER_BIT), | 278 | TRACE_EVENT_FL_USE_CALL_FILTER = (1 << TRACE_EVENT_FL_USE_CALL_FILTER_BIT), |
| 276 | TRACE_EVENT_FL_TRACEPOINT = (1 << TRACE_EVENT_FL_TRACEPOINT_BIT), | 279 | TRACE_EVENT_FL_TRACEPOINT = (1 << TRACE_EVENT_FL_TRACEPOINT_BIT), |
| 280 | TRACE_EVENT_FL_KPROBE = (1 << TRACE_EVENT_FL_KPROBE_BIT), | ||
| 277 | }; | 281 | }; |
| 278 | 282 | ||
| 279 | struct ftrace_event_call { | 283 | struct ftrace_event_call { |
| @@ -303,6 +307,7 @@ struct ftrace_event_call { | |||
| 303 | #ifdef CONFIG_PERF_EVENTS | 307 | #ifdef CONFIG_PERF_EVENTS |
| 304 | int perf_refcount; | 308 | int perf_refcount; |
| 305 | struct hlist_head __percpu *perf_events; | 309 | struct hlist_head __percpu *perf_events; |
| 310 | struct bpf_prog *prog; | ||
| 306 | 311 | ||
| 307 | int (*perf_perm)(struct ftrace_event_call *, | 312 | int (*perf_perm)(struct ftrace_event_call *, |
| 308 | struct perf_event *); | 313 | struct perf_event *); |
| @@ -548,6 +553,15 @@ event_trigger_unlock_commit_regs(struct ftrace_event_file *file, | |||
| 548 | event_triggers_post_call(file, tt); | 553 | event_triggers_post_call(file, tt); |
| 549 | } | 554 | } |
| 550 | 555 | ||
| 556 | #ifdef CONFIG_BPF_SYSCALL | ||
| 557 | unsigned int trace_call_bpf(struct bpf_prog *prog, void *ctx); | ||
| 558 | #else | ||
| 559 | static inline unsigned int trace_call_bpf(struct bpf_prog *prog, void *ctx) | ||
| 560 | { | ||
| 561 | return 1; | ||
| 562 | } | ||
| 563 | #endif | ||
| 564 | |||
| 551 | enum { | 565 | enum { |
| 552 | FILTER_OTHER = 0, | 566 | FILTER_OTHER = 0, |
| 553 | FILTER_STATIC_STRING, | 567 | FILTER_STATIC_STRING, |
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 2b621982938d..61992cf2e977 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
| @@ -53,6 +53,7 @@ struct perf_guest_info_callbacks { | |||
| 53 | #include <linux/sysfs.h> | 53 | #include <linux/sysfs.h> |
| 54 | #include <linux/perf_regs.h> | 54 | #include <linux/perf_regs.h> |
| 55 | #include <linux/workqueue.h> | 55 | #include <linux/workqueue.h> |
| 56 | #include <linux/cgroup.h> | ||
| 56 | #include <asm/local.h> | 57 | #include <asm/local.h> |
| 57 | 58 | ||
| 58 | struct perf_callchain_entry { | 59 | struct perf_callchain_entry { |
| @@ -118,10 +119,19 @@ struct hw_perf_event { | |||
| 118 | struct hrtimer hrtimer; | 119 | struct hrtimer hrtimer; |
| 119 | }; | 120 | }; |
| 120 | struct { /* tracepoint */ | 121 | struct { /* tracepoint */ |
| 121 | struct task_struct *tp_target; | ||
| 122 | /* for tp_event->class */ | 122 | /* for tp_event->class */ |
| 123 | struct list_head tp_list; | 123 | struct list_head tp_list; |
| 124 | }; | 124 | }; |
| 125 | struct { /* intel_cqm */ | ||
| 126 | int cqm_state; | ||
| 127 | int cqm_rmid; | ||
| 128 | struct list_head cqm_events_entry; | ||
| 129 | struct list_head cqm_groups_entry; | ||
| 130 | struct list_head cqm_group_entry; | ||
| 131 | }; | ||
| 132 | struct { /* itrace */ | ||
| 133 | int itrace_started; | ||
| 134 | }; | ||
| 125 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | 135 | #ifdef CONFIG_HAVE_HW_BREAKPOINT |
| 126 | struct { /* breakpoint */ | 136 | struct { /* breakpoint */ |
| 127 | /* | 137 | /* |
| @@ -129,12 +139,12 @@ struct hw_perf_event { | |||
| 129 | * problem hw_breakpoint has with context | 139 | * problem hw_breakpoint has with context |
| 130 | * creation and event initalization. | 140 | * creation and event initalization. |
| 131 | */ | 141 | */ |
| 132 | struct task_struct *bp_target; | ||
| 133 | struct arch_hw_breakpoint info; | 142 | struct arch_hw_breakpoint info; |
| 134 | struct list_head bp_list; | 143 | struct list_head bp_list; |
| 135 | }; | 144 | }; |
| 136 | #endif | 145 | #endif |
| 137 | }; | 146 | }; |
| 147 | struct task_struct *target; | ||
| 138 | int state; | 148 | int state; |
| 139 | local64_t prev_count; | 149 | local64_t prev_count; |
| 140 | u64 sample_period; | 150 | u64 sample_period; |
| @@ -166,6 +176,11 @@ struct perf_event; | |||
| 166 | * pmu::capabilities flags | 176 | * pmu::capabilities flags |
| 167 | */ | 177 | */ |
| 168 | #define PERF_PMU_CAP_NO_INTERRUPT 0x01 | 178 | #define PERF_PMU_CAP_NO_INTERRUPT 0x01 |
| 179 | #define PERF_PMU_CAP_NO_NMI 0x02 | ||
| 180 | #define PERF_PMU_CAP_AUX_NO_SG 0x04 | ||
| 181 | #define PERF_PMU_CAP_AUX_SW_DOUBLEBUF 0x08 | ||
| 182 | #define PERF_PMU_CAP_EXCLUSIVE 0x10 | ||
| 183 | #define PERF_PMU_CAP_ITRACE 0x20 | ||
| 169 | 184 | ||
| 170 | /** | 185 | /** |
| 171 | * struct pmu - generic performance monitoring unit | 186 | * struct pmu - generic performance monitoring unit |
| @@ -186,6 +201,7 @@ struct pmu { | |||
| 186 | 201 | ||
| 187 | int * __percpu pmu_disable_count; | 202 | int * __percpu pmu_disable_count; |
| 188 | struct perf_cpu_context * __percpu pmu_cpu_context; | 203 | struct perf_cpu_context * __percpu pmu_cpu_context; |
| 204 | atomic_t exclusive_cnt; /* < 0: cpu; > 0: tsk */ | ||
| 189 | int task_ctx_nr; | 205 | int task_ctx_nr; |
| 190 | int hrtimer_interval_ms; | 206 | int hrtimer_interval_ms; |
| 191 | 207 | ||
| @@ -262,9 +278,32 @@ struct pmu { | |||
| 262 | int (*event_idx) (struct perf_event *event); /*optional */ | 278 | int (*event_idx) (struct perf_event *event); /*optional */ |
| 263 | 279 | ||
| 264 | /* | 280 | /* |
| 265 | * flush branch stack on context-switches (needed in cpu-wide mode) | 281 | * context-switches callback |
| 282 | */ | ||
| 283 | void (*sched_task) (struct perf_event_context *ctx, | ||
| 284 | bool sched_in); | ||
| 285 | /* | ||
