All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tracing: Fix event probe removal from dynamic events
@ 2021-10-12  1:11 Steven Rostedt
  2021-10-12  6:49   ` kernel test robot
  2021-10-12  8:29   ` kernel test robot
  0 siblings, 2 replies; 7+ messages in thread
From: Steven Rostedt @ 2021-10-12  1:11 UTC (permalink / raw)
  To: LKML
  Cc: Ingo Molnar, Andrew Morton, Masami Hiramatsu, Tom Zanussi,
	Tzvetomir Stoyanov, Yordan Karadzhov

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

When an event probe is to be removed via the API to remove dynamic events,
an -EBUSY error is returned.

This is because the removal of the event probe does not expect to see the
event system and name that the event probe is attached to, even though
that's part of the API to create it. As the removal of probes is to use
the same API as they are created, fix it by first testing if the first
parameter of the event probe to be removed matches the system and event
that the probe is attached to, and then adjust the argc and argv of the
parameters to match the rest of the syntax.

Fixes: 7491e2c442781 ("tracing: Add a probe that attaches to trace events")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/trace_eprobe.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/kernel/trace/trace_eprobe.c b/kernel/trace/trace_eprobe.c
index 3044b762cbd7..20ee265f01fd 100644
--- a/kernel/trace/trace_eprobe.c
+++ b/kernel/trace/trace_eprobe.c
@@ -120,6 +120,25 @@ static bool eprobe_dyn_event_match(const char *system, const char *event,
 {
 	struct trace_eprobe *ep = to_trace_eprobe(ev);
 
+	/* First argument is the system/event the probe is attached to */
+
+	if (argc < 1)
+		return false;
+
+	slash = strchr(argv[0], '/');
+	if (!slash)
+		slash = strchr(argv[0], '.');
+	if (!slash)
+		return false;
+
+	if (strncmp(ep->event_system, argv[0], slash - argv[0]))
+		return false;
+	if (strcmp(ep->event_name, slash + 1))
+		return false;
+
+	argc--;
+	argv++;
+
 	return strcmp(trace_probe_name(&ep->tp), event) == 0 &&
 	    (!system || strcmp(trace_probe_group_name(&ep->tp), system) == 0) &&
 	    trace_probe_match_command_args(&ep->tp, argc, argv);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] tracing: Fix event probe removal from dynamic events
  2021-10-12  1:11 [PATCH] tracing: Fix event probe removal from dynamic events Steven Rostedt
@ 2021-10-12  6:49   ` kernel test robot
  2021-10-12  8:29   ` kernel test robot
  1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2021-10-12  6:49 UTC (permalink / raw)
  To: Steven Rostedt, LKML
  Cc: llvm, kbuild-all, Ingo Molnar, Andrew Morton,
	Linux Memory Management List, Masami Hiramatsu, Tom Zanussi,
	Tzvetomir Stoyanov, Yordan Karadzhov

[-- Attachment #1: Type: text/plain, Size: 3842 bytes --]

Hi Steven,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linux/master]
[also build test ERROR on hnaz-mm/master linus/master v5.15-rc5 next-20211011]
[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/Steven-Rostedt/tracing-Fix-event-probe-removal-from-dynamic-events/20211012-091238
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 5816b3e6577eaa676ceb00a848f0fd65fe2adc29
config: arm64-randconfig-r005-20211011 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c3dcf39554dbea780d6cb7e12239451ba47a2668)
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
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/0day-ci/linux/commit/4d930af6a4aa75558017f921e2c9692ed27b2c56
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Steven-Rostedt/tracing-Fix-event-probe-removal-from-dynamic-events/20211012-091238
        git checkout 4d930af6a4aa75558017f921e2c9692ed27b2c56
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash kernel/trace/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> kernel/trace/trace_eprobe.c:128:2: error: use of undeclared identifier 'slash'
           slash = strchr(argv[0], '/');
           ^
   kernel/trace/trace_eprobe.c:129:7: error: use of undeclared identifier 'slash'
           if (!slash)
                ^
   kernel/trace/trace_eprobe.c:130:3: error: use of undeclared identifier 'slash'
                   slash = strchr(argv[0], '.');
                   ^
   kernel/trace/trace_eprobe.c:131:7: error: use of undeclared identifier 'slash'
           if (!slash)
                ^
   kernel/trace/trace_eprobe.c:134:41: error: use of undeclared identifier 'slash'
           if (strncmp(ep->event_system, argv[0], slash - argv[0]))
                                                  ^
   kernel/trace/trace_eprobe.c:136:29: error: use of undeclared identifier 'slash'
           if (strcmp(ep->event_name, slash + 1))
                                      ^
   6 errors generated.


vim +/slash +128 kernel/trace/trace_eprobe.c

   117	
   118	static bool eprobe_dyn_event_match(const char *system, const char *event,
   119				int argc, const char **argv, struct dyn_event *ev)
   120	{
   121		struct trace_eprobe *ep = to_trace_eprobe(ev);
   122	
   123		/* First argument is the system/event the probe is attached to */
   124	
   125		if (argc < 1)
   126			return false;
   127	
 > 128		slash = strchr(argv[0], '/');
   129		if (!slash)
   130			slash = strchr(argv[0], '.');
   131		if (!slash)
   132			return false;
   133	
   134		if (strncmp(ep->event_system, argv[0], slash - argv[0]))
   135			return false;
   136		if (strcmp(ep->event_name, slash + 1))
   137			return false;
   138	
   139		argc--;
   140		argv++;
   141	
   142		return strcmp(trace_probe_name(&ep->tp), event) == 0 &&
   143		    (!system || strcmp(trace_probe_group_name(&ep->tp), system) == 0) &&
   144		    trace_probe_match_command_args(&ep->tp, argc, argv);
   145	}
   146	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34308 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] tracing: Fix event probe removal from dynamic events
@ 2021-10-12  6:49   ` kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2021-10-12  6:49 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3934 bytes --]

Hi Steven,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linux/master]
[also build test ERROR on hnaz-mm/master linus/master v5.15-rc5 next-20211011]
[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/Steven-Rostedt/tracing-Fix-event-probe-removal-from-dynamic-events/20211012-091238
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 5816b3e6577eaa676ceb00a848f0fd65fe2adc29
config: arm64-randconfig-r005-20211011 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c3dcf39554dbea780d6cb7e12239451ba47a2668)
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
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/0day-ci/linux/commit/4d930af6a4aa75558017f921e2c9692ed27b2c56
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Steven-Rostedt/tracing-Fix-event-probe-removal-from-dynamic-events/20211012-091238
        git checkout 4d930af6a4aa75558017f921e2c9692ed27b2c56
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash kernel/trace/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> kernel/trace/trace_eprobe.c:128:2: error: use of undeclared identifier 'slash'
           slash = strchr(argv[0], '/');
           ^
   kernel/trace/trace_eprobe.c:129:7: error: use of undeclared identifier 'slash'
           if (!slash)
                ^
   kernel/trace/trace_eprobe.c:130:3: error: use of undeclared identifier 'slash'
                   slash = strchr(argv[0], '.');
                   ^
   kernel/trace/trace_eprobe.c:131:7: error: use of undeclared identifier 'slash'
           if (!slash)
                ^
   kernel/trace/trace_eprobe.c:134:41: error: use of undeclared identifier 'slash'
           if (strncmp(ep->event_system, argv[0], slash - argv[0]))
                                                  ^
   kernel/trace/trace_eprobe.c:136:29: error: use of undeclared identifier 'slash'
           if (strcmp(ep->event_name, slash + 1))
                                      ^
   6 errors generated.


vim +/slash +128 kernel/trace/trace_eprobe.c

   117	
   118	static bool eprobe_dyn_event_match(const char *system, const char *event,
   119				int argc, const char **argv, struct dyn_event *ev)
   120	{
   121		struct trace_eprobe *ep = to_trace_eprobe(ev);
   122	
   123		/* First argument is the system/event the probe is attached to */
   124	
   125		if (argc < 1)
   126			return false;
   127	
 > 128		slash = strchr(argv[0], '/');
   129		if (!slash)
   130			slash = strchr(argv[0], '.');
   131		if (!slash)
   132			return false;
   133	
   134		if (strncmp(ep->event_system, argv[0], slash - argv[0]))
   135			return false;
   136		if (strcmp(ep->event_name, slash + 1))
   137			return false;
   138	
   139		argc--;
   140		argv++;
   141	
   142		return strcmp(trace_probe_name(&ep->tp), event) == 0 &&
   143		    (!system || strcmp(trace_probe_group_name(&ep->tp), system) == 0) &&
   144		    trace_probe_match_command_args(&ep->tp, argc, argv);
   145	}
   146	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34308 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] tracing: Fix event probe removal from dynamic events
  2021-10-12  1:11 [PATCH] tracing: Fix event probe removal from dynamic events Steven Rostedt
@ 2021-10-12  8:29   ` kernel test robot
  2021-10-12  8:29   ` kernel test robot
  1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2021-10-12  8:29 UTC (permalink / raw)
  To: Steven Rostedt, LKML
  Cc: kbuild-all, Ingo Molnar, Andrew Morton,
	Linux Memory Management List, Masami Hiramatsu, Tom Zanussi,
	Tzvetomir Stoyanov, Yordan Karadzhov

[-- Attachment #1: Type: text/plain, Size: 3073 bytes --]

Hi Steven,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linux/master]
[also build test ERROR on hnaz-mm/master linus/master v5.15-rc5 next-20211011]
[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/Steven-Rostedt/tracing-Fix-event-probe-removal-from-dynamic-events/20211012-091238
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 5816b3e6577eaa676ceb00a848f0fd65fe2adc29
config: parisc-randconfig-r006-20211011 (attached as .config)
compiler: hppa-linux-gcc (GCC) 11.2.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/4d930af6a4aa75558017f921e2c9692ed27b2c56
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Steven-Rostedt/tracing-Fix-event-probe-removal-from-dynamic-events/20211012-091238
        git checkout 4d930af6a4aa75558017f921e2c9692ed27b2c56
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=parisc SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   kernel/trace/trace_eprobe.c: In function 'eprobe_dyn_event_match':
>> kernel/trace/trace_eprobe.c:128:9: error: 'slash' undeclared (first use in this function)
     128 |         slash = strchr(argv[0], '/');
         |         ^~~~~
   kernel/trace/trace_eprobe.c:128:9: note: each undeclared identifier is reported only once for each function it appears in


vim +/slash +128 kernel/trace/trace_eprobe.c

   117	
   118	static bool eprobe_dyn_event_match(const char *system, const char *event,
   119				int argc, const char **argv, struct dyn_event *ev)
   120	{
   121		struct trace_eprobe *ep = to_trace_eprobe(ev);
   122	
   123		/* First argument is the system/event the probe is attached to */
   124	
   125		if (argc < 1)
   126			return false;
   127	
 > 128		slash = strchr(argv[0], '/');
   129		if (!slash)
   130			slash = strchr(argv[0], '.');
   131		if (!slash)
   132			return false;
   133	
   134		if (strncmp(ep->event_system, argv[0], slash - argv[0]))
   135			return false;
   136		if (strcmp(ep->event_name, slash + 1))
   137			return false;
   138	
   139		argc--;
   140		argv++;
   141	
   142		return strcmp(trace_probe_name(&ep->tp), event) == 0 &&
   143		    (!system || strcmp(trace_probe_group_name(&ep->tp), system) == 0) &&
   144		    trace_probe_match_command_args(&ep->tp, argc, argv);
   145	}
   146	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32676 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] tracing: Fix event probe removal from dynamic events
@ 2021-10-12  8:29   ` kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2021-10-12  8:29 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3149 bytes --]

Hi Steven,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linux/master]
[also build test ERROR on hnaz-mm/master linus/master v5.15-rc5 next-20211011]
[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/Steven-Rostedt/tracing-Fix-event-probe-removal-from-dynamic-events/20211012-091238
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 5816b3e6577eaa676ceb00a848f0fd65fe2adc29
config: parisc-randconfig-r006-20211011 (attached as .config)
compiler: hppa-linux-gcc (GCC) 11.2.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/4d930af6a4aa75558017f921e2c9692ed27b2c56
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Steven-Rostedt/tracing-Fix-event-probe-removal-from-dynamic-events/20211012-091238
        git checkout 4d930af6a4aa75558017f921e2c9692ed27b2c56
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=parisc SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   kernel/trace/trace_eprobe.c: In function 'eprobe_dyn_event_match':
>> kernel/trace/trace_eprobe.c:128:9: error: 'slash' undeclared (first use in this function)
     128 |         slash = strchr(argv[0], '/');
         |         ^~~~~
   kernel/trace/trace_eprobe.c:128:9: note: each undeclared identifier is reported only once for each function it appears in


vim +/slash +128 kernel/trace/trace_eprobe.c

   117	
   118	static bool eprobe_dyn_event_match(const char *system, const char *event,
   119				int argc, const char **argv, struct dyn_event *ev)
   120	{
   121		struct trace_eprobe *ep = to_trace_eprobe(ev);
   122	
   123		/* First argument is the system/event the probe is attached to */
   124	
   125		if (argc < 1)
   126			return false;
   127	
 > 128		slash = strchr(argv[0], '/');
   129		if (!slash)
   130			slash = strchr(argv[0], '.');
   131		if (!slash)
   132			return false;
   133	
   134		if (strncmp(ep->event_system, argv[0], slash - argv[0]))
   135			return false;
   136		if (strcmp(ep->event_name, slash + 1))
   137			return false;
   138	
   139		argc--;
   140		argv++;
   141	
   142		return strcmp(trace_probe_name(&ep->tp), event) == 0 &&
   143		    (!system || strcmp(trace_probe_group_name(&ep->tp), system) == 0) &&
   144		    trace_probe_match_command_args(&ep->tp, argc, argv);
   145	}
   146	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32676 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] tracing: Fix event probe removal from dynamic events
  2021-10-12  6:49   ` kernel test robot
@ 2021-10-12 12:10     ` Steven Rostedt
  -1 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2021-10-12 12:10 UTC (permalink / raw)
  To: kernel test robot
  Cc: LKML, llvm, kbuild-all, Ingo Molnar, Andrew Morton,
	Linux Memory Management List, Masami Hiramatsu, Tom Zanussi,
	Tzvetomir Stoyanov, Yordan Karadzhov

On Tue, 12 Oct 2021 14:49:49 +0800
kernel test robot <lkp@intel.com> wrote:

> All errors (new ones prefixed by >>):
> 
> >> kernel/trace/trace_eprobe.c:128:2: error: use of undeclared identifier 'slash'  
>            slash = strchr(argv[0], '/');
>            ^

Bah, I fixed this after creating the initial commit, but never amended the
commit with the update, and sent out the broken commit.

Will send out v2 shortly.

-- Steve

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] tracing: Fix event probe removal from dynamic events
@ 2021-10-12 12:10     ` Steven Rostedt
  0 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2021-10-12 12:10 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 446 bytes --]

On Tue, 12 Oct 2021 14:49:49 +0800
kernel test robot <lkp@intel.com> wrote:

> All errors (new ones prefixed by >>):
> 
> >> kernel/trace/trace_eprobe.c:128:2: error: use of undeclared identifier 'slash'  
>            slash = strchr(argv[0], '/');
>            ^

Bah, I fixed this after creating the initial commit, but never amended the
commit with the update, and sent out the broken commit.

Will send out v2 shortly.

-- Steve

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-10-12 12:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12  1:11 [PATCH] tracing: Fix event probe removal from dynamic events Steven Rostedt
2021-10-12  6:49 ` kernel test robot
2021-10-12  6:49   ` kernel test robot
2021-10-12 12:10   ` Steven Rostedt
2021-10-12 12:10     ` Steven Rostedt
2021-10-12  8:29 ` kernel test robot
2021-10-12  8:29   ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.