From: Yang Jihong <yangjihong1@huawei.com>
To: <peterz@infradead.org>, <mingo@redhat.com>, <acme@kernel.org>,
<mark.rutland@arm.com>, <alexander.shishkin@linux.intel.com>,
<jolsa@kernel.org>, <namhyung@kernel.org>, <irogers@google.com>,
<adrian.hunter@intel.com>, <linux-perf-users@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Cc: <yangjihong1@huawei.com>
Subject: [PATCH 2/2] perf/core: deliver PERF_RECORD_COMM and PERF_RECORD_MMAP side-band events to all online cpus
Date: Tue, 20 Jun 2023 15:55:15 +0000 [thread overview]
Message-ID: <20230620155515.101222-3-yangjihong1@huawei.com> (raw)
In-Reply-To: <20230620155515.101222-1-yangjihong1@huawei.com>
Tasks are migrated between cores due to scheduling.
If perf samples specified CPUs, PERF_RECORD_COMM and PERF_RECORD_MMAP
events need be deliver to all cores to avoids the problem that the comm
and symbols cannot be parsed due to task migration to the target core.
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
Now perf samples the PC of taskA. However, perf does not record the
PERF_RECORD_COMM and PERF_RECORD_COMM events of taskA.
Therefore, the comm and symbols of taskA cannot be parsed.
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
---
kernel/events/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 66dbca1ba577..a014b2063af1 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -8276,7 +8276,7 @@ static void perf_event_comm_event(struct perf_comm_event *comm_event)
perf_iterate_sb(perf_event_comm_output,
comm_event,
NULL,
- false);
+ true);
}
void perf_event_comm(struct task_struct *task, bool exec)
@@ -8755,7 +8755,7 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event)
perf_iterate_sb(perf_event_mmap_output,
mmap_event,
NULL,
- false);
+ true);
kfree(buf);
}
--
2.30.GIT
next prev parent reply other threads:[~2023-06-20 15:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-20 15:55 [PATCH 0/2] " Yang Jihong
2023-06-20 15:55 ` [PATCH 1/2] perf/core: perf_iterate_sb_cpu() supports to receive side-band events for all oneline cpus Yang Jihong
2023-06-20 15:55 ` Yang Jihong [this message]
2023-06-20 18:49 ` [PATCH 0/2] perf/core: deliver PERF_RECORD_COMM and PERF_RECORD_MMAP side-band events to all online cpus Adrian Hunter
2023-06-23 5:48 ` Yang Jihong
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=20230620155515.101222-3-yangjihong1@huawei.com \
--to=yangjihong1@huawei.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®