tracing/probes: Fix a warning message to show correct maximum length
Masami Hiramatsu
maintainerPATCH 1/1 tracing/probes: Fix a warning message to show correct maximum length
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.
--- kernel/trace/trace_probe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/trace/trace_probe.c +2 -1
@@ -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; }
Quoted 14 lines · Masami Hiramatsu
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 <[email protected]>--- kernel/trace/trace_probe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)kernel/trace/trace_probe.c +0
-0
kernel/trace/trace_probe.c ssize_t traceprobe_probes_write(struct file *file, const char __user *buffer, · line 678
Quoted 7 lines
kernel/trace/trace_probe.c +2
-1@@ -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
Masami Hiramatsu
maintainerQuoted 28 lines · On Tue, 7 Feb 2017 08:41:48 +0100 Ingo Molnar <[email protected]> wrote:
Quoted 14 lines · Masami Hiramatsu
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 <[email protected]>--- kernel/trace/trace_probe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)kernel/trace/trace_probe.c +0
-0kernel/trace/trace_probe.c ssize_t traceprobe_probes_write(struct file *file, const char __user *buffer, · line 678
Quoted 7 lines
kernel/trace/trace_probe.c +2
-1@@ -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.
Quoted 3 lines
You can do this by having something like this at the top of the
trace_probefile:#define pr_fmt(fmt) "trace_probe: " fmt
Ah, I got it. I'll make a separate patch for that.
Thank you!
Signature · 1 line
Masami Hiramatsu <[email protected]>
Masami Hiramatsu
maintainerPATCH 1/1 tracing/probe: Show subsystem name in messages
In reply to Ingo MolnarShow "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.
--- kernel/trace/trace_kprobe.c | 1 + kernel/trace/trace_probe.c | 1 + kernel/trace/trace_uprobe.c | 1 + 3 files changed, 3 insertions(+)
kernel/trace/trace_kprobe.c +1 -0
@@ -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>
kernel/trace/trace_probe.c +1 -0
@@ -21,6 +21,7 @@* Copyright (C) IBM Corporation, 2010-2011 * Author: Srikar Dronamraju */ +#define pr_fmt (fmt) "trace_probe: " fmt#include "trace_probe.h"
kernel/trace/trace_uprobe.c +1 -0
@@ -17,6 +17,7 @@* Copyright (C) IBM Corporation, 2010-2012 * Author: Srikar Dronamraju <[email protected]> */ +#define pr_fmt (fmt) "trace_kprobe: " fmt#include <linux/module.h> #include <linux/uaccess.h>
Re: [PATCH tip/master] tracing/probe: Show subsystem name in messages
Quoted 6 lines · On Tue, 7 Feb 2017 20:21:28 +0900 Masami Hiramatsu <[email protected]> wrote:
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 <[email protected]>
Applied. Thanks!
-- Steve