Re: [PATCH 3/5] perf record: Tracking side-band events for all CPUs when tracing selected CPUs

From: Yang Jihong
Date: Wed Jul 05 2023 - 21:39:36 EST


Hello,

On 2023/7/6 5:09, Namhyung Kim wrote:
On Tue, Jul 4, 2023 at 12:44 AM Yang Jihong <yangjihong1@xxxxxxxxxx> wrote:

User space tasks can migrate between CPUs, we need to track side-band
events for all CPUs.

The specific scenarios are as follows:

CPU0 CPU1
perf record -C 0 start
taskA starts to be created and executed
-> PERF_RECORD_COMM and PERF_RECORD_MMAP
events only deliver to CPU1
......
|
migrate to CPU0
|
Running on CPU0 <----------/
...

perf record -C 0 stop

But I'm curious why you don't limit the task to run on the
specified CPUs only (using taskset).

Also, as you may know, you don't need to specify -C if you
want to profile specific tasks only. It'll open per-cpu, per-task
events and they will have all necessary info.

The actual application scenario is to perform perf records only for specified cores. However, during sampling, the system may create new processes and then migrate the processes between cores due to scheduling. If the processes run on the selected core, In this case, the perf report cannot parse symbols for these processes.

Now perf samples the PC of taskA. However, perf does not record the
PERF_RECORD_COMM and PERF_RECORD_COMM events of taskA.

_COMM and _MMAP right?

Yes, PERF_RECORD_COMM and PERF_RECORD_MMAP. There's a clerical error here...

Thanks,
Yang