public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Xing Zhengjun <zhengjun.xing@linux.intel.com>
To: Ian Rogers <irogers@google.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Kan Liang <kan.liang@linux.intel.com>,
	Andi Kleen <ak@linux.intel.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH v1 1/2] perf stat: Clear reset_group for each stat run
Date: Tue, 23 Aug 2022 15:57:54 +0800	[thread overview]
Message-ID: <532d89be-63b1-acc2-ae20-8577f064e977@linux.intel.com> (raw)
In-Reply-To: <20220822213352.75721-1-irogers@google.com>



On 8/23/2022 5:33 AM, Ian Rogers wrote:
> If a weak group is broken then the reset_group flag remains set for
> the next run. Having reset_group set means the counter isn't created
> and ultimately a segfault.
> 
> A simple reproduction of this is:
> perf stat -r2 -e '{cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles}:W

It is better to change to a full command:
perf stat -r2 -e 
'{cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles}:W' 
true
> which will be added as a test in the next patch.
> 
> Fixes: 4804e0111662 ("perf stat: Use affinity for opening events")
> Signed-off-by: Ian Rogers <irogers@google.com>

I test the two patches on both non-hybrid and hybrid machines, and the 
"Segmentation fault" disappeared.

Tested-by: Zhengjun Xing <zhengjun.xing@linux.intel.com>

> ---
>   tools/perf/builtin-stat.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index 7fb81a44672d..54cd29d07ca8 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -826,6 +826,7 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)
>   	}
>   
>   	evlist__for_each_entry(evsel_list, counter) {
> +		counter->reset_group = false;
>   		if (bpf_counter__load(counter, &target))
>   			return -1;
>   		if (!evsel__is_bpf(counter))

-- 
Zhengjun Xing

  parent reply	other threads:[~2022-08-23  7:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-22 21:33 [PATCH v1 1/2] perf stat: Clear reset_group for each stat run Ian Rogers
2022-08-22 21:33 ` [PATCH v1 2/2] perf test: Stat test for repeat with a weak group Ian Rogers
2022-08-23  7:57 ` Xing Zhengjun [this message]
2022-08-23 13:34 ` [PATCH v1 1/2] perf stat: Clear reset_group for each stat run Arnaldo Carvalho de Melo
2022-08-23 16:33   ` Ian Rogers
2022-08-23 15:10 ` Andi Kleen
2022-08-23 18:42   ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=532d89be-63b1-acc2-ae20-8577f064e977@linux.intel.com \
    --to=zhengjun.xing@linux.intel.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=eranian@google.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox