mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung.kim@lge.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/5] tools lib traceevent: Add state member to struct trace_seq
Date: Tue, 7 Jan 2014 14:05:58 +0100	[thread overview]
Message-ID: <20140107130558.GB2919@krava.brq.redhat.com> (raw)
In-Reply-To: <1389063612-18173-3-git-send-email-namhyung@kernel.org>

On Tue, Jan 07, 2014 at 12:00:09PM +0900, Namhyung Kim wrote:

SNIP

>  void trace_seq_init(struct trace_seq *s);
> diff --git a/tools/lib/traceevent/trace-seq.c b/tools/lib/traceevent/trace-seq.c
> index d7f2e68bc5b9..1747aa50ecb0 100644
> --- a/tools/lib/traceevent/trace-seq.c
> +++ b/tools/lib/traceevent/trace-seq.c
> @@ -32,8 +32,9 @@
>  #define TRACE_SEQ_POISON	((void *)0xdeadbeef)
>  #define TRACE_SEQ_CHECK(s)						\
>  do {									\
> -	if ((s)->buffer == TRACE_SEQ_POISON)			\
> -		die("Usage of trace_seq after it was destroyed");	\
> +	if (WARN_ONCE((s)->buffer == TRACE_SEQ_POISON,			\
> +		      "Usage of trace_seq after it was destroyed"))	\
> +		(s)->state = TRACE_SEQ__BUFFER_POISONED;		\
>  } while (0)
>  
>  /**
> @@ -46,6 +47,7 @@ void trace_seq_init(struct trace_seq *s)
>  	s->readpos = 0;
>  	s->buffer_size = TRACE_SEQ_BUF_SIZE;
>  	s->buffer = malloc_or_die(s->buffer_size);
> +	s->state = TRACE_SEQ__GOOD;
>  }
>  
>  /**
> @@ -81,7 +83,7 @@ static void expand_buffer(struct trace_seq *s)
>  	s->buffer_size += TRACE_SEQ_BUF_SIZE;
>  	s->buffer = realloc(s->buffer, s->buffer_size);
>  	if (!s->buffer)
> -		die("Can't allocate trace_seq buffer memory");
> +		s->state = TRACE_SEQ__MEM_ALLOC_FAILED;

and also here?

	if (WARN_ONCE(!s->buffer))
		s->state = TRACE_SEQ__MEM_ALLOC_FAILED;

otherwise the whole series seems ok,
jirka

  reply	other threads:[~2014-01-07 13:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-07  3:00 [PATCHSET 0/5] tools lib traceevent: Get rid of *die() calls finally!! (v2) Namhyung Kim
2014-01-07  3:00 ` [PATCH 1/5] tools lib traceevent: Add WARN and WARN_ONCE macros Namhyung Kim
2014-01-07 14:07   ` Arnaldo Carvalho de Melo
2014-01-08  7:38     ` Namhyung Kim
2014-01-07  3:00 ` [PATCH 2/5] tools lib traceevent: Add state member to struct trace_seq Namhyung Kim
2014-01-07 13:05   ` Jiri Olsa [this message]
2014-01-08  4:06     ` Namhyung Kim
2014-01-07  3:00 ` [PATCH 3/5] tools lib traceevent: Check return value of realloc() Namhyung Kim
2014-01-07  3:00 ` [PATCH 4/5] tools lib traceevent: Get rid of malloc_or_die() in trace_seq_init() Namhyung Kim
2014-01-07  3:00 ` [PATCH 5/5] tools lib traceevent: Get rid of die() finally!! Namhyung Kim
2014-01-07  3:25   ` Steven Rostedt

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=20140107130558.GB2919@krava.brq.redhat.com \
    --to=jolsa@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=namhyung@kernel.org \
    --cc=rostedt@goodmis.org \
    /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

all inboxes | Powered by JetHome®