aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-12 22:18:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-12 22:18:49 -0400
commit3737a12761636ebde0f09ef49daebb8eed18cc8a (patch)
tree965057f4bccd97049f8c0140f8670c5d4278ca3e /include/linux
parentc29deef32e3699e40da3e9e82267610de04e6b54 (diff)
parent82b897782d10fcc4930c9d4a15b175348fdd2871 (diff)
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull more perf updates from Ingo Molnar: "A second round of perf updates: - wide reaching kprobes sanitization and robustization, with the hope of fixing all 'probe this function crashes the kernel' bugs, by Masami Hiramatsu. - uprobes updates from Oleg Nesterov: tmpfs support, corner case fixes and robustization work. - perf tooling updates and fixes from Jiri Olsa, Namhyung Ki, Arnaldo et al: * Add support to accumulate hist periods (Namhyung Kim) * various fixes, refactorings and enhancements" * 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (101 commits) perf: Differentiate exec() and non-exec() comm events perf: Fix perf_event_comm() vs. exec() assumption uprobes/x86: Rename arch_uprobe->def to ->defparam, minor comment updates perf/documentation: Add description for conditional branch filter perf/x86: Add conditional branch filtering support perf/tool: Add conditional branch filter 'cond' to perf record perf: Add new conditional branch filter 'PERF_SAMPLE_BRANCH_COND' uprobes: Teach copy_insn() to support tmpfs uprobes: Shift ->readpage check from __copy_insn() to uprobe_register() perf/x86: Use common PMU interrupt disabled code perf/ARM: Use common PMU interrupt disabled code perf: Disable sampled events if no PMU interrupt perf: Fix use after free in perf_remove_from_context() perf tools: Fix 'make help' message error perf record: Fix poll return value propagation perf tools: Move elide bool into perf_hpp_fmt struct perf tools: Remove elide setup for SORT_MODE__MEMORY mode perf tools: Fix "==" into "=" in ui_browser__warning assignment perf tools: Allow overriding sysfs and proc finding with env var perf tools: Consider header files outside perf directory in tags target ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/compiler.h2
-rw-r--r--include/linux/kprobes.h21
-rw-r--r--include/linux/perf_event.h18
-rw-r--r--include/linux/sched.h6
-rw-r--r--include/linux/uprobes.h4
5 files changed, 44 insertions, 7 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 64fdfe1cfcf0..d5ad7b1118fc 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -383,7 +383,9 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
383/* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */ 383/* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */
384#ifdef CONFIG_KPROBES 384#ifdef CONFIG_KPROBES
385# define __kprobes __attribute__((__section__(".kprobes.text"))) 385# define __kprobes __attribute__((__section__(".kprobes.text")))
386# define nokprobe_inline __always_inline
386#else 387#else
387# define __kprobes 388# define __kprobes
389# define nokprobe_inline inline
388#endif 390#endif
389#endif /* __LINUX_COMPILER_H */ 391#endif /* __LINUX_COMPILER_H */
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 7bd2ad01e39c..f7296e57d614 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -205,10 +205,10 @@ struct kretprobe_blackpoint {
205 void *addr; 205 void *addr;
206}; 206};
207 207
208struct kprobe_blackpoint { 208struct kprobe_blacklist_entry {
209 const char *name; 209 struct list_head list;
210 unsigned long start_addr; 210 unsigned long start_addr;
211 unsigned long range; 211 unsigned long end_addr;
212}; 212};
213 213
214#ifdef CONFIG_KPROBES 214#ifdef CONFIG_KPROBES
@@ -265,6 +265,7 @@ extern void arch_disarm_kprobe(struct kprobe *p);
265extern int arch_init_kprobes(void); 265extern int arch_init_kprobes(void);
266extern void show_registers(struct pt_regs *regs); 266extern void show_registers(struct pt_regs *regs);
267extern void kprobes_inc_nmissed_count(struct kprobe *p); 267extern void kprobes_inc_nmissed_count(struct kprobe *p);
268extern bool arch_within_kprobe_blacklist(unsigned long addr);
268 269
269struct kprobe_insn_cache { 270struct kprobe_insn_cache {
270 struct mutex mutex; 271 struct mutex mutex;
@@ -476,4 +477,18 @@ static inline int enable_jprobe(struct jprobe *jp)
476 return enable_kprobe(&jp->kp); 477 return enable_kprobe(&jp->kp);
477} 478}
478 479
480#ifdef CONFIG_KPROBES
481/*
482 * Blacklist ganerating macro. Specify functions which is not probed
483 * by using this macro.
484 */
485#define __NOKPROBE_SYMBOL(fname) \
486static unsigned long __used \
487 __attribute__((section("_kprobe_blacklist"))) \
488 _kbl_addr_##fname = (unsigned long)fname;
489#define NOKPROBE_SYMBOL(fname) __NOKPROBE_SYMBOL(fname)
490#else
491#define NOKPROBE_SYMBOL(fname)
492#endif
493
479#endif /* _LINUX_KPROBES_H */ 494#endif /* _LINUX_KPROBES_H */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index a9209118d80f..707617a8c0f6 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -167,6 +167,11 @@ struct perf_event;
167#define PERF_EVENT_TXN 0x1 167#define PERF_EVENT_TXN 0x1
168 168
169/** 169/**
170 * pmu::capabilities flags
171 */
172#define PERF_PMU_CAP_NO_INTERRUPT 0x01
173
174/**
170 * struct pmu - generic performance monitoring unit 175 * struct pmu - generic performance monitoring unit
171 */ 176 */
172struct pmu { 177struct pmu {
@@ -178,6 +183,11 @@ struct pmu {
178 const char *name; 183 const char *name;
179 int type; 184 int type;
180 185
186 /*
187 * various common per-pmu feature flags
188 */
189 int capabilities;
190
181 int * __percpu pmu_disable_count; 191 int * __percpu pmu_disable_count;
182 struct perf_cpu_context * __percpu pmu_cpu_context; 192 struct perf_cpu_context * __percpu pmu_cpu_context;
183 int task_ctx_nr; 193 int task_ctx_nr;
@@ -696,7 +706,8 @@ extern struct perf_guest_info_callbacks *perf_guest_cbs;
696extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks); 706extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
697extern int perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks); 707extern int perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
698 708
699extern void perf_event_comm(struct task_struct *tsk); 709extern void perf_event_exec(void);
710extern void perf_event_comm(struct task_struct *tsk, bool exec);
700extern void perf_event_fork(struct task_struct *tsk); 711extern void perf_event_fork(struct task_struct *tsk);
701 712
702/* Callchains */ 713/* Callchains */
@@ -773,7 +784,7 @@ extern void perf_event_enable(struct perf_event *event);
773extern void perf_event_disable(struct perf_event *event); 784extern void perf_event_disable(struct perf_event *event);
774extern int __perf_event_disable(void *info); 785extern int __perf_event_disable(void *info);
775extern void perf_event_task_tick(void); 786extern void perf_event_task_tick(void);
776#else 787#else /* !CONFIG_PERF_EVENTS: */
777static inline void 788static inline void
778perf_event_task_sched_in(struct task_struct *prev, 789perf_event_task_sched_in(struct task_struct *prev,
779 struct task_struct *task) { } 790 struct task_struct *task) { }
@@ -803,7 +814,8 @@ static inline int perf_unregister_guest_info_callbacks
803(struct perf_guest_info_callbacks *callbacks) { return 0; } 814(struct perf_guest_info_callbacks *callbacks) { return 0; }
804 815
805static inline void perf_event_mmap(struct vm_area_struct *vma) { } 816static inline void perf_event_mmap(struct vm_area_struct *vma) { }
806static inline void perf_event_comm(struct task_struct *tsk) { } 817static inline void perf_event_exec(void) { }
818static inline void perf_event_comm(struct task_struct *tsk, bool exec) { }
807static inline void perf_event_fork(struct task_struct *tsk) { } 819static inline void perf_event_fork(struct task_struct *tsk) { }
808static inline void perf_event_init(void) { } 820static inline void perf_event_init(void) { }
809static inline int perf_swevent_get_recursion_context(void) { return -1; } 821static inline int perf_swevent_get_recursion_context(void) { return -1; }
diff --git a/include/linux/sched.h b/include/linux/sched.h
index ea74596014a2..b8a98427f964 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2421,7 +2421,11 @@ extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, i
2421struct task_struct *fork_idle(int); 2421struct task_struct *fork_idle(int);
2422extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); 2422extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
2423 2423
2424extern void set_task_comm(struct task_struct *tsk, const char *from); 2424extern void __set_task_comm(struct task_struct *tsk, const char *from, bool exec);
2425static inline void set_task_comm(struct task_struct *tsk, const char *from)
2426{
2427 __set_task_comm(tsk, from, false);
2428}
2425extern char *get_task_comm(char *to, struct task_struct *tsk); 2429extern char *get_task_comm(char *to, struct task_struct *tsk);
2426 2430
2427#ifdef CONFIG_SMP 2431#ifdef CONFIG_SMP
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index c52f827ba6ce..4f844c6b03ee 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -103,6 +103,7 @@ extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, u
103extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); 103extern bool __weak is_swbp_insn(uprobe_opcode_t *insn);
104extern bool __weak is_trap_insn(uprobe_opcode_t *insn); 104extern bool __weak is_trap_insn(uprobe_opcode_t *insn);
105extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs); 105extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs);
106extern unsigned long uprobe_get_trap_addr(struct pt_regs *regs);
106extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t); 107extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t);
107extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 108extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
108extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool); 109extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool);
@@ -133,6 +134,9 @@ extern void __weak arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
133#else /* !CONFIG_UPROBES */ 134#else /* !CONFIG_UPROBES */
134struct uprobes_state { 135struct uprobes_state {
135}; 136};
137
138#define uprobe_get_trap_addr(regs) instruction_pointer(regs)
139
136static inline int 140static inline int
137uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc) 141uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)
138{ 142{