[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7ciVF=36BaxzKmddvekimYar+X3ZSWKkk5Tu+vJRRxCx0w@mail.gmail.com>
Date: Mon, 24 Jun 2024 22:07:35 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: "Liang, Kan" <kan.liang@...ux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>, Ian Rogers <irogers@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>, Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
linux-perf-users@...r.kernel.org, Guilherme Amadio <amadio@...n.ch>
Subject: Re: [PATCH 4/4] perf mem: Fix a segfault with NULL event->name
Hi Kan,
On Fri, Jun 21, 2024 at 1:11 PM Liang, Kan <kan.liang@...ux.intel.com> wrote:
>
>
>
> On 2024-06-21 1:05 p.m., Namhyung Kim wrote:
> > Guilherme reported a crash in perf mem record. It's because the
> > perf_mem_event->name was NULL on his machine. It should just return
> > a NULL string when it has no format string in the name.
> >
> > But I'm not sure why it returns TRUE if it doesn't have event_name in
> > perf_pmu__mem_events_supported().
>
> AMD doesn't have the event_name.
>
> struct perf_mem_event perf_mem_events_amd[PERF_MEM_EVENTS__MAX] = {
> E(NULL, NULL, NULL, false, 0),
> E(NULL, NULL, NULL, false, 0),
> E("mem-ldst", "%s//", NULL, false, 0),
> };
>
> It looks like as long as it's a "ibs_op" PMU, the mem event is always
> available. The "ibs_op" check has been moved into perf_pmu__arch_init().
> So the event_name is empty.
>
> The "e->tag" in the perf_pmu__mem_events_init() can help to skip the
> case E(NULL, NULL, NULL, false, 0).
> So the perf_pmu__mem_events_supported() returns TRUE for the !event_name.
Ok, thanks for the explanation!
Namhyung
Powered by blists - more mailing lists