From: Adrian Hunter <adrian.hunter@intel.com>
To: Namhyung Kim <namhyung@kernel.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Jiri Olsa <jolsa@kernel.org>
Cc: Ian Rogers <irogers@google.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 3/3] perf machine: Include data symbols in the kernel map
Date: Tue, 11 Jul 2023 18:19:35 +0300 [thread overview]
Message-ID: <a791e982-ada3-7f26-e105-bc7fa9c7d346@intel.com> (raw)
In-Reply-To: <20230620201818.1670753-3-namhyung@kernel.org>
On 20/06/23 23:18, Namhyung Kim wrote:
> When perf record -d is used, it needs data mmaps to symbolize global data.
> But it missed to collect kernel data maps so it cannot symbolize them.
> Instead of having a separate map, just increase the kernel map size to
> include the data section.
>
> Probably we can have a separate kernel map for data, but the current
> code assumes a single kernel map. So it'd require more changes in other
> places and looks error-prone. I decided not to go that way for now.
>
> Also it seems the kernel module size already includes the data section.
>
> For example, my system has the following.
>
> $ grep -e _stext -e _etext -e _edata /proc/kallsyms
> ffffffff99800000 T _stext
> ffffffff9a601ac8 T _etext
> ffffffff9b446a00 D _edata
>
> Size of the text section is (0x9a601ac8 - 0x99800000 = 0xe01ac8) and
> size of the data section is (0x9b446a00 - 0x99800000 = 0x1c46a00).
>
> Before:
> $ perf record -d true
>
> $ perf report -D | grep MMAP | head -1
> 0 0 0x460 [0x60]: PERF_RECORD_MMAP -1/0: [0xffffffff99800000(0xe01ac8) @ 0xffffffff99800000]: x [kernel.kallsyms]_text
> ^^^^^^^^
> here
> After:
> $ perf report -D | grep MMAP | head -1
> 0 0 0x460 [0x60]: PERF_RECORD_MMAP -1/0: [0xffffffff99800000(0x1c46a00) @ 0xffffffff99800000]: x [kernel.kallsyms]_text
> ^^^^^^^^^
>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/perf/util/machine.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index ddc0a2130caf..e93a66f6e0b3 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -1218,7 +1218,10 @@ static int machine__get_running_kernel_start(struct machine *machine,
>
> *start = addr;
>
> - err = kallsyms__get_function_start(filename, "_etext", &addr);
> + if (machine->has_data_mmap)
> + err = kallsyms__get_symbol_start(filename, "_edata", &addr);
> + else
> + err = kallsyms__get_function_start(filename, "_etext", &addr);
What is the downside of just extending it unconditionally?
> if (!err)
> *end = addr;
>
next prev parent reply other threads:[~2023-07-11 15:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-20 20:18 [PATCH 1/3] perf machine: Add machine->has_data_mmap field Namhyung Kim
2023-06-20 20:18 ` [PATCH 2/3] perf tools: Add kallsyms__get_symbol_start() Namhyung Kim
2023-06-22 17:23 ` Ian Rogers
2023-06-20 20:18 ` [PATCH 3/3] perf machine: Include data symbols in the kernel map Namhyung Kim
2023-06-22 17:27 ` Ian Rogers
2023-07-11 15:19 ` Adrian Hunter [this message]
2023-07-11 17:30 ` Namhyung Kim
2023-07-12 5:44 ` Adrian Hunter
2023-06-22 17:17 ` [PATCH 1/3] perf machine: Add machine->has_data_mmap field Ian Rogers
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=a791e982-ada3-7f26-e105-bc7fa9c7d346@intel.com \
--to=adrian.hunter@intel.com \
--cc=acme@kernel.org \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).