* [PATCH] perf machine: Don't ignore _etext when not a text symbol
@ 2025-01-08 9:15 Christophe Leroy
2025-01-08 20:14 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 3+ messages in thread
From: Christophe Leroy @ 2025-01-08 9:15 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, Liang, Kan, Song Liu
Cc: Christophe Leroy, linux-kernel, linuxppc-dev, linux-perf-users
Depending on how vmlinux.lds is written, _etext might be the very
first data symbol instead of the very last text symbol.
Don't require it to be a text symbol, accept any symbol type.
Fixes: ed9adb2035b5 ("perf machine: Read also the end of the kernel")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
tools/perf/util/machine.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 27d5345d2b30..9be2f4479f52 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1003,7 +1003,7 @@ static int machine__get_running_kernel_start(struct machine *machine,
err = kallsyms__get_symbol_start(filename, "_edata", &addr);
if (err)
- err = kallsyms__get_function_start(filename, "_etext", &addr);
+ err = kallsyms__get_symbol_start(filename, "_etext", &addr);
if (!err)
*end = addr;
--
2.47.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf machine: Don't ignore _etext when not a text symbol
2025-01-08 9:15 [PATCH] perf machine: Don't ignore _etext when not a text symbol Christophe Leroy
@ 2025-01-08 20:14 ` Arnaldo Carvalho de Melo
2025-01-09 6:38 ` Christophe Leroy
0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2025-01-08 20:14 UTC (permalink / raw)
To: Christophe Leroy
Cc: Peter Zijlstra, Ingo Molnar, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
Liang, Kan, Song Liu, linux-kernel, linuxppc-dev,
linux-perf-users
On Wed, Jan 08, 2025 at 10:15:24AM +0100, Christophe Leroy wrote:
> Depending on how vmlinux.lds is written, _etext might be the very
> first data symbol instead of the very last text symbol.
>
> Don't require it to be a text symbol, accept any symbol type.
I'm adding a Link:
Link: https://lore.kernel.org/all/752a31b0-4370-4f52-b7cc-45f0078c1d6c@csgroup.eu
To give more context as where this has been observed, and also add a
snippet of your explanation there, this:
----
# grep -e _stext -e _etext -e _edata /proc/kallsyms
c0000000 T _stext
c08b8000 D _etext
So there is no _edata and _etext is not text
$ ppc-linux-objdump -x vmlinux | grep -e _stext -e _etext -e _edata
c0000000 g .head.text 00000000 _stext
c08b8000 g .rodata 00000000 _etext
c1378000 g .sbss 00000000 _edata
----
Thanks,
- Arnaldo
> Fixes: ed9adb2035b5 ("perf machine: Read also the end of the kernel")
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> tools/perf/util/machine.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index 27d5345d2b30..9be2f4479f52 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -1003,7 +1003,7 @@ static int machine__get_running_kernel_start(struct machine *machine,
>
> err = kallsyms__get_symbol_start(filename, "_edata", &addr);
> if (err)
> - err = kallsyms__get_function_start(filename, "_etext", &addr);
> + err = kallsyms__get_symbol_start(filename, "_etext", &addr);
> if (!err)
> *end = addr;
>
> --
> 2.47.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] perf machine: Don't ignore _etext when not a text symbol
2025-01-08 20:14 ` Arnaldo Carvalho de Melo
@ 2025-01-09 6:38 ` Christophe Leroy
0 siblings, 0 replies; 3+ messages in thread
From: Christophe Leroy @ 2025-01-09 6:38 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Peter Zijlstra, Ingo Molnar, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
Liang, Kan, Song Liu, linux-kernel, linuxppc-dev,
linux-perf-users
Le 08/01/2025 à 21:14, Arnaldo Carvalho de Melo a écrit :
> On Wed, Jan 08, 2025 at 10:15:24AM +0100, Christophe Leroy wrote:
>> Depending on how vmlinux.lds is written, _etext might be the very
>> first data symbol instead of the very last text symbol.
>>
>> Don't require it to be a text symbol, accept any symbol type.
>
> I'm adding a Link:
>
> Link: https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fall%2F752a31b0-4370-4f52-b7cc-45f0078c1d6c%40csgroup.eu&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C914f4c7995574ee91f5c08dd30211dd6%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C638719640997470461%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=kqCNbhhgKri3TlJaUb3mkTU6NyFRzhnb%2BDiK93h9aSQ%3D&reserved=0
>
> To give more context as where this has been observed, and also add a
> snippet of your explanation there, this:
>
> ----
> # grep -e _stext -e _etext -e _edata /proc/kallsyms
> c0000000 T _stext
> c08b8000 D _etext
>
> So there is no _edata and _etext is not text
For the absence of _edata, I sent another patch, will you take it as
well ? :
https://lore.kernel.org/linux-perf-users/2fec8c50c271dff59f0177ff0884b6c374486ba5.1736327770.git.christophe.leroy@csgroup.eu/T/#u
Thanks
Christophe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-01-09 6:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-08 9:15 [PATCH] perf machine: Don't ignore _etext when not a text symbol Christophe Leroy
2025-01-08 20:14 ` Arnaldo Carvalho de Melo
2025-01-09 6:38 ` Christophe Leroy
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).