From: eugene.loh@oracle.com
To: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: [PATCH 2/2] test: Account for pid:::entry ustack() being correct
Date: Sat, 8 Feb 2025 18:21:06 -0500 [thread overview]
Message-ID: <20250208232106.27146-2-eugene.loh@oracle.com> (raw)
In-Reply-To: <20250208232106.27146-1-eugene.loh@oracle.com>
From: Eugene Loh <eugene.loh@oracle.com>
The pid:::entry uprobe fires so early in the function preamble
that the frame pointer is not yet set and the caller is not (yet)
correctly identified. In Linux 6.11, x86-specific heuristics
address this problem.
Post process results from this test to accommodate both cases --
missing caller and not missing caller.
Orabug: 37459289
Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
---
test/unittest/ustack/tst.ustack25_pid.r | 1 +
test/unittest/ustack/tst.ustack25_pid.r.p | 37 +++++++++++++++++++++++
2 files changed, 38 insertions(+)
create mode 100755 test/unittest/ustack/tst.ustack25_pid.r.p
diff --git a/test/unittest/ustack/tst.ustack25_pid.r b/test/unittest/ustack/tst.ustack25_pid.r
index 89b35c028..e7732fb81 100644
--- a/test/unittest/ustack/tst.ustack25_pid.r
+++ b/test/unittest/ustack/tst.ustack25_pid.r
@@ -1,5 +1,6 @@
ustack-tst-basic`myfunc_z
+ ustack-tst-basic`myfunc_y+{ptr}
ustack-tst-basic`myfunc_x+{ptr}
ustack-tst-basic`myfunc_w+{ptr}
ustack-tst-basic`myfunc_v+{ptr}
diff --git a/test/unittest/ustack/tst.ustack25_pid.r.p b/test/unittest/ustack/tst.ustack25_pid.r.p
new file mode 100755
index 000000000..6486f7ec6
--- /dev/null
+++ b/test/unittest/ustack/tst.ustack25_pid.r.p
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# A pid entry probe places a uprobe on the first instruction of a function.
+# Unfortunately, this is so early in the function preamble that the function
+# frame pointer has not yet been established and the actual caller of the
+# traced function is missed.
+#
+# In Linux 6.11, x86-specific heuristics are introduced to fix this problem.
+# See commit cfa7f3d
+# ("perf,x86: avoid missing caller address in stack traces captured in uprobe")
+# for both a description of the problem and an explanation of the heuristics.
+#
+# Add post processing to these test results to allow for both cases:
+# caller frame is missing or not missing.
+
+missing_caller=1
+if [ $(uname -m) == "x86_64" ]; then
+ read MAJOR MINOR <<< `uname -r | grep -Eo '^[0-9]+\.[0-9]+' | tr '.' ' '`
+
+ if [ $MAJOR -ge 6 ]; then
+ if [ $MAJOR -gt 6 -o $MINOR -ge 11 ]; then
+ missing_caller=0
+ fi
+ fi
+fi
+
+if [ $missing_caller -eq 1 ]; then
+ # Add the missing caller function after the current function.
+ awk '{ print }
+ /myfunc_z/ { print " ustack-tst-basic`myfunc_y+{ptr}" }'
+else
+ # The .r results file has an extra frame at the end in case
+ # the caller frame is missing and the 25-frame limit goes
+ # "too far." If the caller is not missing, fake that extra frame.
+ awk '{ print }
+ /myfunc_b/ { print " ustack-tst-basic`myfunc_a+{ptr}" }'
+fi
--
2.43.5
next prev parent reply other threads:[~2025-02-08 23:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-08 23:21 [PATCH 1/2] test: Allow more variations in expected fbt kernel stacks eugene.loh
2025-02-08 23:21 ` eugene.loh [this message]
2025-02-28 16:00 ` [PATCH 2/2] test: Account for pid:::entry ustack() being correct Kris Van Hees
2025-02-28 15:47 ` [PATCH 1/2] test: Allow more variations in expected fbt kernel stacks Kris Van Hees
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=20250208232106.27146-2-eugene.loh@oracle.com \
--to=eugene.loh@oracle.com \
--cc=dtrace-devel@oss.oracle.com \
--cc=dtrace@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.