All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Wei Li <liwei391@huawei.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Andi Kleen <ak@linux.intel.com>,
	Alexey Budankov <alexey.budankov@linux.intel.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	Li Bin <huawei.libin@huawei.com>
Subject: Re: [PATCH 1/2] perf stat: Fix segfault when counting armv8_pmu events
Date: Wed, 23 Sep 2020 22:49:52 +0900	[thread overview]
Message-ID: <CAM9d7cjLKosv97fEUCATVTr0mkZL_W5oDzBSxde70RhOeZ=6fg@mail.gmail.com> (raw)
In-Reply-To: <20200923054426.GG2893484@krava>

On Wed, Sep 23, 2020 at 2:44 PM Jiri Olsa <jolsa@redhat.com> wrote:
>
> On Tue, Sep 22, 2020 at 11:13:45AM +0800, Wei Li wrote:
> > When executing perf stat with armv8_pmu events with a workload, it will
> > report a segfault as result.
>
> please share the perf stat command line you see that segfault for

It seems the description in the patch 0/2 already has it:

  [root@localhost hulk]# tools/perf/perf stat  -e
armv8_pmuv3_0/ll_cache_rd/,armv8_pmuv3_0/ll_cache_miss_rd/ ls >
/dev/null
  Segmentation fault

Thanks
Namhyun


>
> thanks,
> jirka
>
> >
> > (gdb) bt
> > #0  0x0000000000603fc8 in perf_evsel__close_fd_cpu (evsel=<optimized out>,
> >     cpu=<optimized out>) at evsel.c:122
> > #1  perf_evsel__close_cpu (evsel=evsel@entry=0x716e950, cpu=7) at evsel.c:156
> > #2  0x00000000004d4718 in evlist__close (evlist=0x70a7cb0) at util/evlist.c:1242
> > #3  0x0000000000453404 in __run_perf_stat (argc=3, argc@entry=1, argv=0x30,
> >     argv@entry=0xfffffaea2f90, run_idx=119, run_idx@entry=1701998435)
> >     at builtin-stat.c:929
> > #4  0x0000000000455058 in run_perf_stat (run_idx=1701998435, argv=0xfffffaea2f90,
> >     argc=1) at builtin-stat.c:947
> > #5  cmd_stat (argc=1, argv=0xfffffaea2f90) at builtin-stat.c:2357
> > #6  0x00000000004bb888 in run_builtin (p=p@entry=0x9764b8 <commands+288>,
> >     argc=argc@entry=4, argv=argv@entry=0xfffffaea2f90) at perf.c:312
> > #7  0x00000000004bbb54 in handle_internal_command (argc=argc@entry=4,
> >     argv=argv@entry=0xfffffaea2f90) at perf.c:364
> > #8  0x0000000000435378 in run_argv (argcp=<synthetic pointer>,
> >     argv=<synthetic pointer>) at perf.c:408
> > #9  main (argc=4, argv=0xfffffaea2f90) at perf.c:538
> >
> > After debugging, i found the root reason is that the xyarray fd is created
> > by evsel__open_per_thread() ignoring the cpu passed in
> > create_perf_stat_counter(), while the evsel' cpumap is assigned as the
> > corresponding PMU's cpumap in __add_event(). Thus, the xyarray fd is created
> > with ncpus of dummy cpumap and an out of bounds 'cpu' index will be used in
> > perf_evsel__close_fd_cpu().
> >
> > To address this, add a flag to mark this situation and avoid using the
> > affinity technique when closing/enabling/disabling events.
> >
> > Fixes: 7736627b865d ("perf stat: Use affinity for closing file descriptors")
> > Fixes: 704e2f5b700d ("perf stat: Use affinity for enabling/disabling events")
> > Signed-off-by: Wei Li <liwei391@huawei.com>
> > ---

WARNING: multiple messages have this Message-ID (diff)
From: Namhyung Kim <namhyung@kernel.org>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Andi Kleen <ak@linux.intel.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Alexey Budankov <alexey.budankov@linux.intel.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Li Bin <huawei.libin@huawei.com>,
	Wei Li <liwei391@huawei.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] perf stat: Fix segfault when counting armv8_pmu events
Date: Wed, 23 Sep 2020 22:49:52 +0900	[thread overview]
Message-ID: <CAM9d7cjLKosv97fEUCATVTr0mkZL_W5oDzBSxde70RhOeZ=6fg@mail.gmail.com> (raw)
In-Reply-To: <20200923054426.GG2893484@krava>

On Wed, Sep 23, 2020 at 2:44 PM Jiri Olsa <jolsa@redhat.com> wrote:
>
> On Tue, Sep 22, 2020 at 11:13:45AM +0800, Wei Li wrote:
> > When executing perf stat with armv8_pmu events with a workload, it will
> > report a segfault as result.
>
> please share the perf stat command line you see that segfault for

It seems the description in the patch 0/2 already has it:

  [root@localhost hulk]# tools/perf/perf stat  -e
armv8_pmuv3_0/ll_cache_rd/,armv8_pmuv3_0/ll_cache_miss_rd/ ls >
/dev/null
  Segmentation fault

Thanks
Namhyun


>
> thanks,
> jirka
>
> >
> > (gdb) bt
> > #0  0x0000000000603fc8 in perf_evsel__close_fd_cpu (evsel=<optimized out>,
> >     cpu=<optimized out>) at evsel.c:122
> > #1  perf_evsel__close_cpu (evsel=evsel@entry=0x716e950, cpu=7) at evsel.c:156
> > #2  0x00000000004d4718 in evlist__close (evlist=0x70a7cb0) at util/evlist.c:1242
> > #3  0x0000000000453404 in __run_perf_stat (argc=3, argc@entry=1, argv=0x30,
> >     argv@entry=0xfffffaea2f90, run_idx=119, run_idx@entry=1701998435)
> >     at builtin-stat.c:929
> > #4  0x0000000000455058 in run_perf_stat (run_idx=1701998435, argv=0xfffffaea2f90,
> >     argc=1) at builtin-stat.c:947
> > #5  cmd_stat (argc=1, argv=0xfffffaea2f90) at builtin-stat.c:2357
> > #6  0x00000000004bb888 in run_builtin (p=p@entry=0x9764b8 <commands+288>,
> >     argc=argc@entry=4, argv=argv@entry=0xfffffaea2f90) at perf.c:312
> > #7  0x00000000004bbb54 in handle_internal_command (argc=argc@entry=4,
> >     argv=argv@entry=0xfffffaea2f90) at perf.c:364
> > #8  0x0000000000435378 in run_argv (argcp=<synthetic pointer>,
> >     argv=<synthetic pointer>) at perf.c:408
> > #9  main (argc=4, argv=0xfffffaea2f90) at perf.c:538
> >
> > After debugging, i found the root reason is that the xyarray fd is created
> > by evsel__open_per_thread() ignoring the cpu passed in
> > create_perf_stat_counter(), while the evsel' cpumap is assigned as the
> > corresponding PMU's cpumap in __add_event(). Thus, the xyarray fd is created
> > with ncpus of dummy cpumap and an out of bounds 'cpu' index will be used in
> > perf_evsel__close_fd_cpu().
> >
> > To address this, add a flag to mark this situation and avoid using the
> > affinity technique when closing/enabling/disabling events.
> >
> > Fixes: 7736627b865d ("perf stat: Use affinity for closing file descriptors")
> > Fixes: 704e2f5b700d ("perf stat: Use affinity for enabling/disabling events")
> > Signed-off-by: Wei Li <liwei391@huawei.com>
> > ---

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-09-23 13:50 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-22  3:13 [PATCH 0/2] perf stat: Unbreak perf stat with ARMv8 PMU events Wei Li
2020-09-22  3:13 ` Wei Li
2020-09-22  3:13 ` [PATCH 1/2] perf stat: Fix segfault when counting armv8_pmu events Wei Li
2020-09-22  3:13   ` Wei Li
2020-09-22 19:23   ` Andi Kleen
2020-09-22 19:23     ` Andi Kleen
2020-09-22 19:50     ` Andi Kleen
2020-09-22 19:50       ` Andi Kleen
2020-09-24 14:14       ` liwei (GF)
2020-09-24 14:14         ` liwei (GF)
2020-09-23  5:44   ` Jiri Olsa
2020-09-23  5:44     ` Jiri Olsa
2020-09-23 13:49     ` Namhyung Kim [this message]
2020-09-23 13:49       ` Namhyung Kim
2020-09-23 14:07       ` Jiri Olsa
2020-09-23 14:07         ` Jiri Olsa
2020-09-23 14:15         ` Namhyung Kim
2020-09-23 14:15           ` Namhyung Kim
2020-09-23 20:19           ` Jiri Olsa
2020-09-23 20:19             ` Jiri Olsa
2020-09-24 14:36             ` Namhyung Kim
2020-09-24 14:36               ` Namhyung Kim
2020-09-25 21:01               ` Jiri Olsa
2020-09-25 21:01                 ` Jiri Olsa
2020-10-02  8:59               ` Jiri Olsa
2020-10-02  8:59                 ` Jiri Olsa
2020-10-06  6:51                 ` Song Bao Hua (Barry Song)
2020-10-06  6:51                   ` Song Bao Hua (Barry Song)
2020-09-22  3:13 ` [PATCH 2/2] perf stat: Unbreak perf stat with " Wei Li
2020-09-22  3:13   ` Wei Li

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='CAM9d7cjLKosv97fEUCATVTr0mkZL_W5oDzBSxde70RhOeZ=6fg@mail.gmail.com' \
    --to=namhyung@kernel.org \
    --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=huawei.libin@huawei.com \
    --cc=jolsa@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liwei391@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.