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:   Fri, 14 Oct 2022 17:04:38 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Namhyung Kim <namhyung@...nel.org>
Cc:     Jiri Olsa <jolsa@...nel.org>, Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Ian Rogers <irogers@...gle.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        linux-perf-users@...r.kernel.org,
        Kan Liang <kan.liang@...ux.intel.com>,
        Leo Yan <leo.yan@...aro.org>, Andi Kleen <ak@...ux.intel.com>,
        Athira Rajeev <atrajeev@...ux.vnet.ibm.com>,
        James Clark <james.clark@....com>,
        Xing Zhengjun <zhengjun.xing@...ux.intel.com>
Subject: Re: [PATCH 20/19] perf stat: Factor out evsel__count_has_error()

Em Fri, Oct 14, 2022 at 11:16:55AM -0700, Namhyung Kim escreveu:
> It's possible to have 0 enabled/running time for some per-task or per-cgroup
> events since it's not scheduled on any CPU.  Treating the whole event as
> failed would not work in this case.  Thinking again, the code only existed
> when any CPU-level aggregation is enabled (like per-socket, per-core, ...).
> 
> To make it clearer, factor out the condition check into the new
> evsel__count_has_error() function and add some comments.

So I should just add this one to the 19-long patchkit I already applied
locally, ok.

- Arnaldo
 
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
> ---
>  tools/perf/util/stat.c | 25 +++++++++++++++++++++----
>  1 file changed, 21 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
> index 6ab9c58beca7..9dfa8cac6bc4 100644
> --- a/tools/perf/util/stat.c
> +++ b/tools/perf/util/stat.c
> @@ -396,6 +396,25 @@ static int check_per_pkg(struct evsel *counter, struct perf_counts_values *vals,
>  	return ret;
>  }
>  
> +static bool evsel__count_has_error(struct evsel *evsel,
> +				   struct perf_counts_values *count,
> +				   struct perf_stat_config *config)
> +{
> +	/* the evsel was failed already */
> +	if (evsel->err || evsel->counts->scaled == -1)
> +		return true;
> +
> +	/* this is meaningful for CPU aggregation modes only */
> +	if (config->aggr_mode == AGGR_GLOBAL)
> +		return false;
> +
> +	/* it's considered ok when it actually ran */
> +	if (count->ena != 0 && count->run != 0)
> +		return false;
> +
> +	return true;
> +}
> +
>  static int
>  process_counter_values(struct perf_stat_config *config, struct evsel *evsel,
>  		       int cpu_map_idx, int thread,
> @@ -450,11 +469,9 @@ process_counter_values(struct perf_stat_config *config, struct evsel *evsel,
>  
>  			/*
>  			 * When any result is bad, make them all to give consistent output
> -			 * in interval mode.  But per-task counters can have 0 enabled time
> -			 * when some tasks are idle.
> +			 * in interval mode.
>  			 */
> -			if (((count->ena == 0 || count->run == 0) && cpu.cpu != -1) ||
> -			    evsel->counts->scaled == -1) {
> +			if (evsel__count_has_error(evsel, count, config) && !ps_aggr->failed) {
>  				ps_aggr->counts.val = 0;
>  				ps_aggr->counts.ena = 0;
>  				ps_aggr->counts.run = 0;
> -- 
> 2.38.0.413.g74048e4d9e-goog

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ