public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: "Song Bao Hua (Barry Song)" <song.bao.hua@hisilicon.com>
Cc: Namhyung Kim <namhyung@kernel.org>,
	Andi Kleen <ak@linux.intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Linuxarm <linuxarm@huawei.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>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Alexey Budankov <alexey.budankov@linux.intel.com>
Subject: Re: [PATCH] perf evlist: fix memory corruption for Kernel PMU event
Date: Tue, 6 Oct 2020 13:11:13 +0200	[thread overview]
Message-ID: <20201006111113.GB249615@krava> (raw)
In-Reply-To: <41a3e45d558242f79f9e10a8d9ca92f1@hisilicon.com>

On Tue, Oct 06, 2020 at 06:39:44AM +0000, Song Bao Hua (Barry Song) wrote:

SNIP

> > > Andi, thanks! Could you share the link or the commit ID? I'd like to take a
> > look at the fix.
> > > I could still reproduce this issue in the latest linus' tree and I didn't find any
> > commit
> > > related to this issue in linux-next and tip/perf/core.
> > 
> > I think Andi was referring to this discussion which is not merged yet:
> > 
> > https://lore.kernel.org/lkml/20200922031346.15051-2-liwei391@huawei.co
> > m/
> > 
> > I suggested a patch at the end.  Can you please try it?
> 
> I tried the patch you suggested.
> 
> diff --git a/tools/lib/perf/evlist.c b/tools/lib/perf/evlist.c
> index 2208444ecb44..cfcdbd7be066 100644
> --- a/tools/lib/perf/evlist.c
> +++ b/tools/lib/perf/evlist.c
> @@ -45,6 +45,9 @@ static void __perf_evlist__propagate_maps(struct perf_evlist *evlist,
>          if (!evsel->own_cpus || evlist->has_user_cpus) {
>                  perf_cpu_map__put(evsel->cpus);
>                 evsel->cpus = perf_cpu_map__get(evlist->cpus);
> +       } else if (!evsel->system_wide && perf_cpu_map__empty(evlist->cpus)) {
> +               perf_cpu_map__put(evsel->cpus);
> +               evsel->cpus = perf_cpu_map__get(evlist->cpus);
>         } else if (evsel->cpus != evsel->own_cpus) {
>                 perf_cpu_map__put(evsel->cpus);
>                 evsel->cpus = perf_cpu_map__get(evsel->own_cpus);
> 
> it did fix the crash I have seen on arm64. I'd prefer you put the below fixes tag in the commit log. 
> Fixes: 7736627b865d ("perf stat: Use affinity for closing file descriptors")
> Perf stat began to crash from v5.4 kernel, so the fix should be backported to stable trees.

awesome.. Namhyung, could you please send full patch?

thanks,
jirka


  reply	other threads:[~2020-10-06 11:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01 11:57 [PATCH] perf evlist: fix memory corruption for Kernel PMU event Barry Song
2020-10-01 23:06 ` Andi Kleen
2020-10-02  3:02   ` Song Bao Hua (Barry Song)
2020-10-06  1:25     ` Namhyung Kim
2020-10-06  6:39       ` Song Bao Hua (Barry Song)
2020-10-06 11:11         ` Jiri Olsa [this message]
2020-10-07  7:23           ` Namhyung Kim

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=20201006111113.GB249615@krava \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexey.budankov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=song.bao.hua@hisilicon.com \
    /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