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: <20200127123108.GC1114818@krava>
Date:   Mon, 27 Jan 2020 13:31:08 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     James Clark <james.clark@....com>
Cc:     linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        suzuki.poulose@....com, gengdongjiu@...wei.com,
        wxf.wang@...ilicon.com, liwei391@...wei.com,
        liuqi115@...ilicon.com, huawei.libin@...wei.com, nd@....com,
        linux-perf-users@...r.kernel.org, Will Deacon <will@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Tan Xiaojun <tanxiaojun@...wei.com>,
        Al Grant <al.grant@....com>, Namhyung Kim <namhyung@...nel.org>
Subject: Re: [PATCH v2 5/7] perf tools: add perf_evlist__terminate() for
 terminate

On Thu, Jan 23, 2020 at 04:07:32PM +0000, James Clark wrote:
> From: Wei Li <liwei391@...wei.com>
> 
> In __cmd_record(), when receiving SIGINT(ctrl + c), a done flag will
> be set and the event list will be disabled by perf_evlist__disable()
> once.
> 
> While in auxtrace_record.read_finish(), the related events will be
> enabled again, if they are continuous, the recording seems to be endless.
> 
> Mark the evlist's state as terminated, preparing for the following fix.
> 
> Signed-off-by: Wei Li <liwei391@...wei.com>
> Tested-by: Qi Liu <liuqi115@...ilicon.com>
> Signed-off-by: James Clark <james.clark@....com>
> Cc: Will Deacon <will@...nel.org>
> Cc: Mark Rutland <mark.rutland@....com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Arnaldo Carvalho de Melo <acme@...nel.org>
> Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
> Cc: Jiri Olsa <jolsa@...hat.com>
> Cc: Tan Xiaojun <tanxiaojun@...wei.com>
> Cc: Al Grant <al.grant@....com>
> Cc: Namhyung Kim <namhyung@...nel.org>
> ---
>  tools/perf/builtin-record.c |  1 +
>  tools/perf/util/evlist.c    | 14 ++++++++++++++
>  tools/perf/util/evlist.h    |  1 +
>  tools/perf/util/evsel.h     |  1 +
>  4 files changed, 17 insertions(+)
> 
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index 4c301466101b..e7c917f9534d 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -1722,6 +1722,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
>  		if (done && !disabled && !target__none(&opts->target)) {
>  			trigger_off(&auxtrace_snapshot_trigger);
>  			evlist__disable(rec->evlist);
> +			evlist__terminate(rec->evlist);
>  			disabled = true;
>  		}
>  	}
> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index b9c7e5271611..b04794cd8586 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -377,6 +377,20 @@ bool evsel__cpu_iter_skip(struct evsel *ev, int cpu)
>  	return true;
>  }
>  
> +void evlist__terminate(struct evlist *evlist)
> +{
> +	struct evsel *pos;
> +
> +	evlist__for_each_entry(evlist, pos) {
> +		if (pos->disabled || !perf_evsel__is_group_leader(pos) || !pos->core.fd)
> +			continue;
> +		evsel__disable(pos);
> +		pos->terminated = true;
> +	}

how is this different from evlist__disable? other than it does not
follow the cpu affinity ;-) can't you just call evlist__disable and
check later on evlist->enabled instead of evlist->terminated?

jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ