Re: [PATCH v2] perf test record+probe_libc_inet_pton: Make test resilient
From: Arnaldo Carvalho de Melo
Date: Mon Jan 13 2025 - 10:50:20 EST
On Tue, Jan 07, 2025 at 04:51:31PM +0000, James Clark wrote:
>
>
> On 02/12/2024 11:19 am, Leo Yan wrote:
> > The test failed back and forth due to the call chain being heavily
> > impacted by the libc, which varies across different architectures and
> > distros.
> >
> > The libc contains the symbols for "gaih_inet" and "getaddrinfo" in some
> > cases, but not always. Moreover, these symbols can be either normal
> > symbols or dynamic symbols, making it difficult to decide the call chain
> > entries due to the symbols are inconsistent.
> >
> > To fix the issue, this commit identifies three call chain entries are
> > always present. These entries are matched by iterating through the
> > lines in the "perf script" result. The recording attribute max-stack is
> > set to 4 for the possible maximum call chain depth.
> >
> > After:
> >
> > # perf test -vF pton
> > --- start ---
> > Pattern: ping[][0-9 \.:]+probe_libc:inet_pton: \([[:xdigit:]]+\)
> > Matching: ping 285058 [025] 1219802.466939: probe_libc:inet_pton: (ffffa14b7cf0)
> > Pattern: .*inet_pton\+0x[[:xdigit:]]+[[:space:]]\(/usr/lib/aarch64-linux-gnu/libc-2.31.so|inlined\)$
> > Matching: ping 285058 [025] 1219802.466939: probe_libc:inet_pton: (ffffa14b7cf0)
> > Matching: ffffa14b7cf0 __GI___inet_pton+0x0 (/usr/lib/aarch64-linux-gnu/libc-2.31.so)
> > Pattern: .*(\+0x[[:xdigit:]]+|\[unknown\])[[:space:]]\(.*/bin/ping.*\)$
> > Matching: ping 285058 [025] 1219802.466939: probe_libc:inet_pton: (ffffa14b7cf0)
> > Matching: ffffa14b7cf0 __GI___inet_pton+0x0 (/usr/lib/aarch64-linux-gnu/libc-2.31.so)
> > Matching: ffffa1488040 getaddrinfo+0xe8 (/usr/lib/aarch64-linux-gnu/libc-2.31.so)
> > Matching: aaaab8672da4 [unknown] (/usr/bin/ping)
> > ---- end ----
> > 82: probe libc's inet_pton & backtrace it with ping : Ok
> >
> > Reported-by: Jing Zhang <renyu.zj@xxxxxxxxxxxxxxxxx>
> > Closes: https://lore.kernel.org/linux-perf-users/1728978807-81116-1-git-send-email-renyu.zj@xxxxxxxxxxxxxxxxx/
> > Reported-by: Guilherme Amadio <amadio@xxxxxxxxxx>
> > Closes: https://lore.kernel.org/linux-perf-users/Z0X3AYUWkAgfPpWj@x1/T/#m57327e135b156047e37d214a0d453af6ae1e02be
> > Signed-off-by: Leo Yan <leo.yan@xxxxxxx>
> > ---
> > Changes from v1: Fixed a typo s/Seatch/Search.
> >
> > .../shell/record+probe_libc_inet_pton.sh | 34 ++++++++++---------
> > 1 file changed, 18 insertions(+), 16 deletions(-)
> >
>
> Reviewed-by: James Clark <james.clark@xxxxxxxxxx>
Thanks, applied to perf-tools-next,
- Arnaldo