lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160413152417.GF9056@kernel.org>
Date:	Wed, 13 Apr 2016 12:24:17 -0300
From:	Arnaldo Carvalho de Melo <acme@...nel.org>
To:	Wang Nan <wangnan0@...wei.com>
Cc:	linux-kernel@...r.kernel.org, pi3orama@....com,
	He Kuang <hekuang@...wei.com>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Jiri Olsa <jolsa@...nel.org>,
	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
	Namhyung Kim <namhyung@...nel.org>,
	Zefan Li <lizefan@...wei.com>
Subject: Re: [PATCH 01/10] perf tools: Make ordered_events reusable

Em Wed, Apr 13, 2016 at 08:21:04AM +0000, Wang Nan escreveu:
> ordered_events__free() leaves linked lists and timestamps not cleared,
> so unable to be reused after ordered_events__free(). Which is inconvenient
> after 'perf record' supports generating multiple perf.data output and
> process build-ids for each of them.
> 
> Introduce ordered_events__reinit() for this.

Thanks for following Jiri's suggestion, I agreed with him, clearer now.

Please next time add a:

v2: Introduce reinit(), as per suggestion from Jiri Olsa.

So that credit is given and, more importantly for me, my need to go look
at previous versions of this patch for which I think I have read some
comment about it gets reduced 8-)

- Arnaldo
 
> Signed-off-by: Wang Nan <wangnan0@...wei.com>
> Signed-off-by: He Kuang <hekuang@...wei.com>
> Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
> Cc: Jiri Olsa <jolsa@...nel.org>
> Cc: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
> Cc: Namhyung Kim <namhyung@...nel.org>
> Cc: Zefan Li <lizefan@...wei.com>
> Cc: pi3orama@....com
> ---
>  tools/perf/util/ordered-events.c | 9 +++++++++
>  tools/perf/util/ordered-events.h | 1 +
>  tools/perf/util/session.c        | 6 +++++-
>  3 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/ordered-events.c b/tools/perf/util/ordered-events.c
> index b1b9e23..fe84df1 100644
> --- a/tools/perf/util/ordered-events.c
> +++ b/tools/perf/util/ordered-events.c
> @@ -308,3 +308,12 @@ void ordered_events__free(struct ordered_events *oe)
>  		free(event);
>  	}
>  }
> +
> +void ordered_events__reinit(struct ordered_events *oe)
> +{
> +	ordered_events__deliver_t old_deliver = oe->deliver;
> +
> +	ordered_events__free(oe);
> +	memset(oe, '\0', sizeof(*oe));
> +	ordered_events__init(oe, old_deliver);
> +}
> diff --git a/tools/perf/util/ordered-events.h b/tools/perf/util/ordered-events.h
> index f403991..e11468a 100644
> --- a/tools/perf/util/ordered-events.h
> +++ b/tools/perf/util/ordered-events.h
> @@ -49,6 +49,7 @@ void ordered_events__delete(struct ordered_events *oe, struct ordered_event *eve
>  int ordered_events__flush(struct ordered_events *oe, enum oe_flush how);
>  void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t deliver);
>  void ordered_events__free(struct ordered_events *oe);
> +void ordered_events__reinit(struct ordered_events *oe);
>  
>  static inline
>  void ordered_events__set_alloc_size(struct ordered_events *oe, u64 size)
> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
> index 91d4528..ca1827c 100644
> --- a/tools/perf/util/session.c
> +++ b/tools/perf/util/session.c
> @@ -1836,7 +1836,11 @@ out:
>  out_err:
>  	ui_progress__finish();
>  	perf_session__warn_about_errors(session);
> -	ordered_events__free(&session->ordered_events);
> +	/*
> +	 * We may switching perf.data output, make ordered_events
> +	 * reusable.
> +	 */
> +	ordered_events__reinit(&session->ordered_events);
>  	auxtrace__free_events(session);
>  	session->one_mmap = false;
>  	return err;
> -- 
> 1.8.3.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ