[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250708161124.23d775f4@gandalf.local.home>
Date: Tue, 8 Jul 2025 16:11:24 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: Steven Rostedt <rostedt@...nel.org>, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org, bpf@...r.kernel.org, x86@...nel.org,
Masami Hiramatsu <mhiramat@...nel.org>, Josh Poimboeuf
<jpoimboe@...nel.org>, Peter Zijlstra <peterz@...radead.org>, Ingo Molnar
<mingo@...nel.org>, Jiri Olsa <jolsa@...nel.org>, Namhyung Kim
<namhyung@...nel.org>, Thomas Gleixner <tglx@...utronix.de>, Andrii
Nakryiko <andrii@...nel.org>, Indu Bhagat <indu.bhagat@...cle.com>, "Jose
E. Marchesi" <jemarch@....org>, Beau Belgrave <beaub@...ux.microsoft.com>,
Jens Remus <jremus@...ux.ibm.com>, Linus Torvalds
<torvalds@...ux-foundation.org>, Andrew Morton <akpm@...ux-foundation.org>,
Jens Axboe <axboe@...nel.dk>, Florian Weimer <fweimer@...hat.com>, Sam
James <sam@...too.org>
Subject: Re: [PATCH v8 06/12] unwind_user/sframe: Wire up unwind_user to
sframe
On Tue, 8 Jul 2025 15:58:56 -0400
Mathieu Desnoyers <mathieu.desnoyers@...icios.com> wrote:
> > @@ -111,6 +128,8 @@ static int unwind_user_start(struct unwind_user_state *state)
> >
> > if (IS_ENABLED(CONFIG_HAVE_UNWIND_USER_COMPAT_FP) && in_compat_mode(regs))
> > state->type = UNWIND_USER_TYPE_COMPAT_FP;
> > + else if (current_has_sframe())
> > + state->type = UNWIND_USER_TYPE_SFRAME;
>
> I think you'll want to update the state->type during the
> traversal (in next()), because depending on whether
> sframe is available for a given memory area of code
> or not, the next() function can use either frame pointers
> or sframe during the same traversal. It would be good
> to know which is used after each specific call to next().
From my understanding this sets up what is available for the task at the
beginning.
So once we say "this task has sframes" it will try to use it every time. In
next we have:
if (compat_fp_state(state)) {
frame = &compat_fp_frame;
} else if (sframe_state(state)) {
/* sframe expects the frame to be local storage */
frame = &_frame;
if (sframe_find(state->ip, frame)) {
if (!IS_ENABLED(CONFIG_HAVE_UNWIND_USER_FP))
goto done;
frame = &fp_frame;
}
} else if (fp_state(state)) {
frame = &fp_frame;
} else {
goto done;
}
Where if sframe_find() fails and we switch over to frame pointers, if frame
pointers works, we can continue. But the next iteration, where the frame
pointer finds the previous ip, that ip may be in the sframe section again.
I've seen this work with my trace_printk()s. A function from code that is
running sframes calls into a library function that has frame pointers. The
walk walks through the frame pointers in the library, and when it hits the
code that has sframes, it starts using that again.
If we switched the state to just FP, it will never try to use sframes.
So this state is more about "what does this task have" than what was used
per iteration.
-- Steve
Powered by blists - more mailing lists