From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Leo Yan <leo.yan@arm.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
"Liang, Kan" <kan.liang@linux.intel.com>,
Dima Kogan <dima@secretsauce.net>,
james.clark@linaro.org, linux-perf-users@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 3/3] perf probe: Generate hash event for long symbol
Date: Fri, 11 Oct 2024 12:07:33 +0900 [thread overview]
Message-ID: <20241011120733.5660c80f8f93e9659fa5a254@kernel.org> (raw)
In-Reply-To: <fab219bc-fabd-42b7-b42f-d92851b1d2f3@arm.com>
On Thu, 10 Oct 2024 16:53:05 +0100
Leo Yan <leo.yan@arm.com> wrote:
> Hi Masami,
>
> On 10/10/24 16:34, Masami Hiramatsu (Google) wrote:
> >
> >
> > On Mon, 7 Oct 2024 15:11:16 +0100
> > Leo Yan <leo.yan@arm.com> wrote:
> >
> >> If a symbol name is longer than the maximum event length (64 bytes),
> >> generate an new event name with below combination:
> >>
> >> TruncatedSymbol + '_' + HashString + '__return' + '\0'
> >> `> 46B + 1B + 8B + 8B + 1B = 64 Bytes.
> >>
> >> With this change, a probe can be injected for long symbol.
> >>
> >> Before:
> >>
> >> # nm test_cpp_mangle | grep -E "print_data|Point"
> >> 0000000000000cac t _GLOBAL__sub_I__Z62this_is_a_very_very_long_print_data_abcdefghijklmnopqrstuvwxyzi
> >> 0000000000000b50 T _Z62this_is_a_very_very_long_print_data_abcdefghijklmnopqrstuvwxyzR5Point
> >> 0000000000000b14 T _Z62this_is_a_very_very_long_print_data_abcdefghijklmnopqrstuvwxyzi
> >>
> >> # perf probe -x test_cpp_mangle --add \
> >> "_Z62this_is_a_very_very_long_print_data_abcdefghijklmnopqrstuvwxyzi"
> >> snprintf() failed: -7; the event name nbase='_Z62this_is_a_very_very_long_print_data_abcdefghijklmnopqrstuvwxyzi' is too long
> >> Error: Failed to add events.
> >>
> >> After:
> >>
> >> # perf probe -x test_cpp_mangle --add \
> >> "_Z62this_is_a_very_very_long_print_data_abcdefghijklmnopqrstuvwxyzi"
> >>
> >> Probe event='_Z62this_is_a_very_very_long_print_data_abcdefghijklmnopqrstuvwxyzi' is too long (>= 64 bytes).
> >> Generate hashed event name='_Z62this_is_a_very_very_long_print_data_abcdef_91f40679'
> >>
> >> Added new event:
> >> probe_test_cpp_mangle: _Z62this_is_a_very_very_long_print_data_abcdef_91f40679
> >> (on _Z62this_is_a_very_very_long_print_data_abcdefghijklmnopqrstuvwxyzi in /mnt/test_cpp_mangle)
> >>
> >> You can now use it in all perf tools, such as:
> >>
> >> perf record -e probe_test_cpp_mangle: _Z62this_is_a_very_very_long_print_data_abcdef_91f40679 -aR sleep 1
> >
> > OK, personally, I recommend you to specify event name instead of generating
> > long event name in this case. But I understand sometimes this kind of feature
> > is good for someone.
>
> Sometimes, users try to add probe for long symbol and returns error, but there
> have no clue for proceeding.
OK, no warning messsage is not good.
It should warn them to recommend adding it with their own event name too.
> Either we automatically generate a hashed name, or a guidance in the failure
> log for setting event name would be helpful. If you have concern for hashed
> name, maybe we can refine the log to give info for setting event name?
Yeah, I think this long event name is not useful for user to type.
> > BTW, I would like to confirm. Can't we demangle the symbol name and parse it?
>
> I did test for C++ demangle symbols with the command:
>
> perf probe -x /mnt/test_cpp_mangle -F --demangle
>
> The command doesn't work as I cannot see it output correctly for demangled
> symbols. But I don't look into details why this does not work at my side.
Oops, that is another issue to be solved.
Thank you,
>
> Thanks for review.
>
> Leo
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2024-10-11 3:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-07 14:11 [PATCH v1 0/3] perf probe: Support long symbol Leo Yan
2024-10-07 14:11 ` [PATCH v1 1/3] perf: Dynamically allocate buffer for event string Leo Yan
2024-10-10 15:21 ` Masami Hiramatsu
2024-10-07 14:11 ` [PATCH v1 2/3] perf probe: Check group string length Leo Yan
2024-10-10 15:22 ` Masami Hiramatsu
2024-10-07 14:11 ` [PATCH v1 3/3] perf probe: Generate hash event for long symbol Leo Yan
2024-10-10 15:34 ` Masami Hiramatsu
2024-10-10 15:53 ` Leo Yan
2024-10-11 3:07 ` Masami Hiramatsu [this message]
2024-10-11 8:41 ` Leo Yan
2024-10-12 5:30 ` Masami Hiramatsu
2024-10-12 14:21 ` Leo Yan
2024-10-10 1:12 ` [PATCH v1 0/3] perf probe: Support " Namhyung Kim
2024-10-10 14:48 ` Masami Hiramatsu
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=20241011120733.5660c80f8f93e9659fa5a254@kernel.org \
--to=mhiramat@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=dima@secretsauce.net \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=leo.yan@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--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