linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Petlan <mpetlan@redhat.com>
To: linux-perf-users@vger.kernel.org, acme@redhat.com,
	irogers@google.com, namhyung@kernel.org
Cc: jmario@redhat.com, jolsa@kernel.org
Subject: [PATCH 1/4] perf tools: Remove /SYSV from no_dso maps
Date: Mon,  6 Oct 2025 19:57:07 +0200	[thread overview]
Message-ID: <20251006175710.1179040-2-mpetlan@redhat.com> (raw)
In-Reply-To: <20251006175710.1179040-1-mpetlan@redhat.com>

We will need it for upcoming commits. Also adjust the function
calls in perf-inject, in order not to break the logic.

Suggested-by: Jiri Olsa <jolsa@kernel.org>

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
---
 tools/perf/builtin-inject.c | 4 ++--
 tools/perf/util/map.c       | 5 +++--
 tools/perf/util/map.h       | 6 +++++-
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index a114b3fa1bea..cc090da5c445 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -773,7 +773,7 @@ static int tool__inject_build_id(const struct perf_tool *tool,
 
 	if (is_anon_memory(filename) || flags & MAP_HUGETLB)
 		return 0;
-	if (is_no_dso_memory(filename))
+	if (is_no_dso_memory(filename) || is_shared_memory(filename))
 		return 0;
 
 	if (inject->known_build_ids != NULL &&
@@ -813,7 +813,7 @@ static int tool__inject_mmap2_build_id(const struct perf_tool *tool,
 	/* Return to repipe anonymous maps. */
 	if (is_anon_memory(filename) || flags & MAP_HUGETLB)
 		return 1;
-	if (is_no_dso_memory(filename))
+	if (is_no_dso_memory(filename) || is_shared_memory(filename))
 		return 1;
 
 	if (dso__read_build_id(dso)) {
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index b46c68c24d1c..6d13b4602970 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -133,12 +133,13 @@ struct map *map__new(struct machine *machine, u64 start, u64 len,
 	if (ADD_RC_CHK(result, map)) {
 		char newfilename[PATH_MAX];
 		struct dso *dso;
-		int anon, no_dso, vdso, android;
+		int anon, no_dso, vdso, android, shared;
 
 		android = is_android_lib(filename);
 		anon = is_anon_memory(filename) || flags & MAP_HUGETLB;
 		vdso = is_vdso_map(filename);
 		no_dso = is_no_dso_memory(filename);
+		shared = is_shared_memory(filename);
 		nsi = nsinfo__get(thread__nsinfo(thread));
 
 		if ((anon || no_dso) && nsi && (prot & PROT_EXEC)) {
@@ -174,7 +175,7 @@ struct map *map__new(struct machine *machine, u64 start, u64 len,
 		assert(!dso__kernel(dso));
 		map__init(result, start, start + len, pgoff, dso, prot, flags);
 
-		if (anon || no_dso) {
+		if (anon || no_dso || shared) {
 			map->mapping_type = MAPPING_TYPE__IDENTITY;
 
 			/*
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
index 9cadf533a561..616f32504e46 100644
--- a/tools/perf/util/map.h
+++ b/tools/perf/util/map.h
@@ -258,10 +258,14 @@ static inline int is_anon_memory(const char *filename)
 static inline int is_no_dso_memory(const char *filename)
 {
 	return !strncmp(filename, "[stack", 6) ||
-	       !strncmp(filename, "/SYSV", 5)  ||
 	       !strcmp(filename, "[heap]");
 }
 
+static inline int is_shared_memory(const char *filename)
+{
+	return !strncmp(filename, "/SYSV", 5);
+}
+
 static inline void map__set_start(struct map *map, u64 start)
 {
 	RC_CHK_ACCESS(map)->start = start;
-- 
2.47.3


  reply	other threads:[~2025-10-06 17:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-06 17:57 [PATCH 0/4] perf c2c: Detect shared memory cachelines Michael Petlan
2025-10-06 17:57 ` Michael Petlan [this message]
2025-10-06 18:01   ` [PATCH 1/4] perf tools: Remove /SYSV from no_dso maps Ian Rogers
2025-10-06 18:28     ` Joe Mario
2025-10-06 19:21       ` Ian Rogers
2025-10-06 17:57 ` [PATCH 2/4] perf c2c: Add shared mem flag Michael Petlan
2025-10-06 17:57 ` [PATCH 3/4] perf c2c: Add map name for cacheline Michael Petlan
2025-10-06 17:57 ` [PATCH 4/4] perf c2c report: Add --detect-shm option Michael Petlan
2025-10-07  8:16 ` [PATCH 0/4] perf c2c: Detect shared memory cachelines Namhyung Kim
2025-10-07 14:38   ` Arnaldo Carvalho de Melo

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=20251006175710.1179040-2-mpetlan@redhat.com \
    --to=mpetlan@redhat.com \
    --cc=acme@redhat.com \
    --cc=irogers@google.com \
    --cc=jmario@redhat.com \
    --cc=jolsa@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.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;
as well as URLs for NNTP newsgroup(s).