* [PATCH v2] perf test record+probe_libc_inet_pton: Make test resilient
@ 2024-12-02 11:19 Leo Yan
2024-12-02 13:48 ` Thomas Richter
2025-01-07 16:51 ` James Clark
0 siblings, 2 replies; 6+ messages in thread
From: Leo Yan @ 2024-12-02 11:19 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
Liang, Kan, Thomas Richter, Athira Rajeev, linux-perf-users,
linux-kernel
Cc: Leo Yan, Jing Zhang, Guilherme Amadio
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@linux.alibaba.com>
Closes: https://lore.kernel.org/linux-perf-users/1728978807-81116-1-git-send-email-renyu.zj@linux.alibaba.com/
Reported-by: Guilherme Amadio <amadio@gentoo.org>
Closes: https://lore.kernel.org/linux-perf-users/Z0X3AYUWkAgfPpWj@x1/T/#m57327e135b156047e37d214a0d453af6ae1e02be
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
Changes from v1: Fixed a typo s/Seatch/Search.
.../shell/record+probe_libc_inet_pton.sh | 34 ++++++++++---------
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
index 47a26f25db9f..3fbc7a7409af 100755
--- a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
+++ b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
@@ -43,17 +43,8 @@ trace_libc_inet_pton_backtrace() {
echo "((__GI_)?getaddrinfo|text_to_binary_address)\+0x[[:xdigit:]]+[[:space:]]\($libc|inlined\)$" >> $expected
echo "(gaih_inet|main)\+0x[[:xdigit:]]+[[:space:]]\(inlined|.*/bin/ping.*\)$" >> $expected
;;
- ppc64|ppc64le)
- eventattr='max-stack=4'
- # Add gaih_inet to expected backtrace only if it is part of libc.
- if nm $libc | grep -F -q gaih_inet.; then
- echo "gaih_inet.*\+0x[[:xdigit:]]+[[:space:]]\($libc\)$" >> $expected
- fi
- echo "getaddrinfo\+0x[[:xdigit:]]+[[:space:]]\($libc\)$" >> $expected
- echo ".*(\+0x[[:xdigit:]]+|\[unknown\])[[:space:]]\(.*/bin/ping.*\)$" >> $expected
- ;;
*)
- eventattr='max-stack=3'
+ eventattr='max-stack=4'
echo ".*(\+0x[[:xdigit:]]+|\[unknown\])[[:space:]]\(.*/bin/ping.*\)$" >> $expected
;;
esac
@@ -76,14 +67,25 @@ trace_libc_inet_pton_backtrace() {
fi
perf script -i $perf_data | tac | grep -m1 ^ping -B9 | tac > $perf_script
- exec 3<$perf_script
exec 4<$expected
- while read line <&3 && read -r pattern <&4; do
+ while read -r pattern <&4; do
+ echo "Pattern: $pattern"
[ -z "$pattern" ] && break
- echo $line
- echo "$line" | grep -E -q "$pattern"
- if [ $? -ne 0 ] ; then
- printf "FAIL: expected backtrace entry \"%s\" got \"%s\"\n" "$pattern" "$line"
+
+ found=0
+
+ # Search lines in the perf script result
+ exec 3<$perf_script
+ while read line <&3; do
+ [ -z "$line" ] && break
+ echo " Matching: $line"
+ ! echo "$line" | grep -E -q "$pattern"
+ found=$?
+ [ $found -eq 1 ] && break
+ done
+
+ if [ $found -ne 1 ] ; then
+ printf "FAIL: Didn't find the expected backtrace entry \"%s\"\n" "$pattern"
return 1
fi
done
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] perf test record+probe_libc_inet_pton: Make test resilient
2024-12-02 11:19 [PATCH v2] perf test record+probe_libc_inet_pton: Make test resilient Leo Yan
@ 2024-12-02 13:48 ` Thomas Richter
2024-12-02 20:28 ` Namhyung Kim
2025-01-07 16:51 ` James Clark
1 sibling, 1 reply; 6+ messages in thread
From: Thomas Richter @ 2024-12-02 13:48 UTC (permalink / raw)
To: Leo Yan, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
Liang, Kan, Athira Rajeev, linux-perf-users, linux-kernel
Cc: Jing Zhang, Guilherme Amadio
On 12/2/24 12:19, 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.
>
For s390 using 6.13.0.rc1
Tested-by: Thomas Richter <tmricht@linux.ibm.com>
--
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
--
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Wolfgang Wendt
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] perf test record+probe_libc_inet_pton: Make test resilient
2024-12-02 13:48 ` Thomas Richter
@ 2024-12-02 20:28 ` Namhyung Kim
2025-01-03 17:47 ` Leo Yan
0 siblings, 1 reply; 6+ messages in thread
From: Namhyung Kim @ 2024-12-02 20:28 UTC (permalink / raw)
To: Thomas Richter
Cc: Leo Yan, Arnaldo Carvalho de Melo, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
Liang, Kan, Athira Rajeev, linux-perf-users, linux-kernel,
Jing Zhang, Guilherme Amadio
Hello,
On Mon, Dec 02, 2024 at 02:48:01PM +0100, Thomas Richter wrote:
> On 12/2/24 12:19, 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.
> >
>
> For s390 using 6.13.0.rc1
>
> Tested-by: Thomas Richter <tmricht@linux.ibm.com>
Thanks for the test, but I think the patch excludes s390 to be safe.
And I think we can test s390 in the same way. If you're willing to do
some more tests, Leo can update the patch to include s390 as well.
Thanks,
Namhyung
>
> --
> Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
> --
> IBM Deutschland Research & Development GmbH
>
> Vorsitzender des Aufsichtsrats: Wolfgang Wendt
>
> Geschäftsführung: David Faller
>
> Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] perf test record+probe_libc_inet_pton: Make test resilient
2024-12-02 20:28 ` Namhyung Kim
@ 2025-01-03 17:47 ` Leo Yan
0 siblings, 0 replies; 6+ messages in thread
From: Leo Yan @ 2025-01-03 17:47 UTC (permalink / raw)
To: Namhyung Kim
Cc: Thomas Richter, Arnaldo Carvalho de Melo, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
Liang, Kan, Athira Rajeev, linux-perf-users, linux-kernel,
Jing Zhang, Guilherme Amadio
Hi all,
Happy new year!
On Mon, Dec 02, 2024 at 12:28:03PM -0800, Namhyung Kim wrote:
>
> Hello,
>
> On Mon, Dec 02, 2024 at 02:48:01PM +0100, Thomas Richter wrote:
> > On 12/2/24 12:19, 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.
> > >
> >
> > For s390 using 6.13.0.rc1
> >
> > Tested-by: Thomas Richter <tmricht@linux.ibm.com>
>
> Thanks for the test, but I think the patch excludes s390 to be safe.
> And I think we can test s390 in the same way. If you're willing to do
> some more tests, Leo can update the patch to include s390 as well.
This case continuously fails on Arm64, so let's not forget to land the
fix.
I agreed with Namhyung for consolidation the test as possible.
@Thomas, could you test on s390 for below change? And if you could
confirm the 'fp' mode for callgraph is supported on s390, then we even
can unify the event attribute:
eventattr='max-stack=4'
Thanks,
Leo
---8<---
From 71bb457c7b5370693081856e7804ebe62c214301 Mon Sep 17 00:00:00 2001
From: Leo Yan <leo.yan@arm.com>
Date: Mon, 2 Dec 2024 11:19:58 +0000
Subject: [PATCH] perf test record+probe_libc_inet_pton: Make test resilient
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@linux.alibaba.com>
Closes: https://lore.kernel.org/linux-perf-users/1728978807-81116-1-git-send-email-renyu.zj@linux.alibaba.com/
Reported-by: Guilherme Amadio <amadio@gentoo.org>
Closes: https://lore.kernel.org/linux-perf-users/Z0X3AYUWkAgfPpWj@x1/T/#m57327e135b156047e37d214a0d453af6ae1e02be
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
.../shell/record+probe_libc_inet_pton.sh | 39 ++++++++++---------
1 file changed, 20 insertions(+), 19 deletions(-)
diff --git a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
index 47a26f25db9f..326d924641e0 100755
--- a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
+++ b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
@@ -37,24 +37,14 @@ trace_libc_inet_pton_backtrace() {
echo "ping[][0-9 \.:]+$event_name: \([[:xdigit:]]+\)" > $expected
echo ".*inet_pton\+0x[[:xdigit:]]+[[:space:]]\($libc|inlined\)$" >> $expected
+ echo ".*(\+0x[[:xdigit:]]+|\[unknown\])[[:space:]]\(.*/bin/ping.*\)$" >> $expected
+
case "$(uname -m)" in
s390x)
eventattr='call-graph=dwarf,max-stack=4'
- echo "((__GI_)?getaddrinfo|text_to_binary_address)\+0x[[:xdigit:]]+[[:space:]]\($libc|inlined\)$" >> $expected
- echo "(gaih_inet|main)\+0x[[:xdigit:]]+[[:space:]]\(inlined|.*/bin/ping.*\)$" >> $expected
- ;;
- ppc64|ppc64le)
- eventattr='max-stack=4'
- # Add gaih_inet to expected backtrace only if it is part of libc.
- if nm $libc | grep -F -q gaih_inet.; then
- echo "gaih_inet.*\+0x[[:xdigit:]]+[[:space:]]\($libc\)$" >> $expected
- fi
- echo "getaddrinfo\+0x[[:xdigit:]]+[[:space:]]\($libc\)$" >> $expected
- echo ".*(\+0x[[:xdigit:]]+|\[unknown\])[[:space:]]\(.*/bin/ping.*\)$" >> $expected
;;
*)
- eventattr='max-stack=3'
- echo ".*(\+0x[[:xdigit:]]+|\[unknown\])[[:space:]]\(.*/bin/ping.*\)$" >> $expected
+ eventattr='max-stack=4'
;;
esac
@@ -76,14 +66,25 @@ trace_libc_inet_pton_backtrace() {
fi
perf script -i $perf_data | tac | grep -m1 ^ping -B9 | tac > $perf_script
- exec 3<$perf_script
exec 4<$expected
- while read line <&3 && read -r pattern <&4; do
+ while read -r pattern <&4; do
+ echo "Pattern: $pattern"
[ -z "$pattern" ] && break
- echo $line
- echo "$line" | grep -E -q "$pattern"
- if [ $? -ne 0 ] ; then
- printf "FAIL: expected backtrace entry \"%s\" got \"%s\"\n" "$pattern" "$line"
+
+ found=0
+
+ # Search lines in the perf script result
+ exec 3<$perf_script
+ while read line <&3; do
+ [ -z "$line" ] && break
+ echo " Matching: $line"
+ ! echo "$line" | grep -E -q "$pattern"
+ found=$?
+ [ $found -eq 1 ] && break
+ done
+
+ if [ $found -ne 1 ] ; then
+ printf "FAIL: Didn't find the expected backtrace entry \"%s\"\n" "$pattern"
return 1
fi
done
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] perf test record+probe_libc_inet_pton: Make test resilient
2024-12-02 11:19 [PATCH v2] perf test record+probe_libc_inet_pton: Make test resilient Leo Yan
2024-12-02 13:48 ` Thomas Richter
@ 2025-01-07 16:51 ` James Clark
2025-01-13 15:50 ` Arnaldo Carvalho de Melo
1 sibling, 1 reply; 6+ messages in thread
From: James Clark @ 2025-01-07 16:51 UTC (permalink / raw)
To: Leo Yan
Cc: Jing Zhang, Guilherme Amadio, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, Liang, Kan, Thomas Richter,
Athira Rajeev, linux-perf-users, linux-kernel
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@linux.alibaba.com>
> Closes: https://lore.kernel.org/linux-perf-users/1728978807-81116-1-git-send-email-renyu.zj@linux.alibaba.com/
> Reported-by: Guilherme Amadio <amadio@gentoo.org>
> Closes: https://lore.kernel.org/linux-perf-users/Z0X3AYUWkAgfPpWj@x1/T/#m57327e135b156047e37d214a0d453af6ae1e02be
> Signed-off-by: Leo Yan <leo.yan@arm.com>
> ---
> 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@linaro.org>
> diff --git a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
> index 47a26f25db9f..3fbc7a7409af 100755
> --- a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
> +++ b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
> @@ -43,17 +43,8 @@ trace_libc_inet_pton_backtrace() {
> echo "((__GI_)?getaddrinfo|text_to_binary_address)\+0x[[:xdigit:]]+[[:space:]]\($libc|inlined\)$" >> $expected
> echo "(gaih_inet|main)\+0x[[:xdigit:]]+[[:space:]]\(inlined|.*/bin/ping.*\)$" >> $expected
> ;;
> - ppc64|ppc64le)
> - eventattr='max-stack=4'
> - # Add gaih_inet to expected backtrace only if it is part of libc.
> - if nm $libc | grep -F -q gaih_inet.; then
> - echo "gaih_inet.*\+0x[[:xdigit:]]+[[:space:]]\($libc\)$" >> $expected
> - fi
> - echo "getaddrinfo\+0x[[:xdigit:]]+[[:space:]]\($libc\)$" >> $expected
> - echo ".*(\+0x[[:xdigit:]]+|\[unknown\])[[:space:]]\(.*/bin/ping.*\)$" >> $expected
> - ;;
> *)
> - eventattr='max-stack=3'
> + eventattr='max-stack=4'
> echo ".*(\+0x[[:xdigit:]]+|\[unknown\])[[:space:]]\(.*/bin/ping.*\)$" >> $expected
> ;;
> esac
> @@ -76,14 +67,25 @@ trace_libc_inet_pton_backtrace() {
> fi
> perf script -i $perf_data | tac | grep -m1 ^ping -B9 | tac > $perf_script
>
> - exec 3<$perf_script
> exec 4<$expected
> - while read line <&3 && read -r pattern <&4; do
> + while read -r pattern <&4; do
> + echo "Pattern: $pattern"
> [ -z "$pattern" ] && break
> - echo $line
> - echo "$line" | grep -E -q "$pattern"
> - if [ $? -ne 0 ] ; then
> - printf "FAIL: expected backtrace entry \"%s\" got \"%s\"\n" "$pattern" "$line"
> +
> + found=0
> +
> + # Search lines in the perf script result
> + exec 3<$perf_script
> + while read line <&3; do
> + [ -z "$line" ] && break
> + echo " Matching: $line"
> + ! echo "$line" | grep -E -q "$pattern"
> + found=$?
> + [ $found -eq 1 ] && break
> + done
> +
> + if [ $found -ne 1 ] ; then
> + printf "FAIL: Didn't find the expected backtrace entry \"%s\"\n" "$pattern"
> return 1
> fi
> done
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] perf test record+probe_libc_inet_pton: Make test resilient
2025-01-07 16:51 ` James Clark
@ 2025-01-13 15:50 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2025-01-13 15:50 UTC (permalink / raw)
To: James Clark
Cc: Leo Yan, Jing Zhang, Guilherme Amadio, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
Liang, Kan, Thomas Richter, Athira Rajeev, linux-perf-users,
linux-kernel
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@linux.alibaba.com>
> > Closes: https://lore.kernel.org/linux-perf-users/1728978807-81116-1-git-send-email-renyu.zj@linux.alibaba.com/
> > Reported-by: Guilherme Amadio <amadio@gentoo.org>
> > Closes: https://lore.kernel.org/linux-perf-users/Z0X3AYUWkAgfPpWj@x1/T/#m57327e135b156047e37d214a0d453af6ae1e02be
> > Signed-off-by: Leo Yan <leo.yan@arm.com>
> > ---
> > 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@linaro.org>
Thanks, applied to perf-tools-next,
- Arnaldo
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-01-13 15:50 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-02 11:19 [PATCH v2] perf test record+probe_libc_inet_pton: Make test resilient Leo Yan
2024-12-02 13:48 ` Thomas Richter
2024-12-02 20:28 ` Namhyung Kim
2025-01-03 17:47 ` Leo Yan
2025-01-07 16:51 ` James Clark
2025-01-13 15:50 ` Arnaldo Carvalho de Melo
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).