Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1575351 > unrolled thread

[PATCH tip/master] tracing/probes: Fix a warning message to show correct maximum length

Started byMasami Hiramatsu <mhiramat@kernel.org>
First post2017-02-07 04:20 +0100
Last post2017-02-07 12:30 +0100
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH tip/master] tracing/probes: Fix a warning message to show correct maximum length Masami Hiramatsu <mhiramat@kernel.org> - 2017-02-07 04:20 +0100
    Re: [PATCH tip/master] tracing/probes: Fix a warning message to show  correct maximum length Ingo Molnar <mingo@kernel.org> - 2017-02-07 08:50 +0100
      Re: [PATCH tip/master] tracing/probes: Fix a warning message to  show correct maximum length Masami Hiramatsu <mhiramat@kernel.org> - 2017-02-07 12:10 +0100
      [PATCH tip/master] tracing/probe: Show subsystem name in messages Masami Hiramatsu <mhiramat@kernel.org> - 2017-02-07 12:30 +0100

#1575351 — [PATCH tip/master] tracing/probes: Fix a warning message to show correct maximum length

FromMasami Hiramatsu <mhiramat@kernel.org>
Date2017-02-07 04:20 +0100
Subject[PATCH tip/master] tracing/probes: Fix a warning message to show correct maximum length
Message-ID<t84tY-5Bi-3@gated-at.bofh.it>
Since tracing/*probe_events will accept a probe definition
up to 4096 - 2 ('\n' and '\0') bytes, it must show 4094 instead
of 4096 in warning message.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 kernel/trace/trace_probe.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 8c0553d..7138fea 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -673,8 +673,9 @@ ssize_t traceprobe_probes_write(struct file *file, const char __user *buffer,
 			*tmp = '\0';
 			size = tmp - kbuf + 1;
 		} else if (done + size < count) {
+			/* This can accept WRITE_BUFSIZE - 2 ('\n' + '\0') */
 			pr_warn("Line length is too long: Should be less than %d\n",
-				WRITE_BUFSIZE);
+				WRITE_BUFSIZE - 2);
 			ret = -EINVAL;
 			goto out;
 		}

[toc] | [next] | [standalone]


#1575434 — Re: [PATCH tip/master] tracing/probes: Fix a warning message to show correct maximum length

FromIngo Molnar <mingo@kernel.org>
Date2017-02-07 08:50 +0100
SubjectRe: [PATCH tip/master] tracing/probes: Fix a warning message to show correct maximum length
Message-ID<t88Hf-8lN-1@gated-at.bofh.it>
In reply to#1575351
* Masami Hiramatsu <mhiramat@kernel.org> wrote:

> Since tracing/*probe_events will accept a probe definition
> up to 4096 - 2 ('\n' and '\0') bytes, it must show 4094 instead
> of 4096 in warning message.
> 
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> ---
>  kernel/trace/trace_probe.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
> index 8c0553d..7138fea 100644
> --- a/kernel/trace/trace_probe.c
> +++ b/kernel/trace/trace_probe.c
> @@ -673,8 +673,9 @@ ssize_t traceprobe_probes_write(struct file *file, const char __user *buffer,
>  			*tmp = '\0';
>  			size = tmp - kbuf + 1;
>  		} else if (done + size < count) {
> +			/* This can accept WRITE_BUFSIZE - 2 ('\n' + '\0') */
>  			pr_warn("Line length is too long: Should be less than %d\n",
> -				WRITE_BUFSIZE);
> +				WRITE_BUFSIZE - 2);

The message should also indicate which kernel subsystem generated it - which is 
useful if the message is not immediately noticed in the kernel log.

You can do this by having something like this at the top of the trace_probe file:

  #define pr_fmt(fmt) "trace_probe: " fmt

Thanks,

	Ingo

[toc] | [prev] | [next] | [standalone]


#1575564 — Re: [PATCH tip/master] tracing/probes: Fix a warning message to show correct maximum length

FromMasami Hiramatsu <mhiramat@kernel.org>
Date2017-02-07 12:10 +0100
SubjectRe: [PATCH tip/master] tracing/probes: Fix a warning message to show correct maximum length
Message-ID<t8bOO-24f-27@gated-at.bofh.it>
In reply to#1575434
On Tue, 7 Feb 2017 08:41:48 +0100
Ingo Molnar <mingo@kernel.org> wrote:

> 
> * Masami Hiramatsu <mhiramat@kernel.org> wrote:
> 
> > Since tracing/*probe_events will accept a probe definition
> > up to 4096 - 2 ('\n' and '\0') bytes, it must show 4094 instead
> > of 4096 in warning message.
> > 
> > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> > ---
> >  kernel/trace/trace_probe.c |    3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
> > index 8c0553d..7138fea 100644
> > --- a/kernel/trace/trace_probe.c
> > +++ b/kernel/trace/trace_probe.c
> > @@ -673,8 +673,9 @@ ssize_t traceprobe_probes_write(struct file *file, const char __user *buffer,
> >  			*tmp = '\0';
> >  			size = tmp - kbuf + 1;
> >  		} else if (done + size < count) {
> > +			/* This can accept WRITE_BUFSIZE - 2 ('\n' + '\0') */
> >  			pr_warn("Line length is too long: Should be less than %d\n",
> > -				WRITE_BUFSIZE);
> > +				WRITE_BUFSIZE - 2);
> 
> The message should also indicate which kernel subsystem generated it - which is 
> useful if the message is not immediately noticed in the kernel log.
> 
> You can do this by having something like this at the top of the trace_probe file:
> 
>   #define pr_fmt(fmt) "trace_probe: " fmt

Ah, I got it. I'll make a separate patch for that.

Thank you!

-- 
Masami Hiramatsu <mhiramat@kernel.org>

[toc] | [prev] | [next] | [standalone]


#1575577 — [PATCH tip/master] tracing/probe: Show subsystem name in messages

FromMasami Hiramatsu <mhiramat@kernel.org>
Date2017-02-07 12:30 +0100
Subject[PATCH tip/master] tracing/probe: Show subsystem name in messages
Message-ID<t8c8a-2bv-27@gated-at.bofh.it>
In reply to#1575434
Show "trace_probe:", "trace_kprobe:" and "trace_uprobe:"
headers for each warning/error/info message. This will
help people to notice that kprobe/uprobe events caused
those messages.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 kernel/trace/trace_kprobe.c |    1 +
 kernel/trace/trace_probe.c  |    1 +
 kernel/trace/trace_uprobe.c |    1 +
 3 files changed, 3 insertions(+)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index d3729bd..5f688cc 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -16,6 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+#define pr_fmt(fmt)	"trace_kprobe: " fmt
 
 #include <linux/module.h>
 #include <linux/uaccess.h>
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 7138fea..eda3a45 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -21,6 +21,7 @@
  * Copyright (C) IBM Corporation, 2010-2011
  * Author:     Srikar Dronamraju
  */
+#define pr_fmt(fmt)	"trace_probe: " fmt
 
 #include "trace_probe.h"
 
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index e5445ab..2c6b2d0c 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -17,6 +17,7 @@
  * Copyright (C) IBM Corporation, 2010-2012
  * Author:	Srikar Dronamraju <srikar@linux.vnet.ibm.com>
  */
+#define pr_fmt(fmt)	"trace_kprobe: " fmt
 
 #include <linux/module.h>
 #include <linux/uaccess.h>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web