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:	Wed, 20 Apr 2016 09:46:10 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	Wang Nan <wangnan0@...wei.com>
Cc:	acme@...nel.org, linux-kernel@...r.kernel.org, pi3orama@....com,
	Adrian Hunter <adrian.hunter@...el.com>,
	He Kuang <hekuang@...wei.com>, Jiri Olsa <jolsa@...nel.org>,
	Masami Hiramatsu <mhiramat@...nel.org>,
	Namhyung Kim <namhyung@...nel.org>,
	Zefan Li <lizefan@...wei.com>
Subject: Re: [PATCH v5 1/6] perf tools: Derive trigger class from
 auxtrace_snapshot

On Mon, Apr 18, 2016 at 02:55:27PM +0000, Wang Nan wrote:

SNIP

> -static volatile int auxtrace_snapshot_err;
>  static volatile int auxtrace_record__snapshot_started;
> +static DEFINE_TRIGGER(auxtrace_snapshot);
>  
>  static void sig_handler(int sig)
>  {
> @@ -282,11 +247,12 @@ static void record__read_auxtrace_snapshot(struct record *rec)
>  {
>  	pr_debug("Recording AUX area tracing snapshot\n");
>  	if (record__auxtrace_read_snapshot_all(rec) < 0) {
> -		auxtrace_snapshot_err = -1;
> +		auxtrace_snapshot_error();
>  	} else {
> -		auxtrace_snapshot_err = auxtrace_record__snapshot_finish(rec->itr);
> -		if (!auxtrace_snapshot_err)
> -			auxtrace_snapshot_enable();
> +		if (auxtrace_record__snapshot_finish(rec->itr))
> +			auxtrace_snapshot_error();
> +		else
> +			auxtrace_snapshot_ready();
>  	}
>  }
>  
> @@ -815,21 +781,21 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
>  		perf_evlist__enable(rec->evlist);
>  	}
>  
> -	auxtrace_snapshot_enable();
> +	auxtrace_snapshot_ready();
>  	for (;;) {
>  		unsigned long long hits = rec->samples;
>  
>  		if (record__mmap_read_all(rec) < 0) {
> -			auxtrace_snapshot_disable();
> +			auxtrace_snapshot_error();
>  			err = -1;
>  			goto out_child;
>  		}
>  
>  		if (auxtrace_record__snapshot_started) {
>  			auxtrace_record__snapshot_started = 0;

I'm ok with the chenge, however what I wanted to understand
is why we need auxtrace_record__snapshot_started ;-)

could we get rid of it like in the patch below?

thanks,
jirka


---
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index ad37f6937410..e220bd5eea0e 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -128,7 +128,6 @@ static volatile int done;
 static volatile int signr = -1;
 static volatile int child_finished;
 
-static volatile int auxtrace_record__snapshot_started;
 static DEFINE_TRIGGER(auxtrace_snapshot);
 
 static void sig_handler(int sig)
@@ -791,8 +790,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 			goto out_child;
 		}
 
-		if (auxtrace_record__snapshot_started) {
-			auxtrace_record__snapshot_started = 0;
+		if (auxtrace_snapshot_is_toggled()) {
 			if (!auxtrace_snapshot_is_error())
 				record__read_auxtrace_snapshot(rec);
 			if (auxtrace_snapshot_is_error()) {
@@ -1416,7 +1414,6 @@ static void snapshot_sig_handler(int sig __maybe_unused)
 	if (!auxtrace_snapshot_is_ready())
 		return;
 	auxtrace_snapshot_toggle();
-	auxtrace_record__snapshot_started = 1;
 	if (auxtrace_record__snapshot_start(record.itr))
 		auxtrace_snapshot_error();
 }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ