linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] tracing: kmem: convert call_site addresses to user friendly symbols
@ 2019-07-22 21:42 George G. Davis
  2019-07-24 20:12 ` Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: George G. Davis @ 2019-07-22 21:42 UTC (permalink / raw)
  To: Steven Rostedt, Ingo Molnar, George G. Davis, open list

While attempting to debug slub freelist pointer corruption bugs
caused by a module, I discovered that the kmem call_site addresses are
not at all user friendly for modules unless you manage to save a copy
of kallsyms for the running kernel beforehand.

So convert kmem call_site addresses to user friendly symbols which is
especially helpful for module callers when you don't have a copy of
kallsyms for the running kernel.

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: George G. Davis <george_davis@mentor.com>
---
Change history:
v1:
- First submission
v2:
- Fix kbuild test robot issues as suggested by
  Steven Rostedt.
---
 include/trace/events/kmem.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index eb57e3037deb..09e1eeb4e44d 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -35,8 +35,8 @@ DECLARE_EVENT_CLASS(kmem_alloc,
 		__entry->gfp_flags	= gfp_flags;
 	),
 
-	TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s",
-		__entry->call_site,
+	TP_printk("call_site=%pS ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s",
+		(void *)__entry->call_site,
 		__entry->ptr,
 		__entry->bytes_req,
 		__entry->bytes_alloc,
@@ -88,8 +88,8 @@ DECLARE_EVENT_CLASS(kmem_alloc_node,
 		__entry->node		= node;
 	),
 
-	TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d",
-		__entry->call_site,
+	TP_printk("call_site=%pS ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d",
+		(void *)__entry->call_site,
 		__entry->ptr,
 		__entry->bytes_req,
 		__entry->bytes_alloc,
@@ -131,7 +131,8 @@ DECLARE_EVENT_CLASS(kmem_free,
 		__entry->ptr		= ptr;
 	),
 
-	TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr)
+	TP_printk("call_site=%pS ptr=%p",
+		(void *)__entry->call_site, __entry->ptr)
 );
 
 DEFINE_EVENT(kmem_free, kfree,
-- 
2.7.4


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

* Re: [PATCH v2] tracing: kmem: convert call_site addresses to user friendly symbols
  2019-07-22 21:42 [PATCH v2] tracing: kmem: convert call_site addresses to user friendly symbols George G. Davis
@ 2019-07-24 20:12 ` Steven Rostedt
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2019-07-24 20:12 UTC (permalink / raw)
  To: George G. Davis; +Cc: Ingo Molnar, open list, linux-mm, Andrew Morton


Hmm, get_maintainers.pl fails to get the people I think should be
maintaining include/trace/events/kmem.h. 

On Mon, 22 Jul 2019 17:42:59 -0400
"George G. Davis" <george_davis@mentor.com> wrote:

> While attempting to debug slub freelist pointer corruption bugs
> caused by a module, I discovered that the kmem call_site addresses are
> not at all user friendly for modules unless you manage to save a copy
> of kallsyms for the running kernel beforehand.
> 
> So convert kmem call_site addresses to user friendly symbols which is
> especially helpful for module callers when you don't have a copy of
> kallsyms for the running kernel.
> 
> Reported-by: kbuild test robot <lkp@intel.com>
> Signed-off-by: George G. Davis <george_davis@mentor.com>

Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

I can take this if nobody else does.

-- Steve


> ---
> Change history:
> v1:
> - First submission
> v2:
> - Fix kbuild test robot issues as suggested by
>   Steven Rostedt.
> ---
>  include/trace/events/kmem.h | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
> index eb57e3037deb..09e1eeb4e44d 100644
> --- a/include/trace/events/kmem.h
> +++ b/include/trace/events/kmem.h
> @@ -35,8 +35,8 @@ DECLARE_EVENT_CLASS(kmem_alloc,
>  		__entry->gfp_flags	= gfp_flags;
>  	),
>  
> -	TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s",
> -		__entry->call_site,
> +	TP_printk("call_site=%pS ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s",
> +		(void *)__entry->call_site,
>  		__entry->ptr,
>  		__entry->bytes_req,
>  		__entry->bytes_alloc,
> @@ -88,8 +88,8 @@ DECLARE_EVENT_CLASS(kmem_alloc_node,
>  		__entry->node		= node;
>  	),
>  
> -	TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d",
> -		__entry->call_site,
> +	TP_printk("call_site=%pS ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d",
> +		(void *)__entry->call_site,
>  		__entry->ptr,
>  		__entry->bytes_req,
>  		__entry->bytes_alloc,
> @@ -131,7 +131,8 @@ DECLARE_EVENT_CLASS(kmem_free,
>  		__entry->ptr		= ptr;
>  	),
>  
> -	TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr)
> +	TP_printk("call_site=%pS ptr=%p",
> +		(void *)__entry->call_site, __entry->ptr)
>  );
>  
>  DEFINE_EVENT(kmem_free, kfree,


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

end of thread, other threads:[~2019-07-24 20:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-22 21:42 [PATCH v2] tracing: kmem: convert call_site addresses to user friendly symbols George G. Davis
2019-07-24 20:12 ` Steven Rostedt

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).