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]
Date:   Tue, 16 Apr 2019 20:41:01 +0000
From:   Song Liu <songliubraving@...com>
To:     Jiri Olsa <jolsa@...nel.org>
CC:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        lkml <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Andi Kleen <ak@...ux.intel.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Alexei Starovoitov <ast@...nel.org>,
        "Daniel Borkmann" <daniel@...earbox.net>
Subject: Re: [PATCH 08/12] perf tools: Fix side band thread draining



> On Apr 16, 2019, at 9:01 AM, Jiri Olsa <jolsa@...nel.org> wrote:
> 
> Current perf_evlist__poll_thread code could finish
> without draining the data. Adding the logic that
> makes sure we won't finish before the drain.
> 
> Fixes: 657ee5531903 ("perf evlist: Introduce side band thread")
> Link: http://lkml.kernel.org/n/tip-41i888xyim9n5ceyr44jb468@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@...nel.org>

Thanks for the fix!

Acked-by: Song Liu <songliubraving@...com>

> ---
> tools/perf/util/evlist.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index f2bbae38278d..4b6783ff5813 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -1868,12 +1868,12 @@ static void *perf_evlist__poll_thread(void *arg)
> {
> 	struct perf_evlist *evlist = arg;
> 	bool draining = false;
> -	int i;
> +	int i, done = 0;
> +
> +	while (!done) {
> +		bool got_data = false;
> 
> -	while (draining || !(evlist->thread.done)) {
> -		if (draining)
> -			draining = false;
> -		else if (evlist->thread.done)
> +		if (evlist->thread.done)
> 			draining = true;
> 
> 		if (!draining)
> @@ -1894,9 +1894,13 @@ static void *perf_evlist__poll_thread(void *arg)
> 					pr_warning("cannot locate proper evsel for the side band event\n");
> 
> 				perf_mmap__consume(map);
> +				got_data = true;
> 			}
> 			perf_mmap__read_done(map);
> 		}
> +
> +		if (draining && !got_data)
> +			break;
> 	}
> 	return NULL;
> }
> -- 
> 2.17.2
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ