* [PATCH 0/4] tracing: printk:console fix and __get_str() cleanup
@ 2016-07-01 23:44 Daniel Bristot de Oliveira
2016-07-01 23:44 ` [PATCH 1/4] tracing: Use outer () on __get_str() definition Daniel Bristot de Oliveira
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Daniel Bristot de Oliveira @ 2016-07-01 23:44 UTC (permalink / raw)
To: linux-kernel
Cc: Steven Rostedt, Ingo Molnar, Trond Myklebust, Anna Schumaker,
linux-nfs
This patch series fixes a problem on printk:console tracepoint
that prints a blank line in the trace output after each printk
message that finishes with '\n'.
It also does some cleanup on __get_str() usage, that
was found while fixing the printk:console tracepoint.
Daniel Bristot de Oliveira (4):
tracing: Use outer () on __get_str() definition
tracing, RAS: Cleanup on __get_str() usage
tracing: Use __get_str() when manipulating strings
printk, tracing: Avoiding unneeded blank lines
fs/nfs/nfs4trace.h | 4 ++--
fs/nfs/nfstrace.h | 4 ++--
include/ras/ras_event.h | 4 ++--
include/trace/events/printk.h | 12 ++++++++++--
include/trace/perf.h | 2 +-
include/trace/trace_events.h | 2 +-
6 files changed, 18 insertions(+), 10 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] tracing: Use outer () on __get_str() definition
2016-07-01 23:44 [PATCH 0/4] tracing: printk:console fix and __get_str() cleanup Daniel Bristot de Oliveira
@ 2016-07-01 23:44 ` Daniel Bristot de Oliveira
2016-07-01 23:44 ` [PATCH 2/4] tracing, RAS: Cleanup on __get_str() usage Daniel Bristot de Oliveira
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Daniel Bristot de Oliveira @ 2016-07-01 23:44 UTC (permalink / raw)
To: linux-kernel
Cc: Steven Rostedt, Ingo Molnar, Trond Myklebust, Anna Schumaker,
linux-nfs
__get_str(str)'s definition includes a (char *) operator
overloading that is not protected with outer ().
This patch adds () around __get_str()'s definition, enabling
some code cleanup.
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: linux-kernel@vger.kernel.org
---
include/trace/perf.h | 2 +-
include/trace/trace_events.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/trace/perf.h b/include/trace/perf.h
index 26486fc..7144550 100644
--- a/include/trace/perf.h
+++ b/include/trace/perf.h
@@ -15,7 +15,7 @@
((__entry->__data_loc_##field >> 16) & 0xffff)
#undef __get_str
-#define __get_str(field) (char *)__get_dynamic_array(field)
+#define __get_str(field) ((char *)__get_dynamic_array(field))
#undef __get_bitmask
#define __get_bitmask(field) (char *)__get_dynamic_array(field)
diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h
index 170c93b..427e4aa 100644
--- a/include/trace/trace_events.h
+++ b/include/trace/trace_events.h
@@ -256,7 +256,7 @@ TRACE_MAKE_SYSTEM_STR();
((__entry->__data_loc_##field >> 16) & 0xffff)
#undef __get_str
-#define __get_str(field) (char *)__get_dynamic_array(field)
+#define __get_str(field) ((char *)__get_dynamic_array(field))
#undef __get_bitmask
#define __get_bitmask(field) \
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] tracing, RAS: Cleanup on __get_str() usage
2016-07-01 23:44 [PATCH 0/4] tracing: printk:console fix and __get_str() cleanup Daniel Bristot de Oliveira
2016-07-01 23:44 ` [PATCH 1/4] tracing: Use outer () on __get_str() definition Daniel Bristot de Oliveira
@ 2016-07-01 23:44 ` Daniel Bristot de Oliveira
2016-07-01 23:44 ` [PATCH 3/4] tracing: Use __get_str() when manipulating strings Daniel Bristot de Oliveira
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Daniel Bristot de Oliveira @ 2016-07-01 23:44 UTC (permalink / raw)
To: linux-kernel
Cc: Steven Rostedt, Ingo Molnar, Trond Myklebust, Anna Schumaker,
linux-nfs
__get_str(msg) does not need (char *) operator overloading to access
mgs's elements anymore. This patch substitutes
((char *)__get_str(msg))[0] usage to __get_str(msg)[0].
It is just a code cleanup, no changes on tracepoint ABI.
Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: linux-kernel@vger.kernel.org
---
include/ras/ras_event.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/ras/ras_event.h b/include/ras/ras_event.h
index 1443d79..1791a12 100644
--- a/include/ras/ras_event.h
+++ b/include/ras/ras_event.h
@@ -147,7 +147,7 @@ TRACE_EVENT(mc_event,
__entry->error_count,
mc_event_error_type(__entry->error_type),
__entry->error_count > 1 ? "s" : "",
- ((char *)__get_str(msg))[0] ? " " : "",
+ __get_str(msg)[0] ? " " : "",
__get_str(msg),
__get_str(label),
__entry->mc_index,
@@ -157,7 +157,7 @@ TRACE_EVENT(mc_event,
__entry->address,
1 << __entry->grain_bits,
__entry->syndrome,
- ((char *)__get_str(driver_detail))[0] ? " " : "",
+ __get_str(driver_detail)[0] ? " " : "",
__get_str(driver_detail))
);
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] tracing: Use __get_str() when manipulating strings
2016-07-01 23:44 [PATCH 0/4] tracing: printk:console fix and __get_str() cleanup Daniel Bristot de Oliveira
2016-07-01 23:44 ` [PATCH 1/4] tracing: Use outer () on __get_str() definition Daniel Bristot de Oliveira
2016-07-01 23:44 ` [PATCH 2/4] tracing, RAS: Cleanup on __get_str() usage Daniel Bristot de Oliveira
@ 2016-07-01 23:44 ` Daniel Bristot de Oliveira
2016-07-01 23:44 ` [PATCH 4/4] printk, tracing: Avoiding unneeded blank lines Daniel Bristot de Oliveira
2016-07-15 19:53 ` [PATCH 0/4] tracing: printk:console fix and __get_str() cleanup Daniel Bristot de Oliveira
4 siblings, 0 replies; 6+ messages in thread
From: Daniel Bristot de Oliveira @ 2016-07-01 23:44 UTC (permalink / raw)
To: linux-kernel
Cc: Steven Rostedt, Ingo Molnar, Trond Myklebust, Anna Schumaker,
linux-nfs
Use __get_str(str) rather than __get_dynamic_array(str) when
deadling with strings.
It is just a code cleanup, no changes on tracepoint ABI.
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: Anna Schumaker <anna.schumaker@netapp.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: linux-nfs@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
fs/nfs/nfs4trace.h | 4 ++--
fs/nfs/nfstrace.h | 4 ++--
include/trace/events/printk.h | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h
index 2c8d05d..adec59a 100644
--- a/fs/nfs/nfs4trace.h
+++ b/fs/nfs/nfs4trace.h
@@ -1235,8 +1235,8 @@ DECLARE_EVENT_CLASS(nfs4_idmap_event,
len = 0;
__entry->error = error < 0 ? error : 0;
__entry->id = id;
- memcpy(__get_dynamic_array(name), name, len);
- ((char *)__get_dynamic_array(name))[len] = 0;
+ memcpy(__get_str(name), name, len);
+ __get_str(name)[len] = 0;
),
TP_printk(
diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
index 9f80a08..32ff934 100644
--- a/fs/nfs/nfstrace.h
+++ b/fs/nfs/nfstrace.h
@@ -707,9 +707,9 @@ TRACE_EVENT(nfs_sillyrename_unlink,
__entry->dev = dir->i_sb->s_dev;
__entry->dir = NFS_FILEID(dir);
__entry->error = error;
- memcpy(__get_dynamic_array(name),
+ memcpy(__get_str(name),
data->args.name.name, len);
- ((char *)__get_dynamic_array(name))[len] = 0;
+ __get_str(name)[len] = 0;
),
TP_printk(
diff --git a/include/trace/events/printk.h b/include/trace/events/printk.h
index c008bc9..542a755 100644
--- a/include/trace/events/printk.h
+++ b/include/trace/events/printk.h
@@ -16,8 +16,8 @@ TRACE_EVENT(console,
),
TP_fast_assign(
- memcpy(__get_dynamic_array(msg), text, len);
- ((char *)__get_dynamic_array(msg))[len] = 0;
+ memcpy(__get_str(msg), text, len);
+ __get_str(msg)[len] = 0;
),
TP_printk("%s", __get_str(msg))
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] printk, tracing: Avoiding unneeded blank lines
2016-07-01 23:44 [PATCH 0/4] tracing: printk:console fix and __get_str() cleanup Daniel Bristot de Oliveira
` (2 preceding siblings ...)
2016-07-01 23:44 ` [PATCH 3/4] tracing: Use __get_str() when manipulating strings Daniel Bristot de Oliveira
@ 2016-07-01 23:44 ` Daniel Bristot de Oliveira
2016-07-15 19:53 ` [PATCH 0/4] tracing: printk:console fix and __get_str() cleanup Daniel Bristot de Oliveira
4 siblings, 0 replies; 6+ messages in thread
From: Daniel Bristot de Oliveira @ 2016-07-01 23:44 UTC (permalink / raw)
To: linux-kernel
Cc: Steven Rostedt, Ingo Molnar, Trond Myklebust, Anna Schumaker,
linux-nfs
Printk messages often finish with '\n' to cause a new line.
But as each tracepoint is already printed in a new line,
printk messages that finish with '\n' ends up adding a blank
line to the trace output. For example:
kworker/0:1-86 [000] d... 46.006949: console: [ 46.006946] usb 1-3: USB disconnect, device number 3
kworker/2:2-374 [002] d... 48.699342: console: [ 48.699339] usb 1-3: new high-speed USB device number 4 using ehci-pci
kworker/2:2-374 [002] d... 49.041450: console: [ 49.041448] usb 1-3: New USB device found, idVendor=5986, idProduct=0
To avoid unneeded blank lines, this patch checks if the printk
message finishes with '\n', if so, it cut is off the '\n' to
avoid blank lines.
In a patched kernel, the same messages are printed without
extra blank lines. For example:
kworker/0:4-185 [000] d... 23.641738: console: [ 23.641736] usb 1-3: USB disconnect, device number 3
kworker/0:4-185 [000] d... 24.918703: console: [ 24.918700] usb 1-3: new high-speed USB device number 4 using ehci-pci
kworker/0:4-185 [000] d... 25.228308: console: [ 25.228306] usb 1-3: New USB device found, idVendor=5986, idProduct=02d5
Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: linux-kernel@vger.kernel.org
---
include/trace/events/printk.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/trace/events/printk.h b/include/trace/events/printk.h
index 542a755..bc9139d29 100644
--- a/include/trace/events/printk.h
+++ b/include/trace/events/printk.h
@@ -16,6 +16,14 @@ TRACE_EVENT(console,
),
TP_fast_assign(
+ /*
+ * Each trace entry is printed in a new line.
+ * If the msg finishes with '\n', cut it off
+ * to avoid blank lines in the trace.
+ */
+ if ((len > 0) && (text[len-1] == '\n'))
+ len -= 1;
+
memcpy(__get_str(msg), text, len);
__get_str(msg)[len] = 0;
),
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] tracing: printk:console fix and __get_str() cleanup
2016-07-01 23:44 [PATCH 0/4] tracing: printk:console fix and __get_str() cleanup Daniel Bristot de Oliveira
` (3 preceding siblings ...)
2016-07-01 23:44 ` [PATCH 4/4] printk, tracing: Avoiding unneeded blank lines Daniel Bristot de Oliveira
@ 2016-07-15 19:53 ` Daniel Bristot de Oliveira
4 siblings, 0 replies; 6+ messages in thread
From: Daniel Bristot de Oliveira @ 2016-07-15 19:53 UTC (permalink / raw)
To: linux-kernel
Cc: Steven Rostedt, Ingo Molnar, Trond Myklebust, Anna Schumaker,
linux-nfs, John Kacur
On 07/01/2016 08:44 PM, Daniel Bristot de Oliveira wrote:
> This patch series fixes a problem on printk:console tracepoint
> that prints a blank line in the trace output after each printk
> message that finishes with '\n'.
>
> It also does some cleanup on __get_str() usage, that
> was found while fixing the printk:console tracepoint.
This is just a gentle ping.
Thanks in advance!
-- Daniel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-07-15 19:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-01 23:44 [PATCH 0/4] tracing: printk:console fix and __get_str() cleanup Daniel Bristot de Oliveira
2016-07-01 23:44 ` [PATCH 1/4] tracing: Use outer () on __get_str() definition Daniel Bristot de Oliveira
2016-07-01 23:44 ` [PATCH 2/4] tracing, RAS: Cleanup on __get_str() usage Daniel Bristot de Oliveira
2016-07-01 23:44 ` [PATCH 3/4] tracing: Use __get_str() when manipulating strings Daniel Bristot de Oliveira
2016-07-01 23:44 ` [PATCH 4/4] printk, tracing: Avoiding unneeded blank lines Daniel Bristot de Oliveira
2016-07-15 19:53 ` [PATCH 0/4] tracing: printk:console fix and __get_str() cleanup Daniel Bristot de Oliveira
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).