linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Nazarewicz <mina86@mina86.com>
To: Stefan Strogin <s.strogin@partner.samsung.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	aneesh.kumar@linux.vnet.ibm.com,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Dmitry Safonov <d.safonov@partner.samsung.com>,
	Pintu Kumar <pintu.k@samsung.com>,
	Weijie Yang <weijie.yang@samsung.com>,
	Laura Abbott <lauraa@codeaurora.org>,
	SeongJae Park <sj38.park@gmail.com>, Hui Zhu <zhuhui@xiaomi.com>,
	Minchan Kim <minchan@kernel.org>,
	Dyasly Sergey <s.dyasly@samsung.com>,
	Vyacheslav Tyrtov <v.tyrtov@samsung.com>,
	Aleksei Mateosian <a.mateosian@samsung.com>,
	gregory.0xf0@gmail.com, sasha.levin@oracle.com, gioh.kim@lge.com,
	pavel@ucw.cz, stefan.strogin@gmail.com
Subject: Re: [PATCH v4 3/5] stacktrace: add seq_print_stack_trace()
Date: Mon, 16 Mar 2015 18:33:50 +0100	[thread overview]
Message-ID: <xa1toansoni9.fsf@mina86.com> (raw)
In-Reply-To: <19b2815dbb60bfd38d17596a3d466637ee44c9a5.1426521377.git.s.strogin@partner.samsung.com>

On Mon, Mar 16 2015, Stefan Strogin wrote:
> Add a function seq_print_stack_trace() which prints stacktraces to seq_files.
>
> Signed-off-by: Stefan Strogin <stefan.strogin@gmail.com>
> Reviewed-by: SeongJae Park <sj38.park@gmail.com>

Acked-by: Michal Nazarewicz <mina86@mina86.com>

> ---
>  include/linux/stacktrace.h |  4 ++++
>  kernel/stacktrace.c        | 17 +++++++++++++++++
>  2 files changed, 21 insertions(+)
>
> diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
> index 0a34489..d80f2e9 100644
> --- a/include/linux/stacktrace.h
> +++ b/include/linux/stacktrace.h
> @@ -2,6 +2,7 @@
>  #define __LINUX_STACKTRACE_H
>  
>  #include <linux/types.h>
> +#include <linux/seq_file.h>
>  
>  struct task_struct;
>  struct pt_regs;
> @@ -22,6 +23,8 @@ extern void save_stack_trace_tsk(struct task_struct *tsk,
>  extern void print_stack_trace(struct stack_trace *trace, int spaces);
>  extern int snprint_stack_trace(char *buf, size_t size,
>  			struct stack_trace *trace, int spaces);
> +extern void seq_print_stack_trace(struct seq_file *m,
> +			struct stack_trace *trace, int spaces);
>  
>  #ifdef CONFIG_USER_STACKTRACE_SUPPORT
>  extern void save_stack_trace_user(struct stack_trace *trace);
> @@ -35,6 +38,7 @@ extern void save_stack_trace_user(struct stack_trace *trace);
>  # define save_stack_trace_user(trace)			do { } while (0)
>  # define print_stack_trace(trace, spaces)		do { } while (0)
>  # define snprint_stack_trace(buf, size, trace, spaces)	do { } while (0)
> +# define seq_print_stack_trace(m, trace, spaces)	do { } while (0)
>  #endif
>  
>  #endif
> diff --git a/kernel/stacktrace.c b/kernel/stacktrace.c
> index b6e4c16..66ef6f4 100644
> --- a/kernel/stacktrace.c
> +++ b/kernel/stacktrace.c
> @@ -57,6 +57,23 @@ int snprint_stack_trace(char *buf, size_t size,
>  }
>  EXPORT_SYMBOL_GPL(snprint_stack_trace);
>  
> +void seq_print_stack_trace(struct seq_file *m, struct stack_trace *trace,
> +			int spaces)
> +{
> +	int i;
> +
> +	if (WARN_ON(!trace->entries))
> +		return;
> +
> +	for (i = 0; i < trace->nr_entries; i++) {
> +		unsigned long ip = trace->entries[i];
> +
> +		seq_printf(m, "%*c[<%p>] %pS\n", 1 + spaces, ' ',
> +				(void *) ip, (void *) ip);
> +	}
> +}
> +EXPORT_SYMBOL_GPL(seq_print_stack_trace);
> +
>  /*
>   * Architectures that do not implement save_stack_trace_tsk or
>   * save_stack_trace_regs get this weak alias and a once-per-bootup warning
> -- 
> 2.1.0
>

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +--<mpn@google.com>--<xmpp:mina86@jabber.org>--ooO--(_)--Ooo--

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2015-03-16 17:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-16 16:06 [PATCH v4 0/5] mm: cma: add some debug information for CMA Stefan Strogin
2015-03-16 16:06 ` [PATCH v4 1/5] mm: cma: add trace events to debug physically-contiguous memory allocations Stefan Strogin
2015-03-16 20:49   ` Stefan Strogin
2015-03-16 23:47     ` Steven Rostedt
2015-03-19 20:18       ` Stefan Strogin
2015-03-19 20:34         ` Steven Rostedt
2015-03-20 10:46           ` Stefan Strogin
2015-03-20 14:31             ` Steven Rostedt
2015-03-17  7:40     ` Ingo Molnar
2015-03-19 20:22       ` Stefan Strogin
2015-03-23 14:04         ` Ingo Molnar
2015-03-16 16:06 ` [PATCH v4 2/5] mm: cma: add number of pages to debug message in cma_release() Stefan Strogin
2015-03-16 16:06 ` [PATCH v4 3/5] stacktrace: add seq_print_stack_trace() Stefan Strogin
2015-03-16 17:33   ` Michal Nazarewicz [this message]
2015-03-16 16:06 ` [PATCH v4 4/5] mm: cma: add list of currently allocated CMA buffers to debugfs Stefan Strogin
2015-03-16 17:51   ` Michal Nazarewicz
2015-03-16 16:09 ` [PATCH v4 5/5] mm: cma: add functions to get region pages counters Stefan Strogin
2015-03-17  1:43 ` [PATCH v4 0/5] mm: cma: add some debug information for CMA Joonsoo Kim
2015-03-17  1:54   ` Sasha Levin
2015-03-17  2:04     ` Joonsoo Kim

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=xa1toansoni9.fsf@mina86.com \
    --to=mina86@mina86.com \
    --cc=a.mateosian@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=d.safonov@partner.samsung.com \
    --cc=gioh.kim@lge.com \
    --cc=gregory.0xf0@gmail.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=lauraa@codeaurora.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=m.szyprowski@samsung.com \
    --cc=minchan@kernel.org \
    --cc=pavel@ucw.cz \
    --cc=pintu.k@samsung.com \
    --cc=s.dyasly@samsung.com \
    --cc=s.strogin@partner.samsung.com \
    --cc=sasha.levin@oracle.com \
    --cc=sj38.park@gmail.com \
    --cc=stefan.strogin@gmail.com \
    --cc=v.tyrtov@samsung.com \
    --cc=weijie.yang@samsung.com \
    --cc=zhuhui@xiaomi.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