Skip to contentSkip to conversation

perf tools: Remove misleading comments on map functions

PATCH In review Namhyung Kim 3 participants 4 messages Feb 8, 2024 – Feb 9, 2024 perf events

lore
Share & tools
lore

Namhyung Kim

author maintainer
#0 lore raw

PATCH 1/1 perf tools: Remove misleading comments on map functions

When it converts sample IP to or from objdump-capable one, there's a comment saying that kernel modules have DSO_SPACE__USER. But commit 02213cec64bb ("perf maps: Mark module DSOs with kernel type") changed it and makes the comment confusing. Let's get rid of it.

---
 tools/perf/util/map.c | 8 --------
 1 file changed, 8 deletions(-)
tools/perf/util/map.c +0 -8
index cf5a15db3a1f..14a5ea70d81e 100644
@@ -553,10 +553,6 @@ u64 map__rip_2objdump(struct map *map, u64 rip)
 	if (dso->rel)
 		return rip - map__pgoff(map);
 
-	/*
-	 * kernel modules also have DSO_TYPE_USER in dso->kernel,
-	 * but all kernel modules are ET_REL, so won't get here.
-	 */
 	if (dso->kernel == DSO_SPACE__USER)
 		return rip + dso->text_offset;
 
@@ -585,10 +581,6 @@ u64 map__objdump_2mem(struct map *map, u64 ip)
 	if (dso->rel)
 		return map__unmap_ip(map, ip + map__pgoff(map));
 
-	/*
-	 * kernel modules also have DSO_TYPE_USER in dso->kernel,
-	 * but all kernel modules are ET_REL, so won't get here.
-	 */
 	if (dso->kernel == DSO_SPACE__USER)
 		return map__unmap_ip(map, ip - dso->text_offset);
 
Signature · 1 line
2.43.0.687.g38aa6559b0-goog
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Namhyung Kim

When it converts sample IP to or from objdump-capable one, there's a comment saying that kernel modules have DSO_SPACE__USER. But commit 02213cec64bb ("perf maps: Mark module DSOs with kernel type") changed it and makes the comment confusing. Let's get rid of it.

Thanks,
Ian

Quoted 33 lines
---
 tools/perf/util/map.c | 8 --------
 1 file changed, 8 deletions(-)
tools/perf/util/map.c +0 -9
index cf5a15db3a1f..14a5ea70d81e 100644
@@ -553,10 +553,6 @@ u64 map__rip_2objdump(struct map *map, u64 rip)
        if (dso->rel)
                return rip - map__pgoff(map);
 
-       /*
-        * kernel modules also have DSO_TYPE_USER in dso->kernel,
-        * but all kernel modules are ET_REL, so won't get here.
-        */
        if (dso->kernel == DSO_SPACE__USER)
                return rip + dso->text_offset;
 
@@ -585,10 +581,6 @@ u64 map__objdump_2mem(struct map *map, u64 ip)
        if (dso->rel)
                return map__unmap_ip(map, ip + map__pgoff(map));
 
-       /*
-        * kernel modules also have DSO_TYPE_USER in dso->kernel,
-        * but all kernel modules are ET_REL, so won't get here.
-        */
        if (dso->kernel == DSO_SPACE__USER)
                return map__unmap_ip(map, ip - dso->text_offset);
 
--

2.43.0.687.g38aa6559b0-goog

maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Namhyung Kim
Quoted 4 lines · Namhyung Kim

When it converts sample IP to or from objdump-capable one, there's a comment saying that kernel modules have DSO_SPACE__USER. But commit 02213cec64bb ("perf maps: Mark module DSOs with kernel type") changed it and makes the comment confusing. Let's get rid of it.

- Arnaldo

Quoted 33 lines
---
 tools/perf/util/map.c | 8 --------
 1 file changed, 8 deletions(-)
tools/perf/util/map.c +0 -8
index cf5a15db3a1f..14a5ea70d81e 100644
@@ -553,10 +553,6 @@ u64 map__rip_2objdump(struct map *map, u64 rip)
 	if (dso->rel)
 		return rip - map__pgoff(map);
 
-	/*
-	 * kernel modules also have DSO_TYPE_USER in dso->kernel,
-	 * but all kernel modules are ET_REL, so won't get here.
-	 */
 	if (dso->kernel == DSO_SPACE__USER)
 		return rip + dso->text_offset;
 
@@ -585,10 +581,6 @@ u64 map__objdump_2mem(struct map *map, u64 ip)
 	if (dso->rel)
 		return map__unmap_ip(map, ip + map__pgoff(map));
 
-	/*
-	 * kernel modules also have DSO_TYPE_USER in dso->kernel,
-	 * but all kernel modules are ET_REL, so won't get here.
-	 */
 	if (dso->kernel == DSO_SPACE__USER)
 		return map__unmap_ip(map, ip - dso->text_offset);
 
Signature · 1 line
2.43.0.687.g38aa6559b0-goog
author maintainer
#3 lore raw
In reply to Namhyung Kim
Quoted 6 lines · Namhyung Kim

When it converts sample IP to or from objdump-capable one, there's a comment saying that kernel modules have DSO_SPACE__USER. But commit 02213cec64bb ("perf maps: Mark module DSOs with kernel type") changed it and makes the comment confusing. Let's get rid of it.

Applied perf-tools-next, thanks!

Best regards,

Signature · 1 line
Namhyung Kim <[email protected]>