[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fW31eiy8ke0hc_YwCffFRW4PNOUnsN89N_goQq5hgHmJw@mail.gmail.com>
Date: Tue, 28 Nov 2023 09:12:57 -0800
From: Ian Rogers <irogers@...gle.com>
To: cruzzhao <cruzzhao@...ux.alibaba.com>
Cc: Namhyung Kim <namhyung@...nel.org>, mingo@...hat.com,
peterz@...radead.org, acme@...nel.org, mark.rutland@....com,
alexander.shishkin@...ux.intel.com, jolsa@...nel.org,
adrian.hunter@...el.com, kprateek.nayak@....com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf: ignore exited thread when synthesize thread map
On Mon, Nov 27, 2023 at 10:23 PM cruzzhao <cruzzhao@...ux.alibaba.com> wrote:
>
>
>
> 在 2023/11/23 上午5:05, Namhyung Kim 写道:
> > Hello,
> >
> > On Tue, Nov 21, 2023 at 6:22 PM Cruz Zhao <CruzZhao@...ux.alibaba.com> wrote:
> >>
> >> When synthesize thread map, some threads in thread map may have
> >> already exited, so that __event__synthesize_thread() returns -1
> >> and the synthesis breaks. However, It will not have any effect
> >> if we just ignore the exited thread. So just ignore it and continue.
> >
> > Looks ok. But I guess you want to do the same for the leader
> > thread below as well.
> >
> > Thanks,
> > Namhyung
> >
>
> With my testcase, no error is returned even if we don't do the same for
> the leader thread blow. Well, I'll check whether the logic is still
> correct if we do so.
>
> Many thanks for reviewing.
Thanks for looking at this. Could you share the test? It looks like
the thread be removed from the thread map to avoid potential future
broken accesses like below:
https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/util/synthetic-events.c?h=perf-tools-next#n887
Some of the race will hopefully get narrowed by switching to a less
memory intense readdir:
https://lore.kernel.org/lkml/20231127220902.1315692-7-irogers@google.com/
Threads racing is an issue in this example:
```
$ sudo perf top --stdio -u `whoami`
Error:
The sys_perf_event_open() syscall returned with 3 (No such process)
for event (cycles:P).
/bin/dmesg | grep -i perf may provide additional information.
```
Generally the races are covered by the dummy event that gathers
sideband data like thread creation and exits, which is created prior
to synthesis. It would be nice to have a better threading abstraction
to avoid these races.
Thanks,
Ian
> Best,
> Cruz Zhao
Powered by blists - more mailing lists