diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/aer.h | 4 | ||||
| -rw-r--r-- | include/linux/ftrace.h | 6 | ||||
| -rw-r--r-- | include/linux/ftrace_event.h | 6 | ||||
| -rw-r--r-- | include/linux/hardirq.h | 4 | ||||
| -rw-r--r-- | include/linux/kprobes.h | 12 | ||||
| -rw-r--r-- | include/linux/perf_event.h | 20 | ||||
| -rw-r--r-- | include/linux/profile.h | 13 | ||||
| -rw-r--r-- | include/linux/ring_buffer.h | 1 | ||||
| -rw-r--r-- | include/linux/uprobes.h | 23 | ||||
| -rw-r--r-- | include/trace/events/ras.h | 77 | ||||
| -rw-r--r-- | include/uapi/linux/perf_event.h | 3 | 
11 files changed, 128 insertions, 41 deletions
diff --git a/include/linux/aer.h b/include/linux/aer.h index 544abdb2238..ec10e1b24c1 100644 --- a/include/linux/aer.h +++ b/include/linux/aer.h @@ -49,8 +49,8 @@ static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)  }  #endif -extern void cper_print_aer(const char *prefix, int cper_severity, -			   struct aer_capability_regs *aer); +extern void cper_print_aer(const char *prefix, struct pci_dev *dev, +			   int cper_severity, struct aer_capability_regs *aer);  extern int cper_severity_to_aer(int cper_severity);  extern void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn,  			      int severity); diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 92691d85c32..e5ca8ef50e9 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -74,7 +74,7 @@ typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,   * SAVE_REGS - The ftrace_ops wants regs saved at each function called   *            and passed to the callback. If this flag is set, but the   *            architecture does not support passing regs - *            (ARCH_SUPPORTS_FTRACE_SAVE_REGS is not defined), then the + *            (CONFIG_DYNAMIC_FTRACE_WITH_REGS is not defined), then the   *            ftrace_ops will fail to register, unless the next flag   *            is set.   * SAVE_REGS_IF_SUPPORTED - This is the same as SAVE_REGS, but if the @@ -418,7 +418,7 @@ void ftrace_modify_all_code(int command);  #endif  #ifndef FTRACE_REGS_ADDR -#ifdef ARCH_SUPPORTS_FTRACE_SAVE_REGS +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS  # define FTRACE_REGS_ADDR ((unsigned long)ftrace_regs_caller)  #else  # define FTRACE_REGS_ADDR FTRACE_ADDR @@ -480,7 +480,7 @@ extern int ftrace_make_nop(struct module *mod,   */  extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr); -#ifdef ARCH_SUPPORTS_FTRACE_SAVE_REGS +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS  /**   * ftrace_modify_call - convert from one addr to another (no nop)   * @rec: the mcount call site record diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index a3d489531d8..13a54d0bdfa 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h @@ -49,7 +49,6 @@ struct trace_entry {  	unsigned char		flags;  	unsigned char		preempt_count;  	int			pid; -	int			padding;  };  #define FTRACE_MAX_EVENT						\ @@ -84,6 +83,9 @@ struct trace_iterator {  	long			idx;  	cpumask_var_t		started; + +	/* it's true when current open file is snapshot */ +	bool			snapshot;  };  enum trace_iter_flags { @@ -272,7 +274,7 @@ extern int trace_define_field(struct ftrace_event_call *call, const char *type,  extern int trace_add_event_call(struct ftrace_event_call *call);  extern void trace_remove_event_call(struct ftrace_event_call *call); -#define is_signed_type(type)	(((type)(-1)) < 0) +#define is_signed_type(type)	(((type)(-1)) < (type)0)  int trace_set_clr_event(const char *system, const char *event, int set); diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index 624ef3f45c8..57bfdce8fb9 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h @@ -180,10 +180,10 @@ extern void irq_exit(void);  #define nmi_enter()						\  	do {							\ +		lockdep_off();					\  		ftrace_nmi_enter();				\  		BUG_ON(in_nmi());				\  		add_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET);	\ -		lockdep_off();					\  		rcu_nmi_enter();				\  		trace_hardirq_enter();				\  	} while (0) @@ -192,10 +192,10 @@ extern void irq_exit(void);  	do {							\  		trace_hardirq_exit();				\  		rcu_nmi_exit();					\ -		lockdep_on();					\  		BUG_ON(!in_nmi());				\  		sub_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET);	\  		ftrace_nmi_exit();				\ +		lockdep_on();					\  	} while (0)  #endif /* LINUX_HARDIRQ_H */ diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 23755ba42ab..4b6ef4d33cc 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h @@ -49,16 +49,6 @@  #define KPROBE_REENTER		0x00000004  #define KPROBE_HIT_SSDONE	0x00000008 -/* - * If function tracer is enabled and the arch supports full - * passing of pt_regs to function tracing, then kprobes can - * optimize on top of function tracing. - */ -#if defined(CONFIG_FUNCTION_TRACER) && defined(ARCH_SUPPORTS_FTRACE_SAVE_REGS) \ -	&& defined(ARCH_SUPPORTS_KPROBES_ON_FTRACE) -# define KPROBES_CAN_USE_FTRACE -#endif -  /* Attach to insert probes on any functions which should be ignored*/  #define __kprobes	__attribute__((__section__(".kprobes.text"))) @@ -316,7 +306,7 @@ extern int proc_kprobes_optimization_handler(struct ctl_table *table,  #endif  #endif /* CONFIG_OPTPROBES */ -#ifdef KPROBES_CAN_USE_FTRACE +#ifdef CONFIG_KPROBES_ON_FTRACE  extern void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,  				  struct ftrace_ops *ops, struct pt_regs *regs);  extern int arch_prepare_kprobe_ftrace(struct kprobe *p); diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 6bfb2faa0b1..e47ee462c2f 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -135,16 +135,21 @@ struct hw_perf_event {  		struct { /* software */  			struct hrtimer	hrtimer;  		}; +		struct { /* tracepoint */ +			struct task_struct	*tp_target; +			/* for tp_event->class */ +			struct list_head	tp_list; +		};  #ifdef CONFIG_HAVE_HW_BREAKPOINT  		struct { /* breakpoint */ -			struct arch_hw_breakpoint	info; -			struct list_head		bp_list;  			/*  			 * Crufty hack to avoid the chicken and egg  			 * problem hw_breakpoint has with context  			 * creation and event initalization.  			 */  			struct task_struct		*bp_target; +			struct arch_hw_breakpoint	info; +			struct list_head		bp_list;  		};  #endif  	}; @@ -817,6 +822,17 @@ do {									\  } while (0) +struct perf_pmu_events_attr { +	struct device_attribute attr; +	u64 id; +}; + +#define PMU_EVENT_ATTR(_name, _var, _id, _show)				\ +static struct perf_pmu_events_attr _var = {				\ +	.attr = __ATTR(_name, 0444, _show, NULL),			\ +	.id   =  _id,							\ +}; +  #define PMU_FORMAT_ATTR(_name, _format)					\  static ssize_t								\  _name##_show(struct device *dev,					\ diff --git a/include/linux/profile.h b/include/linux/profile.h index a0fc32279fc..21123902366 100644 --- a/include/linux/profile.h +++ b/include/linux/profile.h @@ -82,9 +82,6 @@ int task_handoff_unregister(struct notifier_block * n);  int profile_event_register(enum profile_type, struct notifier_block * n);  int profile_event_unregister(enum profile_type, struct notifier_block * n); -int register_timer_hook(int (*hook)(struct pt_regs *)); -void unregister_timer_hook(int (*hook)(struct pt_regs *)); -  struct pt_regs;  #else @@ -135,16 +132,6 @@ static inline int profile_event_unregister(enum profile_type t, struct notifier_  #define profile_handoff_task(a) (0)  #define profile_munmap(a) do { } while (0) -static inline int register_timer_hook(int (*hook)(struct pt_regs *)) -{ -	return -ENOSYS; -} - -static inline void unregister_timer_hook(int (*hook)(struct pt_regs *)) -{ -	return; -} -  #endif /* CONFIG_PROFILING */  #endif /* _LINUX_PROFILE_H */ diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h index 519777e3fa0..1342e69542f 100644 --- a/include/linux/ring_buffer.h +++ b/include/linux/ring_buffer.h @@ -167,6 +167,7 @@ unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu);  unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu);  unsigned long ring_buffer_commit_overrun_cpu(struct ring_buffer *buffer, int cpu);  unsigned long ring_buffer_dropped_events_cpu(struct ring_buffer *buffer, int cpu); +unsigned long ring_buffer_read_events_cpu(struct ring_buffer *buffer, int cpu);  u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu);  void ring_buffer_normalize_time_stamp(struct ring_buffer *buffer, diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h index 4f628a6fc5b..02b83db8e2c 100644 --- a/include/linux/uprobes.h +++ b/include/linux/uprobes.h @@ -35,13 +35,20 @@ struct inode;  # include <asm/uprobes.h>  #endif +#define UPROBE_HANDLER_REMOVE		1 +#define UPROBE_HANDLER_MASK		1 + +enum uprobe_filter_ctx { +	UPROBE_FILTER_REGISTER, +	UPROBE_FILTER_UNREGISTER, +	UPROBE_FILTER_MMAP, +}; +  struct uprobe_consumer {  	int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs); -	/* -	 * filter is optional; If a filter exists, handler is run -	 * if and only if filter returns true. -	 */ -	bool (*filter)(struct uprobe_consumer *self, struct task_struct *task); +	bool (*filter)(struct uprobe_consumer *self, +				enum uprobe_filter_ctx ctx, +				struct mm_struct *mm);  	struct uprobe_consumer *next;  }; @@ -94,6 +101,7 @@ extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsign  extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);  extern bool __weak is_swbp_insn(uprobe_opcode_t *insn);  extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); +extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool);  extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);  extern int uprobe_mmap(struct vm_area_struct *vma);  extern void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end); @@ -117,6 +125,11 @@ uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)  {  	return -ENOSYS;  } +static inline int +uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool add) +{ +	return -ENOSYS; +}  static inline void  uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)  { diff --git a/include/trace/events/ras.h b/include/trace/events/ras.h new file mode 100644 index 00000000000..88b87838379 --- /dev/null +++ b/include/trace/events/ras.h @@ -0,0 +1,77 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM ras + +#if !defined(_TRACE_AER_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_AER_H + +#include <linux/tracepoint.h> +#include <linux/edac.h> + + +/* + * PCIe AER Trace event + * + * These events are generated when hardware detects a corrected or + * uncorrected event on a PCIe device. The event report has + * the following structure: + * + * char * dev_name -	The name of the slot where the device resides + *			([domain:]bus:device.function). + * u32 status -		Either the correctable or uncorrectable register + *			indicating what error or errors have been seen + * u8 severity -	error severity 0:NONFATAL 1:FATAL 2:CORRECTED + */ + +#define aer_correctable_errors		\ +	{BIT(0),	"Receiver Error"},		\ +	{BIT(6),	"Bad TLP"},			\ +	{BIT(7),	"Bad DLLP"},			\ +	{BIT(8),	"RELAY_NUM Rollover"},		\ +	{BIT(12),	"Replay Timer Timeout"},	\ +	{BIT(13),	"Advisory Non-Fatal"} + +#define aer_uncorrectable_errors		\ +	{BIT(4),	"Data Link Protocol"},		\ +	{BIT(12),	"Poisoned TLP"},		\ +	{BIT(13),	"Flow Control Protocol"},	\ +	{BIT(14),	"Completion Timeout"},		\ +	{BIT(15),	"Completer Abort"},		\ +	{BIT(16),	"Unexpected Completion"},	\ +	{BIT(17),	"Receiver Overflow"},		\ +	{BIT(18),	"Malformed TLP"},		\ +	{BIT(19),	"ECRC"},			\ +	{BIT(20),	"Unsupported Request"} + +TRACE_EVENT(aer_event, +	TP_PROTO(const char *dev_name, +		 const u32 status, +		 const u8 severity), + +	TP_ARGS(dev_name, status, severity), + +	TP_STRUCT__entry( +		__string(	dev_name,	dev_name	) +		__field(	u32,		status		) +		__field(	u8,		severity	) +	), + +	TP_fast_assign( +		__assign_str(dev_name, dev_name); +		__entry->status		= status; +		__entry->severity	= severity; +	), + +	TP_printk("%s PCIe Bus Error: severity=%s, %s\n", +		__get_str(dev_name), +		__entry->severity == HW_EVENT_ERR_CORRECTED ? "Corrected" : +			__entry->severity == HW_EVENT_ERR_FATAL ? +			"Fatal" : "Uncorrected", +		__entry->severity == HW_EVENT_ERR_CORRECTED ? +		__print_flags(__entry->status, "|", aer_correctable_errors) : +		__print_flags(__entry->status, "|", aer_uncorrectable_errors)) +); + +#endif /* _TRACE_AER_H */ + +/* This part must be outside protection */ +#include <trace/define_trace.h> diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h index 4f63c05d27c..9fa9c622a7f 100644 --- a/include/uapi/linux/perf_event.h +++ b/include/uapi/linux/perf_event.h @@ -579,7 +579,8 @@ enum perf_event_type {  	 *	{ u32			size;  	 *	  char                  data[size];}&& PERF_SAMPLE_RAW  	 * -	 *	{ u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK +	 *	{ u64                   nr; +	 *        { u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK  	 *  	 * 	{ u64			abi; # enum perf_sample_regs_abi  	 * 	  u64			regs[weight(mask)]; } && PERF_SAMPLE_REGS_USER  |