From: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
To: Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@redhat.com>, Laura Abbott <labbott@redhat.com>,
Kees Cook <keescook@chromium.org>,
Anton Vorontsov <anton@enomsg.org>,
Rob Herring <robh+dt@kernel.org>,
devicetree@vger.kernel.org, Colin Cross <ccross@android.com>,
Jason Baron <jbaron@akamai.com>, Tony Luck <tony.luck@intel.com>,
Arnd Bergmann <arnd@arndb.de>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
Joel Fernandes <joel@joelfernandes.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Joe Perches <joe@perches.com>, Jim Cromie <jim.cromie@gmail.com>
Cc: Rajendra Nayak <rnayak@codeaurora.org>,
Vivek Gautam <vivek.gautam@codeaurora.org>,
Sibi Sankar <sibis@codeaurora.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Ingo Molnar <mingo@kernel.org>,
Tom Zanussi <tom.zanussi@linux.intel.com>,
Prasad Sodagudi <psodagud@codeaurora.org>,
tsoni@codeaurora.org, Bryan Huntsman <bryanh@codeaurora.org>,
Tingwei Zhang <tingwei@codeaurora.org>,
Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
Subject: [PATCH 6/6] dynamic_debug: Add flag for dynamic event tracing
Date: Sun, 9 Sep 2018 01:57:07 +0530 [thread overview]
Message-ID: <3f0166ff19ae44dbf92cbb239ebf25fa8a4f243c.1536430404.git.saiprakash.ranjan@codeaurora.org> (raw)
In-Reply-To: <cover.1536430404.git.saiprakash.ranjan@codeaurora.org>
Debugging a specific driver or subsystem can be a lot easier
if we can trace events specific to that driver or subsystem.
This type of filtering can be achieved using existing
dynamic debug library which provides a way to filter based
on files, functions and modules.
Using this, provide an additional flag 'e' to filter event
tracing to specified input.
For example, tracing all IO read/write can be overwhelming
and of no use when debugging a specific driver or a subsystem.
So switch to dynamic event tracing for register accesses.
Example for tracing register accesses in drivers/soc/qcom/*
and the pstore output is given below:
# dyndbg="file drivers/soc/qcom/* +e" trace_event=io tp_pstore
# reboot -f
# mount -t pstore pstore /sys/fs/pstore
# cat /sys/fs/pstore/event-ramoops-0
io_write: type=writel cpu=1 ts:1423596253 data=0xffff00000d2065a4 caller=qcom_smsm_probe+0x524/0x670
io_write: type=writel cpu=1 ts:1423945889 data=0xffff00000d206608 caller=qcom_smsm_probe+0x524/0x670
Note: Tracing is activated only when flag is enabled either
through command line or through dynamic debug control file.
Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
---
include/asm-generic/io-instrumented.h | 28 +++++++++++++++++++++++++--
include/linux/dynamic_debug.h | 1 +
lib/dynamic_debug.c | 1 +
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/include/asm-generic/io-instrumented.h b/include/asm-generic/io-instrumented.h
index 7b050e2487ed..023f28571ea3 100644
--- a/include/asm-generic/io-instrumented.h
+++ b/include/asm-generic/io-instrumented.h
@@ -2,6 +2,8 @@
#ifndef _ASM_GENERIC_IO_INSTRUMENTED_H
#define _ASM_GENERIC_IO_INSTRUMENTED_H
+#include <linux/dynamic_debug.h>
+
#if defined(CONFIG_TRACING_EVENTS_IO)
#include <linux/tracepoint-defs.h>
@@ -19,7 +21,7 @@ static inline void do_trace_io_read(const char *type, void *addr) {}
#define __raw_write(v, a, _l) ({ \
volatile void __iomem *_a = (a); \
if (io_tracepoint_active(__tracepoint_io_write)) \
- do_trace_io_write(__stringify(write##_l), (void __force *)(_a));\
+ dynamic_io_write(__stringify(write##_l), (void __force *)(_a)); \
arch_raw_write##_l((v), _a); \
})
@@ -32,7 +34,7 @@ static inline void do_trace_io_read(const char *type, void *addr) {}
_t __a; \
const volatile void __iomem *_a = (a); \
if (io_tracepoint_active(__tracepoint_io_read)) \
- do_trace_io_read(__stringify(read##_l), (void __force *)(_a)); \
+ dynamic_io_read(__stringify(read##_l), (void __force *)(_a)); \
__a = arch_raw_read##_l(_a); \
__a; \
})
@@ -42,4 +44,26 @@ static inline void do_trace_io_read(const char *type, void *addr) {}
#define __raw_readl(a) __raw_read((a), l, u32)
#define __raw_readq(a) __raw_read((a), q, u64)
+#if defined(CONFIG_DYNAMIC_DEBUG) && defined(CONFIG_TRACING_EVENTS_IO)
+#define dynamic_io_write(type, addr) \
+do { \
+ DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, type); \
+ if (unlikely(descriptor.flags & _DPRINTK_FLAGS_EVENT)) \
+ do_trace_io_write(type, addr); \
+} while (0)
+
+#define dynamic_io_read(type, addr) \
+do { \
+ DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, type); \
+ if (unlikely(descriptor.flags & _DPRINTK_FLAGS_EVENT)) \
+ do_trace_io_read(type, addr); \
+} while (0)
+#elif defined(CONFIG_TRACING_EVENTS_IO)
+#define dynamic_io_write(type, addr) do_trace_io_write(type, addr)
+#define dynamic_io_read(type, addr) do_trace_io_read(type, addr)
+#else
+#define dynamic_io_write(type, addr)
+#define dynamic_io_read(type, addr)
+#endif /* CONFIG_DYNAMIC_DEBUG && CONFIG_TRACING_EVENTS_IO */
+
#endif /* _ASM_GENERIC_IO_INSTRUMENTED_H */
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 2fd8006153c3..14e595c51002 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -32,6 +32,7 @@ struct _ddebug {
#define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2)
#define _DPRINTK_FLAGS_INCL_LINENO (1<<3)
#define _DPRINTK_FLAGS_INCL_TID (1<<4)
+#define _DPRINTK_FLAGS_EVENT (1<<5)
#if defined DEBUG
#define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT
#else
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index c7c96bc7654a..694957a8ae54 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -78,6 +78,7 @@ static inline const char *trim_prefix(const char *path)
static struct { unsigned flag:8; char opt_char; } opt_array[] = {
{ _DPRINTK_FLAGS_PRINT, 'p' },
+ { _DPRINTK_FLAGS_EVENT, 'e' },
{ _DPRINTK_FLAGS_INCL_MODNAME, 'm' },
{ _DPRINTK_FLAGS_INCL_FUNCNAME, 'f' },
{ _DPRINTK_FLAGS_INCL_LINENO, 'l' },
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
next prev parent reply other threads:[~2018-09-08 20:29 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-08 20:27 [PATCH 0/6] Tracing register accesses with pstore and dynamic debug Sai Prakash Ranjan
2018-09-08 20:27 ` [PATCH 1/6] dt-bindings: ramoops: Add event-size property Sai Prakash Ranjan
[not found] ` <5b9f3f67.1c69fb81.3125b.c205@mx.google.com>
2018-09-17 17:15 ` Sai Prakash Ranjan
2018-09-08 20:27 ` [PATCH 2/6] pstore: Add event tracing support Sai Prakash Ranjan
2018-09-11 10:46 ` Sai Prakash Ranjan
2018-09-17 17:38 ` Stephen Boyd
2018-09-17 19:43 ` Sai Prakash Ranjan
2018-09-16 7:07 ` Sai Prakash Ranjan
[not found] ` <CAEXW_YSPNqVgoYWjVAMvGg_WoRV4SC2xDH1wQWTdQfBUOMQbbQ@mail.gmail.com>
2018-09-17 14:54 ` Kees Cook
2018-09-17 17:17 ` Sai Prakash Ranjan
2018-09-17 17:13 ` Sai Prakash Ranjan
2018-09-17 23:04 ` Steven Rostedt
2018-09-18 6:24 ` Sai Prakash Ranjan
2018-09-17 23:34 ` Steven Rostedt
2018-09-18 17:52 ` Sai Prakash Ranjan
2018-09-18 20:44 ` Steven Rostedt
2018-09-18 21:13 ` Sai Prakash Ranjan
2018-09-22 6:48 ` Sai Prakash Ranjan
2018-09-22 9:05 ` Joel Fernandes
2018-09-22 16:37 ` Sai Prakash Ranjan
2018-09-22 17:32 ` Sai Prakash Ranjan
2018-09-22 17:45 ` Sai Prakash Ranjan
2018-09-23 15:33 ` Sai Prakash Ranjan
2018-09-25 20:37 ` Joel Fernandes
2018-09-25 20:39 ` Joel Fernandes
2018-09-25 20:40 ` Joel Fernandes
2018-09-26 9:52 ` Sai Prakash Ranjan
2018-09-08 20:27 ` [PATCH 3/6] tracing: Add tp_pstore cmdline to have tracepoints go to pstore Sai Prakash Ranjan
2018-09-25 21:25 ` Joel Fernandes
2018-09-26 9:46 ` Sai Prakash Ranjan
2018-10-08 14:16 ` Sai Prakash Ranjan
2018-10-08 14:36 ` Steven Rostedt
2018-10-08 22:40 ` Joel Fernandes
2018-10-09 18:22 ` Sai Prakash Ranjan
2018-10-10 19:37 ` Steven Rostedt
2018-09-08 20:27 ` [PATCH 4/6] arm64/io: Add tracepoint for register accesses Sai Prakash Ranjan
2018-09-08 20:27 ` [PATCH 5/6] arm64/io: Add header for instrumentation of io operations Sai Prakash Ranjan
2018-09-17 23:39 ` Steven Rostedt
2018-09-18 7:10 ` Sai Prakash Ranjan
2018-09-18 11:47 ` Will Deacon
2018-09-18 12:43 ` Sai Prakash Ranjan
2018-09-08 20:27 ` Sai Prakash Ranjan [this message]
2018-09-11 15:11 ` [PATCH 0/6] Tracing register accesses with pstore and dynamic debug Will Deacon
2018-09-11 16:11 ` Sai Prakash Ranjan
2018-10-20 5:25 ` Joel Fernandes
2018-10-20 6:32 ` Sai Prakash Ranjan
2018-10-20 16:27 ` Joel Fernandes
2018-10-21 3:46 ` Sai Prakash Ranjan
2018-10-21 4:59 ` Sai Prakash Ranjan
2018-10-21 5:09 ` Joel Fernandes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3f0166ff19ae44dbf92cbb239ebf25fa8a4f243c.1536430404.git.saiprakash.ranjan@codeaurora.org \
--to=saiprakash.ranjan@codeaurora.org \
--cc=anton@enomsg.org \
--cc=arnd@arndb.de \
--cc=bryanh@codeaurora.org \
--cc=catalin.marinas@arm.com \
--cc=ccross@android.com \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jbaron@akamai.com \
--cc=jim.cromie@gmail.com \
--cc=joe@perches.com \
--cc=joel@joelfernandes.org \
--cc=keescook@chromium.org \
--cc=labbott@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=psodagud@codeaurora.org \
--cc=rnayak@codeaurora.org \
--cc=robh+dt@kernel.org \
--cc=rostedt@goodmis.org \
--cc=sibis@codeaurora.org \
--cc=tingwei@codeaurora.org \
--cc=tom.zanussi@linux.intel.com \
--cc=tony.luck@intel.com \
--cc=tsoni@codeaurora.org \
--cc=vivek.gautam@codeaurora.org \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome