trace: Add kprobe on tracepoint
RFC PATCH v2 1/1 trace: Add kprobe on tracepoint
From: Tzvetomir Stoyanov (VMware) <[email protected]>
A new dynamic event is introduced: event probe. The event is attached to an existing tracepoint and uses its fields as arguments. The user can specify custom format string of the new event, select what tracepoint arguments will be printed and how to print them.
The event probe is created by writing configuration string in 'dynamic_events' ftrace file:
e:GNAME/ENAME SYSTEM.EVENT [FETCHARGS] - Set an event probe
-:GNAME/ENAME - Delete an event probe
Where:
GNAME - Group name, if omitted 'eprobes' is used.
ENAME - Name of the new event in GNAME, mandatory.
SYSTEM - Name of the system, where the tracepoint is defined, mandatory.
EVENT - Name of the tracepoint event in SYSTEM, mandatory.
FETCHARGS - Arguments:
<name>=$<field>[:TYPE] - Fetch given filed of the tracepoint and print
it as given TYPE with given name. Supported
types are:
(u8/u16/u32/u64/s8/s16/s32/s64), basic type
(x8/x16/x32/x64), hexadecimal types
"string", "ustring" and bitfield.Example, attach event probe on openat system call and print name of the file that will be opened:
echo "e:esys/eopen syscalls.sys_enter_openat file=\$filename:string" >> dynamic_events
A new dynamic event is created in events/esys/eopen/ directory. It
can be deleted with:
echo "-:esys/eopen" >> dynamic_events
Filters, triggers and histograms can be attached to the new event, it can be matched in synthetic events. There is one limitation - no synthetic events can be attached to an event probe.
--- include/linux/trace_events.h | 4 + kernel/trace/Makefile | 1 + kernel/trace/trace.h | 13 + kernel/trace/trace_eprobe.c | 874 ++++++++++++++++++++++++++++ kernel/trace/trace_events_hist.c | 35 +- kernel/trace/trace_events_trigger.c | 14 +- kernel/trace/trace_kprobe.c | 12 +- kernel/trace/trace_probe.c | 16 +- kernel/trace/trace_probe.h | 6 +- kernel/trace/trace_probe_tmpl.h | 6 +- kernel/trace/trace_uprobe.c | 4 +- 11 files changed, 955 insertions(+), 30 deletions(-) create mode 100644 kernel/trace/trace_eprobe.c
include/linux/trace_events.h +4 -0
@@ -312,6 +312,7 @@ enum {TRACE_EVENT_FL_TRACEPOINT_BIT ,TRACE_EVENT_FL_KPROBE_BIT ,TRACE_EVENT_FL_UPROBE_BIT , + TRACE_EVENT_FL_EPROBE_BIT, };/*
@@ -323,6 +324,7 @@ enum {* TRACEPOINT - Event is a tracepoint * KPROBE - Event is a kprobe * UPROBE - Event is a uprobe +* EPROBE - Event is an event probe */ enum {TRACE_EVENT_FL_FILTERED = (1 <<TRACE_EVENT_FL_FILTERED_BIT ),
@@ -332,6 +334,7 @@ enum {TRACE_EVENT_FL_TRACEPOINT = (1 <<TRACE_EVENT_FL_TRACEPOINT_BIT ),TRACE_EVENT_FL_KPROBE = (1 <<TRACE_EVENT_FL_KPROBE_BIT ),TRACE_EVENT_FL_UPROBE = (1 <<TRACE_EVENT_FL_UPROBE_BIT ), + TRACE_EVENT_FL_EPROBE = (1 << TRACE_EVENT_FL_EPROBE_BIT), };#define TRACE_EVENT_FL_UKPROBE (TRACE_EVENT_FL_KPROBE | TRACE_EVENT_FL_UPROBE)
@@ -634,6 +637,7 @@ enum event_trigger_type {ETT_EVENT_ENABLE = (1 <<3 ),ETT_EVENT_HIST = (1 <<4 ),ETT_HIST_ENABLE = (1 <<5 ), + ETT_EVENT_EPROBE = (1 << 6), };extern int filter_match_preds (struct event_filter *filter,void *rec);
kernel/trace/Makefile +1 -0
@@ -77,6 +77,7 @@ obj-$(CONFIG_EVENT_TRACING) += trace_event_perf.o endif obj-$(CONFIG_EVENT_TRACING) += trace_events_filter.o obj-$(CONFIG_EVENT_TRACING) += trace_events_trigger.o +obj-$(CONFIG_EVENT_TRACING) += trace_eprobe.o obj-$(CONFIG_TRACE_EVENT_INJECT) += trace_events_inject.o obj-$(CONFIG_SYNTH_EVENTS) += trace_events_synth.o obj-$(CONFIG_HIST_TRIGGERS) += trace_events_hist.o
kernel/trace/trace.h +13 -0
@@ -1540,9 +1540,14 @@ static inline int register_trigger_hist_enable_disable_cmds(void) { return 0; }extern int register_trigger_cmds (void );extern void clear_event_triggers (struct trace_array *tr); +enum { +EVENT_TRIGGER_FL_PROBE =BIT (0 ), +}; +struct event_trigger_data {unsigned long count;int ref; +int flags;struct event_trigger_ops *ops;struct event_command *cmd_ops;struct event_filter __rcu *filter;
@@ -1950,6 +1955,14 @@ static inline bool is_good_name(const char *name)return true; } +/* Convert certain expected symbols into '_' when generating event names */ +static inline void sanitize_event_name (char *name) +{ +while (*name++ !='\0' ) +if (*name ==':' || *name =='.' ) + *name ='_' ; +} +/* * This is a generic way to read and write a u64 value from a file in tracefs. *
kernel/trace/trace_eprobe.c new file +874 -0
874 lines not on this page · raw message
kernel/trace/trace_events_hist.c +27 -8
@@ -66,7 +66,8 @@C (EMPTY_SORT_FIELD ,"Empty sort field" ), \C (TOO_MANY_SORT_FIELDS ,"Too many sort fields (Max = 2)" ), \C (INVALID_SORT_FIELD ,"Sort field must be a key or a val" ), \ -C (INVALID_STR_OPERAND ,"String type can not be an operand in expression" ), +C (INVALID_STR_OPERAND ,"String type can not be an operand in expression" ), \ +C (SYNTH_ON_EPROBE ,"Synthetic event on eprobe is not supported" ), #undef C #define C(a, b) HIST_ERR_##a
@@ -2413,7 +2414,7 @@ find_compatible_hist(struct hist_trigger_data *target_hist_data, }static struct trace_event_file *event_file (struct trace_array *tr, -char *system,char *event_name) +const char *system,const char *event_name) {struct trace_event_file *file;
@@ -3165,9 +3166,21 @@ static int parse_action_params(struct trace_array *tr, char *params,return ret; } -static int action_parse (struct trace_array *tr,char *str,struct action_data *data, +static inline bool check_match_on_eprobe (struct trace_array *tr, +const char *system,const char *event) +{ +struct trace_event_file *file; + + file =event_file (tr, system, event); +if (file && (file->event_call->flags &TRACE_EVENT_FL_EPROBE )) +return true; +return false; +} + +static int action_parse (struct hist_trigger_data *hist_data,char *str,struct action_data *data,enum handler_id handler) { +struct trace_array *tr = hist_data->event_file->tr;char *action_name;int ret =0 ;
@@ -3235,6 +3248,12 @@ static int action_parse(struct trace_array *tr, char *str, struct action_data *d data->action =ACTION_SNAPSHOT ; }else {char *params =strsep (&str,")" ); +if (check_match_on_eprobe (tr, hist_data->event_file->system->subsystem->name, +trace_event_name (hist_data->event_file->event_call))) { +hist_err (tr,HIST_ERR_SYNTH_ON_EPROBE ,0 ); + ret = -EINVAL ; + goto out; + }if (str_has_prefix (action_name,"trace" )) data->use_trace_keyword = true;
@@ -3293,7 +3312,7 @@ static struct action_data *track_data_parse(struct hist_trigger_data *hist_data, goto free; } - ret =action_parse (hist_data->event_file->tr, str, data, handler); + ret =action_parse (hist_data, str, data, handler);if (ret) goto free; out:
@@ -3626,8 +3645,9 @@ static int onmatch_create(struct hist_trigger_data *hist_data,return action_create (hist_data, data); } -static struct action_data *onmatch_parse (struct trace_array *tr,char *str) +static struct action_data *onmatch_parse (struct hist_trigger_data *hist_data,char *str) { +struct trace_array *tr = hist_data->event_file->tr;char *match_event, *match_event_system;struct action_data *data;int ret = -EINVAL ;
@@ -3665,7 +3685,7 @@ static struct action_data *onmatch_parse(struct trace_array *tr, char *str) goto free; } - ret =action_parse (tr, str, data,HANDLER_ONMATCH ); + ret =action_parse (hist_data, str, data,HANDLER_ONMATCH );if (ret) goto free; out:
@@ -4120,7 +4140,6 @@ static void destroy_actions(struct hist_trigger_data *hist_data)static int parse_actions (struct hist_trigger_data *hist_data) { -struct trace_array *tr = hist_data->event_file->tr;struct action_data *data;unsigned int i;int ret =0 ;
@@ -4133,7 +4152,7 @@ static int parse_actions(struct hist_trigger_data *hist_data)if ((len =str_has_prefix (str,"onmatch(" ))) {char *action_str = str + len; - data =onmatch_parse (tr, action_str); + data =onmatch_parse (hist_data, action_str);if (IS_ERR (data)) { ret =PTR_ERR (data);break ;
kernel/trace/trace_events_trigger.c +13 -1
@@ -124,6 +124,18 @@ static void *trigger_next(struct seq_file *m, void *t, loff_t *pos)return seq_list_next (t, &event_file->triggers, pos); } +static bool check_user_trigger (struct trace_event_file *file) +{ +struct event_trigger_data *data; + +list_for_each_entry_rcu (data, &file->triggers, list) { +if (data->flags &EVENT_TRIGGER_FL_PROBE ) +continue ; +return true; + } +return false; +} +static void *trigger_start (struct seq_file *m,loff_t *pos) {struct trace_event_file *event_file;
@@ -134,7 +146,7 @@ static void *trigger_start(struct seq_file *m, loff_t *pos)if (unlikely (!event_file))return ERR_PTR (-ENODEV ); -if (list_empty (&event_file->triggers)) +if (list_empty (&event_file->triggers) || !check_user_trigger (event_file))return *pos ==0 ?SHOW_AVAILABLE_TRIGGERS :NULL ;return seq_list_start (&event_file->triggers, *pos);
kernel/trace/trace_kprobe.c +2 -10
@@ -703,14 +703,6 @@ static struct notifier_block trace_kprobe_module_nb = { .priority = 1 /* Invoked after kprobe module callback */ }; -/* Convert certain expected symbols into '_' when generating event names */ -static inline void sanitize_event_name (char *name) -{ -while (*name++ !='\0' ) -if (*name ==':' || *name =='.' ) - *name ='_' ; -} -static int __trace_kprobe_create (int argc,const char *argv[]) {/*
@@ -841,7 +833,7 @@ static int __trace_kprobe_create(int argc, const char *argv[])trace_probe_log_set_index (0 );if (event) { ret =traceprobe_parse_event_name (&event, &group, buf, - event - argv[0 ]); + event - argv[0 ],'/' );if (ret) goto parse_error; }else {
@@ -1330,7 +1322,7 @@ probe_mem_read(void *dest, void *src, size_t size)/* Note that we don't verify it, since the code does not come from user space */ static int -process_fetch_insn (struct fetch_insn *code,struct pt_regs *regs,void *dest, +process_fetch_insn (struct fetch_insn *code,void *regs,void *dest,void *base) {unsigned long val;
kernel/trace/trace_probe.c +12 -4
@@ -227,12 +227,12 @@ int traceprobe_split_symbol_offset(char *symbol, long *offset)/* @buf must has MAX_EVENT_NAME_LEN size */ int traceprobe_parse_event_name (const char **pevent,const char **pgroup, -char *buf,int offset) +char *buf,int offset,int delim) {const char *slash, *event = *pevent;int len; - slash =strchr (event,'/' ); + slash =strchr (event, delim);if (slash) {if (slash == event) {trace_probe_log_err (offset,NO_GROUP_NAME );
@@ -316,6 +316,13 @@ static int parse_probe_vars(char *arg, const struct fetch_type *t, code->op =FETCH_OP_ARG ; code->param = (unsigned int )param -1 ;#endif + }else if (flags &TPARG_FL_TPOINT ) { +if (code->data) +return -EFAULT ; + code->data =kstrdup (arg,GFP_KERNEL ); +if (!code->data) +return -ENOMEM ; + code->op =FETCH_OP_TP_ARG ; }else goto inval_var;
@@ -633,14 +640,15 @@ static int traceprobe_parse_probe_arg_body(char *arg, ssize_t *size, !strcmp(parg->type->name, "ustring")) {if (code->op !=FETCH_OP_DEREF && code->op !=FETCH_OP_UDEREF && code->op !=FETCH_OP_IMM && code->op !=FETCH_OP_COMM && - code->op !=FETCH_OP_DATA ) { + code->op !=FETCH_OP_DATA && code->op !=FETCH_OP_TP_ARG ) {trace_probe_log_err (offset + (t ? (t - arg) :0 ),BAD_STRING ); ret = -EINVAL ; goto fail; }if ((code->op ==FETCH_OP_IMM || code->op ==FETCH_OP_COMM || - code->op ==FETCH_OP_DATA ) || parg->count) { + code->op ==FETCH_OP_DATA ) || code->op ==FETCH_OP_TP_ARG || + parg->count) {/* * IMM, DATA and COMM is pointing actual address, those * must be kept, and if parg->count != 0, this is an
kernel/trace/trace_probe.h +4 -2
@@ -102,6 +102,7 @@ enum fetch_op {FETCH_OP_MOD_BF ,/* Bitfield: .basesize, .lshift, .rshift */ // Stage 5 (loop) op FETCH_OP_LP_ARRAY ,/* Array: .param = loop count */ +FETCH_OP_TP_ARG ,/* Trace Point argument */ FETCH_OP_END , FETCH_NOP_SYMBOL, /* Unresolved Symbol holder */ };
@@ -351,7 +352,8 @@ int trace_probe_create(const char *raw_command, int (*createfn)(int, const char#define TPARG_FL_RETURN BIT(0)#define TPARG_FL_KERNEL BIT(1)#define TPARG_FL_FENTRY BIT(2) -#define TPARG_FL_MASK GENMASK(2, 0) +#define TPARG_FL_TPOINT BIT(3) +#define TPARG_FL_MASK GENMASK(3, 0)extern int traceprobe_parse_probe_arg (struct trace_probe *tp,int i,char *arg,unsigned int flags);
@@ -361,7 +363,7 @@ extern void traceprobe_free_probe_arg(struct probe_arg *arg);extern int traceprobe_split_symbol_offset (char *symbol,long *offset);int traceprobe_parse_event_name (const char **pevent,const char **pgroup, -char *buf,int offset); +char *buf,int offset,int delim);extern int traceprobe_set_print_fmt (struct trace_probe *tp,bool is_return);
kernel/trace/trace_probe_tmpl.h +3 -3
@@ -54,7 +54,7 @@ fetch_apply_bitfield(struct fetch_insn *code, void *buf)* If dest is NULL, don't store result and return required dynamic data size. */ static int -process_fetch_insn (struct fetch_insn *code,struct pt_regs *regs, +process_fetch_insn (struct fetch_insn *code,void *rec,void *dest,void *base); static nokprobe_inline int fetch_store_strlen(unsigned long addr);static nokprobe_inline int
@@ -188,7 +188,7 @@ __get_data_size(struct trace_probe *tp, struct pt_regs *regs)/* Store the value of each argument */ static nokprobe_inline void -store_trace_args (void *data,struct trace_probe *tp,struct pt_regs *regs, +store_trace_args (void *data,struct trace_probe *tp,void *rec,int header_size,int maxlen) {struct probe_arg *arg;
@@ -203,7 +203,7 @@ store_trace_args(void *data, struct trace_probe *tp, struct pt_regs *regs,/* Point the dynamic data area if needed */ if (unlikely (arg->dynamic)) *dl =make_data_loc (maxlen, dyndata - base); - ret =process_fetch_insn (arg->code, regs, dl, base); + ret =process_fetch_insn (arg->code, rec, dl, base);if (unlikely (ret <0 && arg->dynamic)) { *dl =make_data_loc (0 , dyndata - base); }else {
kernel/trace/trace_uprobe.c +2 -2
@@ -217,7 +217,7 @@ static unsigned long translate_user_vaddr(unsigned long file_offset)/* Note that we don't verify it, since the code does not come from user space */ static int -process_fetch_insn (struct fetch_insn *code,struct pt_regs *regs,void *dest, +process_fetch_insn (struct fetch_insn *code,void *regs,void *dest,void *base) {unsigned long val;
@@ -641,7 +641,7 @@ static int __trace_uprobe_create(int argc, const char **argv)trace_probe_log_set_index (0 );if (event) { ret =traceprobe_parse_event_name (&event, &group, buf, - event - argv[0 ]); + event - argv[0 ],'/' );if (ret) goto fail_address_parse; }else {
Signature · 1 line
2.31.1
kernel test robot
build bot[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]
Hi "Tzvetomir,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on v5.14-rc5]
[also build test WARNING on next-20210810]
[cannot apply to tip/perf/core]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Tzvetomir-Stoyanov-VMware/trace-Add-kprobe-on-tracepoint/20210810-192225 base: 36a21d51725af2ce0700c6ebcb6b9594aac658a6 config: powerpc-powernv_defconfig (attached as .config) compiler: powerpc-linux-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/e3bec14eb58da9408eba8ccc55c9f5cf4e1ff114
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Tzvetomir-Stoyanov-VMware/trace-Add-kprobe-on-tracepoint/20210810-192225 git checkout e3bec14eb58da9408eba8ccc55c9f5cf4e1ff114
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
In file included from arch/powerpc/include/asm/hw_irq.h:12,
from arch/powerpc/include/asm/irqflags.h:12, from include/linux/irqflags.h:16, from include/linux/rcupdate.h:26, from include/linux/rbtree.h:22, from include/linux/key.h:15,
from include/linux/security.h:27, from kernel/trace/trace_kprobe.c:10:
kernel/trace/trace_kprobe.c: In function 'process_fetch_insn':
>> arch/powerpc/include/asm/ptrace.h:248:43: warning: dereferencing 'void *' pointer
248 | #define kernel_stack_pointer(regs) ((regs)->gpr[1])
| ^~
kernel/trace/trace_kprobe.c:1340:9: note: in expansion of macro 'kernel_stack_pointer'
1340 | val = kernel_stack_pointer(regs);
| ^~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/ptrace.h:248:43: error: request for member 'gpr' in something not a structure or union
248 | #define kernel_stack_pointer(regs) ((regs)->gpr[1])
| ^~
kernel/trace/trace_kprobe.c:1340:9: note: in expansion of macro 'kernel_stack_pointer'
1340 | val = kernel_stack_pointer(regs);
| ^~~~~~~~~~~~~~~~~~~~vim +248 arch/powerpc/include/asm/ptrace.h
4e0e45b07d79025 Nicholas Piggin 2020-05-07 247
d72500f992849d3 Nicholas Piggin 2021-05-20 @248 #define kernel_stack_pointer(regs) ((regs)->gpr[1])
d72500f992849d3 Nicholas Piggin 2021-05-20 249 static inline int is_syscall_success(struct pt_regs *regs)
d72500f992849d3 Nicholas Piggin 2021-05-20 250 {
d72500f992849d3 Nicholas Piggin 2021-05-20 251 if (trap_is_scv(regs))
d72500f992849d3 Nicholas Piggin 2021-05-20 252 return !IS_ERR_VALUE((unsigned long)regs->gpr[3]);
d72500f992849d3 Nicholas Piggin 2021-05-20 253 else
d72500f992849d3 Nicholas Piggin 2021-05-20 254 return !(regs->ccr & 0x10000000);
d72500f992849d3 Nicholas Piggin 2021-05-20 255 }d72500f992849d3 Nicholas Piggin 2021-05-20 256
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build bot[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]
Hi "Tzvetomir,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on v5.14-rc5]
[also build test WARNING on next-20210810]
[cannot apply to tip/perf/core]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Tzvetomir-Stoyanov-VMware/trace-Add-kprobe-on-tracepoint/20210810-192225 base: 36a21d51725af2ce0700c6ebcb6b9594aac658a6 config: hexagon-randconfig-r041-20210810 (attached as .config) compiler: clang version 12.0.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/e3bec14eb58da9408eba8ccc55c9f5cf4e1ff114
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Tzvetomir-Stoyanov-VMware/trace-Add-kprobe-on-tracepoint/20210810-192225 git checkout e3bec14eb58da9408eba8ccc55c9f5cf4e1ff114
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=hexagon
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> kernel/trace/trace_eprobe.c:46:6: warning: no previous prototype for function 'trace_event_probe_cleanup' [-Wmissing-prototypes]
void trace_event_probe_cleanup(struct trace_eprobe *ep)
^ kernel/trace/trace_eprobe.c:46:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void trace_event_probe_cleanup(struct trace_eprobe *ep)
^
static
1 warning generated.
vim +/trace_event_probe_cleanup +46 kernel/trace/trace_eprobe.c
45
> 46 void trace_event_probe_cleanup(struct trace_eprobe *ep)
47 {
48 trace_probe_cleanup(&ep->tp);
49 kfree(ep->event_name);
50 kfree(ep->event_system);
51 if (ep->event)
52 module_put(ep->event->mod);
53 kfree(ep);
54 }
55 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build bot[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]
Hi "Tzvetomir,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on v5.14-rc5]
[also build test WARNING on next-20210810]
[cannot apply to tip/perf/core]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Tzvetomir-Stoyanov-VMware/trace-Add-kprobe-on-tracepoint/20210810-192225 base: 36a21d51725af2ce0700c6ebcb6b9594aac658a6 config: sh-allmodconfig (attached as .config) compiler: sh4-linux-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/e3bec14eb58da9408eba8ccc55c9f5cf4e1ff114
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Tzvetomir-Stoyanov-VMware/trace-Add-kprobe-on-tracepoint/20210810-192225 git checkout e3bec14eb58da9408eba8ccc55c9f5cf4e1ff114
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=sh
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
In file included from include/linux/sched/signal.h:14,
from include/linux/rcuwait.h:6,
from include/linux/percpu-rwsem.h:7,
from include/linux/fs.h:33,
from include/linux/security.h:29,
from kernel/trace/trace_kprobe.c:10:
kernel/trace/trace_kprobe.c: In function 'process_fetch_insn':
>> arch/sh/include/asm/ptrace.h:17:60: warning: dereferencing 'void *' pointer
17 | #define kernel_stack_pointer(_regs) ((unsigned long)(_regs)->regs[15])
| ^~
kernel/trace/trace_kprobe.c:1340:9: note: in expansion of macro 'kernel_stack_pointer'
1340 | val = kernel_stack_pointer(regs);
| ^~~~~~~~~~~~~~~~~~~~
arch/sh/include/asm/ptrace.h:17:60: error: request for member 'regs' in something not a structure or union
17 | #define kernel_stack_pointer(_regs) ((unsigned long)(_regs)->regs[15])
| ^~
kernel/trace/trace_kprobe.c:1340:9: note: in expansion of macro 'kernel_stack_pointer'
1340 | val = kernel_stack_pointer(regs);
| ^~~~~~~~~~~~~~~~~~~~Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for SND_ATMEL_SOC_PDC
Depends on SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC && HAS_DMA Selected by
- SND_ATMEL_SOC_SSC && SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC
- SND_ATMEL_SOC_SSC_PDC && SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC && ATMEL_SSC
vim +17 arch/sh/include/asm/ptrace.h
33f242ed11ce6b include/asm-sh/ptrace.h Paul Mundt 2007-11-09 15 ^1da177e4c3f41 include/asm-sh/ptrace.h Linus Torvalds 2005-04-16 16 #define user_mode(regs) (((regs)->sr & 0x40000000)==0)
eac676e531214f arch/sh/include/asm/ptrace.h Roel Kluin 2011-01-01 @17 #define kernel_stack_pointer(_regs) ((unsigned long)(_regs)->regs[15])db7eba292e9133 arch/sh/include/asm/ptrace.h Paul Mundt 2011-05-31 18
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build bot[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]
Hi "Tzvetomir,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on v5.14-rc5]
[cannot apply to tip/perf/core]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Tzvetomir-Stoyanov-VMware/trace-Add-kprobe-on-tracepoint/20210810-192225 base: 36a21d51725af2ce0700c6ebcb6b9594aac658a6 config: x86_64-randconfig-s022-20210809 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.3-348-gf0e6938b-dirty # https://github.com/0day-ci/linux/commit/e3bec14eb58da9408eba8ccc55c9f5cf4e1ff114 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Tzvetomir-Stoyanov-VMware/trace-Add-kprobe-on-tracepoint/20210810-192225 git checkout e3bec14eb58da9408eba8ccc55c9f5cf4e1ff114 # save the attached .config to linux build tree make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
sparse warnings: (new ones prefixed by >>)
>> kernel/trace/trace_eprobe.c:46:6: sparse: sparse: symbol 'trace_event_probe_cleanup' was not declared. Should it be static?
Please review and possibly fold the followup patch.
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build bot[RFC PATCH] trace: trace_event_probe_cleanup() can be static
In reply to Tzvetomir Stoyanov (VMware)kernel/trace/trace_eprobe.c:46:6: warning: symbol 'trace_event_probe_cleanup' was not declared. Should it be static?
kernel/trace/trace_eprobe.c:46:6: warning: symbol 'trace_event_probe_cleanup' was not declared. Should it be static?
--- trace_eprobe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_eprobe.c +1 -1
@@ -43,7 +43,7 @@ struct eprobe_data {static int __trace_eprobe_create (int argc,const char *argv[]); -void trace_event_probe_cleanup (struct trace_eprobe *ep) +static void trace_event_probe_cleanup (struct trace_eprobe *ep) {trace_probe_cleanup (&ep->tp);kfree (ep->event_name);