[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251024134415.GD3245006@noisy.programming.kicks-ass.net>
Date: Fri, 24 Oct 2025 15:44:15 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Jens Remus <jremus@...ux.ibm.com>
Cc: linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
bpf@...r.kernel.org, x86@...nel.org, linux-mm@...ck.org,
Steven Rostedt <rostedt@...nel.org>,
Josh Poimboeuf <jpoimboe@...nel.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Ingo Molnar <mingo@...nel.org>, Jiri Olsa <jolsa@...nel.org>,
Arnaldo Carvalho de Melo <acme@...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>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Florian Weimer <fweimer@...hat.com>, Kees Cook <kees@...nel.org>,
Carlos O'Donell <codonell@...hat.com>, Sam James <sam@...too.org>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
David Hildenbrand <david@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Michal Hocko <mhocko@...e.com>, Mike Rapoport <rppt@...nel.org>,
Suren Baghdasaryan <surenb@...gle.com>,
Vlastimil Babka <vbabka@...e.cz>,
Heiko Carstens <hca@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
"Steven Rostedt (Google)" <rostedt@...dmis.org>
Subject: Re: [PATCH v11 08/15] unwind_user/sframe: Wire up unwind_user to
sframe
On Wed, Oct 22, 2025 at 04:43:19PM +0200, Jens Remus wrote:
> @@ -26,12 +27,10 @@ get_user_word(unsigned long *word, unsigned long base, int off, unsigned int ws)
> return get_user(*word, addr);
> }
>
> -static int unwind_user_next_fp(struct unwind_user_state *state)
> +static int unwind_user_next_common(struct unwind_user_state *state,
> + const struct unwind_user_frame *frame,
> + struct pt_regs *regs)
> {
What is pt_regs for? AFAICT it isn't actually used in any of the
following patches.
> - const struct unwind_user_frame fp_frame = {
> - ARCH_INIT_USER_FP_FRAME(state->ws)
> - };
> - const struct unwind_user_frame *frame = &fp_frame;
> unsigned long cfa, fp, ra;
>
> if (frame->use_fp) {
> @@ -67,6 +66,26 @@ static int unwind_user_next_fp(struct unwind_user_state *state)
> return 0;
> }
>
> +static int unwind_user_next_sframe(struct unwind_user_state *state)
> +{
> + struct unwind_user_frame _frame, *frame;
> +
> + /* sframe expects the frame to be local storage */
> + frame = &_frame;
> + if (sframe_find(state->ip, frame))
> + return -ENOENT;
> + return unwind_user_next_common(state, frame, task_pt_regs(current));
> +}
Would it not be simpler to write:
static int unwind_user_next_sframe(struct unwind_user_state *state)
{
struct unwind_user_frame frame;
/* sframe expects the frame to be local storage */
if (sframe_find(state->ip, &frame))
return -ENOENT;
return unwind_user_next_common(state, &frame, task_pt_regs(current));
}
hmm?
> +static int unwind_user_next_fp(struct unwind_user_state *state)
> +{
> + const struct unwind_user_frame fp_frame = {
> + ARCH_INIT_USER_FP_FRAME(state->ws)
> + };
> +
> + return unwind_user_next_common(state, &fp_frame, task_pt_regs(current));
> +}
> +
> static int unwind_user_next(struct unwind_user_state *state)
> {
> unsigned long iter_mask = state->available_types;
> @@ -80,6 +99,16 @@ static int unwind_user_next(struct unwind_user_state *state)
>
> state->current_type = type;
> switch (type) {
> + case UNWIND_USER_TYPE_SFRAME:
> + switch (unwind_user_next_sframe(state)) {
> + case 0:
> + return 0;
> + case -ENOENT:
> + continue; /* Try next method. */
> + default:
> + state->done = true;
> + }
> + break;
Should it remove SFRAME from state->available_types at this point?
Powered by blists - more mailing lists