[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250801125350.9905B20-hca@linux.ibm.com>
Date: Fri, 1 Aug 2025 14:53:50 +0200
From: Heiko Carstens <hca@...ux.ibm.com>
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,
Steven Rostedt <rostedt@...nel.org>, Vasily Gorbik <gor@...ux.ibm.com>,
Ilya Leoshkevich <iii@...ux.ibm.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
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>,
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: [RFC PATCH v1 11/16] s390/unwind_user/sframe: Enable
HAVE_UNWIND_USER_SFRAME
On Thu, Jul 10, 2025 at 06:35:17PM +0200, Jens Remus wrote:
> Add s390 support for unwinding of user space using SFrame. This
> leverages the previous commits to address the following s390
> particularities:
>
> - The CFA is defined as the value of the stack pointer (SP) at call
> site in the previous frame + 160. Therefore the SP unwinds as
> SP = CFA - 160. Therefore use a SP value offset from CFA of -160.
>
> - The return address (RA) is not saved on the stack at function entry.
> It is also not saved in the function prologue, when in leaf functions.
> Therefore the RA does not necessarily need to be unwound in the first
> unwinding step for the topmost frame.
>
> - The frame pointer (FP) and/or return address (RA) may be saved in
> other registers when in leaf functions. GCC effectively uses
> floating-point registers (FPR) for this purpose. Therefore DWARF
> register numbers may be encoded in the SFrame FP/RA offsets.
...
> +static inline void __s390_get_dwarf_fpr(unsigned long *val, int regnum)
> +{
> + switch (regnum) {
> + case 16:
> + fpu_std(0, (freg_t *)val);
> + break;
...
> +static inline int s390_unwind_user_get_reg(unsigned long *val, int regnum)
> +{
> + if (0 <= regnum && regnum <= 15) {
> + struct pt_regs *regs = task_pt_regs(current);
> + *val = regs->gprs[regnum];
> + } else if (16 <= regnum && regnum <= 31) {
> + __s390_get_dwarf_fpr(val, regnum);
This won't work with other potential in-kernel fpu users. User space fpr
contents may have been written to the current task's fpu save area and fprs
may have been clobbered by in-kernel users; so you need to get register
contents from the correct location. See arch/s390/include/asm/fpu.h.
Powered by blists - more mailing lists