Skip to contentSkip to conversation

unwind_user: Cleanups

PATCH Applied Jens Remus 3 participants 11 messages Dec 8, 2025 – Dec 17, 2025

Subsystems (4)
lore
Share & tools
lore

Jens Remus

author
#0 lore raw

v4 cover unwind_user: Cleanups

This patch series applies on top of Peter Zijlstras' latest unwind user enhancements (and perf deferred callchain support) on his tip perf/core branch:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core

Which has already been merged to tip/master and linux-next/master.

Patch 1 enhances a few comments in unwind_user_next_common().

Patch 2 gets rid of an ifdef in unwind_user_next_fp() by moving it to linux/unwind_user.h. Additionally it provides a common fallback for unwind_user_at_function_start().

Patch 3 ensures the x86 unwind_user_word_size() implementation is available whenever config option UNWIND_USER is enabled, as it is required by unwind user in general and is not specific to its FP unwind method.

Patch 4 (new in v4) simplifies unwind_user_word_size().

Regards,
Jens

Jens Remus (4):
unwind_user: Enhance comments on get CFA, FP, and RA unwind_user/fp: Use dummies instead of ifdef x86/unwind_user: Guard unwind_user_word_size() by UNWIND_USER x86/unwind_user: Simplify unwind_user_word_size()

 arch/x86/include/asm/unwind_user.h | 27 ++++++++++++++-------------
 include/linux/unwind_user.h        | 18 ++++++++++++++++--
 kernel/unwind/user.c               | 12 ++++--------
 3 files changed, 34 insertions(+), 23 deletions(-)
Signature · 1 line
2.51.0
author
#5 lore raw

PATCH v4 3/4 x86/unwind_user: Guard unwind_user_word_size() by UNWIND_USER

The unwind user framework in general requires an architecture-specific implementation of unwind_user_word_size() to be present for any unwind method, whether that is fp or a future other method, such as potentially sframe.

Guard unwind_user_word_size() by the availability of the UNWIND_USER framework instead of the specific HAVE_UNWIND_USER_FP method.

This facilitates to selectively disable HAVE_UNWIND_USER_FP on x86 (e.g. for test purposes) once a new unwind method is added to unwind user.

---

Notes (jremus):
Changes in v3:
- Move includes into more common UNWIND_USER guard at the top of the source. asm/ptrace.h is required for struct pt_regs.

 arch/x86/include/asm/unwind_user.h | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)
arch/x86/include/asm/unwind_user.h +17 -13
index 971ffe937d50..7f1229b33d06 100644
@@ -2,23 +2,11 @@
 #ifndef _ASM_X86_UNWIND_USER_H
 #define _ASM_X86_UNWIND_USER_H
 
-#ifdef CONFIG_HAVE_UNWIND_USER_FP
+#ifdef CONFIG_UNWIND_USER
 
 #include <asm/ptrace.h>
 #include <asm/uprobes.h>
 
-#define ARCH_INIT_USER_FP_FRAME(ws)			\
-	.cfa_off	=  2*(ws),			\
-	.ra_off		= -1*(ws),			\
-	.fp_off		= -2*(ws),			\
-	.use_fp		= true,
-
-#define ARCH_INIT_USER_FP_ENTRY_FRAME(ws)		\
-	.cfa_off	=  1*(ws),			\
-	.ra_off		= -1*(ws),			\
-	.fp_off		= 0,				\
-	.use_fp		= false,
-
 static inline int unwind_user_word_size(struct pt_regs *regs)
 {
 	/* We can't unwind VM86 stacks */
@@ -31,6 +19,22 @@ static inline int unwind_user_word_size(struct pt_regs *regs)
 	return sizeof(long);
 }
 
+#endif /* CONFIG_UNWIND_USER */
+
+#ifdef CONFIG_HAVE_UNWIND_USER_FP
+
+#define ARCH_INIT_USER_FP_FRAME(ws)			\
+	.cfa_off	=  2*(ws),			\
+	.ra_off		= -1*(ws),			\
+	.fp_off		= -2*(ws),			\
+	.use_fp		= true,
+
+#define ARCH_INIT_USER_FP_ENTRY_FRAME(ws)		\
+	.cfa_off	=  1*(ws),			\
+	.ra_off		= -1*(ws),			\
+	.fp_off		= 0,				\
+	.use_fp		= false,
+
 static inline bool unwind_user_at_function_start(struct pt_regs *regs)
 {
 	return is_uprobe_at_func_entry(regs);
Signature · 1 line
2.51.0
author
#3 lore raw

PATCH v4 2/4 unwind_user/fp: Use dummies instead of ifdef

In reply to Jens Remus

This simplifies the code. unwind_user_next_fp() does not need to
return -EINVAL if config option HAVE_UNWIND_USER_FP is disabled, as unwind_user_start() will then not select this unwind method and unwind_user_next() will therefore not call it.

Provide (1) a dummy definition of ARCH_INIT_USER_FP_FRAME, if the unwind user method HAVE_UNWIND_USER_FP is not enabled, (2) a common fallback definition of unwind_user_at_function_start() which returns false, and
(3) a common dummy definition of ARCH_INIT_USER_FP_ENTRY_FRAME.

Note that enabling the config option HAVE_UNWIND_USER_FP without defining ARCH_INIT_USER_FP_FRAME triggers a compile error, which is helpful when implementing support for this unwind user method in an architecture. Enabling the config option when providing an arch- specific unwind_user_at_function_start() definition makes it necessary to also provide an arch-specific ARCH_INIT_USER_FP_ENTRY_FRAME definition.

---

Notes (jremus):
Changes in v3:
- Remove comment on #endif. (Ingo)

Changes in v2:
- Add parameter ws to ARCH_INIT_USER_{FP_FRAME|FP_ENTRY_FRAME}.
- Provide common fallback of unwind_user_at_function_start().
- Provide common dummy of ARCH_INIT_USER_FP_ENTRY_FRAME.
- Reword commit message accordingly.

 arch/x86/include/asm/unwind_user.h |  1 +
 include/linux/unwind_user.h        | 18 ++++++++++++++++--
 kernel/unwind/user.c               |  4 ----
 3 files changed, 17 insertions(+), 6 deletions(-)
arch/x86/include/asm/unwind_user.h +1 -0
index 12064284bc4e..971ffe937d50 100644
@@ -35,6 +35,7 @@ static inline bool unwind_user_at_function_start(struct pt_regs *regs)
 {
 	return is_uprobe_at_func_entry(regs);
 }
+#define unwind_user_at_function_start unwind_user_at_function_start
 
 #endif /* CONFIG_HAVE_UNWIND_USER_FP */
 
include/linux/unwind_user.h +16 -2
index 7f7282516bf5..64618618febd 100644
@@ -5,8 +5,22 @@
 #include <linux/unwind_user_types.h>
 #include <asm/unwind_user.h>
 
-#ifndef ARCH_INIT_USER_FP_FRAME
- #define ARCH_INIT_USER_FP_FRAME
+#ifndef CONFIG_HAVE_UNWIND_USER_FP
+
+#define ARCH_INIT_USER_FP_FRAME(ws)
+
+#endif
+
+#ifndef ARCH_INIT_USER_FP_ENTRY_FRAME
+#define ARCH_INIT_USER_FP_ENTRY_FRAME(ws)
+#endif
+
+#ifndef unwind_user_at_function_start
+static inline bool unwind_user_at_function_start(struct pt_regs *regs)
+{
+	return false;
+}
+#define unwind_user_at_function_start unwind_user_at_function_start
 #endif
 
 int unwind_user(struct unwind_stacktrace *trace, unsigned int max_entries);
kernel/unwind/user.c +0 -4
index 0ca434f86e73..90ab3c1a205e 100644
@@ -67,7 +67,6 @@ static int unwind_user_next_common(struct unwind_user_state *state,
 
 static int unwind_user_next_fp(struct unwind_user_state *state)
 {
-#ifdef CONFIG_HAVE_UNWIND_USER_FP
 	struct pt_regs *regs = task_pt_regs(current);
 
 	if (state->topmost && unwind_user_at_function_start(regs)) {
@@ -81,9 +80,6 @@ static int unwind_user_next_fp(struct unwind_user_state *state)
 		ARCH_INIT_USER_FP_FRAME(state->ws)
 	};
 	return unwind_user_next_common(state, &fp_frame);
-#else
-	return -EINVAL;
-#endif
 }
 
 static int unwind_user_next(struct unwind_user_state *state)
Signature · 1 line
2.51.0
author
#7 lore raw

PATCH v4 4/4 x86/unwind_user: Simplify unwind_user_word_size()

In reply to Jens Remus

Get rid of superfluous ifdef and return explicit word size depending on 32-bit or 64-bit mode.

---

Notes (jremus):
Changes in v4:
- New patch. (Linus)
https://lore.kernel.org/all/CAHk-=wh4_BPvniQZqvEQ4cCC3WfvQqruWk0b1Yek+0d5S1LuxQ@mail.gmail.com/

This aligns to sizeof_long() in arch/x86/kernel/uprobes.c.

 arch/x86/include/asm/unwind_user.h | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
arch/x86/include/asm/unwind_user.h +1 -5
index 7f1229b33d06..6e469044e4de 100644
@@ -12,11 +12,7 @@ static inline int unwind_user_word_size(struct pt_regs *regs)
 	/* We can't unwind VM86 stacks */
 	if (regs->flags & X86_VM_MASK)
 		return 0;
-#ifdef CONFIG_X86_64
-	if (!user_64bit_mode(regs))
-		return sizeof(int);
-#endif
-	return sizeof(long);
+	return user_64bit_mode(regs) ? 8 : 4;
 }
 
 #endif /* CONFIG_UNWIND_USER */
Signature · 1 line
2.51.0
author
#1 lore raw

PATCH v4 1/4 unwind_user: Enhance comments on get CFA, FP, and RA

In reply to Jens Remus

Move the comment "Get the Canonical Frame Address (CFA)" to the top of the sequence of statements that actually get the CFA. Reword the comment "Find the Return Address (RA)" to "Get ...", as the statements actually get the RA. Add a respective comment to the statements that get the FP. This will be useful once future commits extend the logic to get the RA and FP.

While at it align the comment on the "stack going in wrong direction" check to the following one on the "address is word aligned" check.

---
 kernel/unwind/user.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/unwind/user.c +4 -4
index 39e270789444..0ca434f86e73 100644
@@ -31,6 +31,7 @@ static int unwind_user_next_common(struct unwind_user_state *state,
 {
 	unsigned long cfa, fp, ra;
 
+	/* Get the Canonical Frame Address (CFA) */
 	if (frame->use_fp) {
 		if (state->fp < state->sp)
 			return -EINVAL;
@@ -38,11 +39,9 @@ static int unwind_user_next_common(struct unwind_user_state *state,
 	} else {
 		cfa = state->sp;
 	}
-
-	/* Get the Canonical Frame Address (CFA) */
 	cfa += frame->cfa_off;
 
-	/* stack going in wrong direction? */
+	/* Make sure that stack is not going in wrong direction */
 	if (cfa <= state->sp)
 		return -EINVAL;
 
@@ -50,10 +49,11 @@ static int unwind_user_next_common(struct unwind_user_state *state,
 	if (cfa & (state->ws - 1))
 		return -EINVAL;
 
-	/* Find the Return Address (RA) */
+	/* Get the Return Address (RA) */
 	if (get_user_word(&ra, cfa, frame->ra_off, state->ws))
 		return -EINVAL;
 
+	/* Get the Frame Pointer (FP) */
 	if (frame->fp_off && get_user_word(&fp, cfa, frame->fp_off, state->ws))
 		return -EINVAL;
 
Signature · 1 line
2.51.0
maintainer
#9 lore raw
In reply to Jens Remus
Quoted 7 lines · Jens Remus

This patch series applies on top of Peter Zijlstras' latest unwind user enhancements (and perf deferred callchain support) on his tip perf/core branch:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core

Which has already been merged to tip/master and linux-next/master.

Right, that should be empty now :-)

Quoted 10 lines

Jens Remus (4):
unwind_user: Enhance comments on get CFA, FP, and RA unwind_user/fp: Use dummies instead of ifdef x86/unwind_user: Guard unwind_user_word_size() by UNWIND_USER x86/unwind_user: Simplify unwind_user_word_size()

 arch/x86/include/asm/unwind_user.h | 27 ++++++++++++++-------------
 include/linux/unwind_user.h        | 18 ++++++++++++++++--
 kernel/unwind/user.c               | 12 ++++--------
 3 files changed, 34 insertions(+), 23 deletions(-)

I'll go stick these patches in tip/perf/core after rc1 or so, no real hurry with these, right?

author
#10 lore raw

Hello Peter!

Quoted 8 lines · Peter Zijlstra
Quoted 6 lines · Jens Remus

Jens Remus (4):
unwind_user: Enhance comments on get CFA, FP, and RA unwind_user/fp: Use dummies instead of ifdef x86/unwind_user: Guard unwind_user_word_size() by UNWIND_USER x86/unwind_user: Simplify unwind_user_word_size()

Quoted 7 lines
Quoted 4 lines
 arch/x86/include/asm/unwind_user.h | 27 ++++++++++++++-------------
 include/linux/unwind_user.h        | 18 ++++++++++++++++--
 kernel/unwind/user.c               | 12 ++++--------
 3 files changed, 34 insertions(+), 23 deletions(-)

I'll go stick these patches in tip/perf/core after rc1 or so, no real hurry with these, right?

Perfect, that is fine with me.

Thanks and regards,
Jens

Signature · 9 lines
Jens Remus
Linux on Z Development (D3303)
+49-7031-16-1128 Office
[email protected]

IBM

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
IBM Data Privacy Statement: https://www.ibm.com/privacy/
merge bot Applied
#8 lore raw

[tip: perf/core] x86/unwind_user: Simplify unwind_user_word_size()

In reply to Jens Remus
The following commit has been merged into the perf/core branch of tip:

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     3c48808408af11d6f173c65eee9bd5ca4c53667c
Gitweb:        https://git.kernel.org/tip/3c48808408af11d6f173c65eee9bd5ca4c53667c
Author:        Jens Remus <[email protected]>
AuthorDate:    Mon, 08 Dec 2025 17:03:52 +01:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Wed, 17 Dec 2025 13:31:08 +01:00

x86/unwind_user: Simplify unwind_user_word_size()

Get rid of superfluous ifdef and return explicit word size depending on 32-bit or 64-bit mode.

---
 arch/x86/include/asm/unwind_user.h | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
arch/x86/include/asm/unwind_user.h +1 -5
index 7f1229b..6e46904 100644
@@ -12,11 +12,7 @@ static inline int unwind_user_word_size(struct pt_regs *regs)
 	/* We can't unwind VM86 stacks */
 	if (regs->flags & X86_VM_MASK)
 		return 0;
-#ifdef CONFIG_X86_64
-	if (!user_64bit_mode(regs))
-		return sizeof(int);
-#endif
-	return sizeof(long);
+	return user_64bit_mode(regs) ? 8 : 4;
 }
 
 #endif /* CONFIG_UNWIND_USER */
merge bot Applied
#4 lore raw

[tip: perf/core] unwind_user/fp: Use dummies instead of ifdef

In reply to Jens Remus
The following commit has been merged into the perf/core branch of tip:

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     2652f9a4b019e34fbbde8dcd1396f1f00ec4844f
Gitweb:        https://git.kernel.org/tip/2652f9a4b019e34fbbde8dcd1396f1f00ec4844f
Author:        Jens Remus <[email protected]>
AuthorDate:    Mon, 08 Dec 2025 17:03:50 +01:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Wed, 17 Dec 2025 13:31:07 +01:00

unwind_user/fp: Use dummies instead of ifdef

This simplifies the code. unwind_user_next_fp() does not need to
return -EINVAL if config option HAVE_UNWIND_USER_FP is disabled, as unwind_user_start() will then not select this unwind method and unwind_user_next() will therefore not call it.

Provide (1) a dummy definition of ARCH_INIT_USER_FP_FRAME, if the unwind user method HAVE_UNWIND_USER_FP is not enabled, (2) a common fallback definition of unwind_user_at_function_start() which returns false, and
(3) a common dummy definition of ARCH_INIT_USER_FP_ENTRY_FRAME.

Note that enabling the config option HAVE_UNWIND_USER_FP without defining ARCH_INIT_USER_FP_FRAME triggers a compile error, which is helpful when implementing support for this unwind user method in an architecture. Enabling the config option when providing an arch- specific unwind_user_at_function_start() definition makes it necessary to also provide an arch-specific ARCH_INIT_USER_FP_ENTRY_FRAME definition.

---
 arch/x86/include/asm/unwind_user.h |  1 +
 include/linux/unwind_user.h        | 18 ++++++++++++++++--
 kernel/unwind/user.c               |  4 ----
 3 files changed, 17 insertions(+), 6 deletions(-)
arch/x86/include/asm/unwind_user.h +1 -0
index 1206428..971ffe9 100644
@@ -35,6 +35,7 @@ static inline bool unwind_user_at_function_start(struct pt_regs *regs)
 {
 	return is_uprobe_at_func_entry(regs);
 }
+#define unwind_user_at_function_start unwind_user_at_function_start
 
 #endif /* CONFIG_HAVE_UNWIND_USER_FP */
 
include/linux/unwind_user.h +16 -2
index 7f72825..6461861 100644
@@ -5,8 +5,22 @@
 #include <linux/unwind_user_types.h>
 #include <asm/unwind_user.h>
 
-#ifndef ARCH_INIT_USER_FP_FRAME
- #define ARCH_INIT_USER_FP_FRAME
+#ifndef CONFIG_HAVE_UNWIND_USER_FP
+
+#define ARCH_INIT_USER_FP_FRAME(ws)
+
+#endif
+
+#ifndef ARCH_INIT_USER_FP_ENTRY_FRAME
+#define ARCH_INIT_USER_FP_ENTRY_FRAME(ws)
+#endif
+
+#ifndef unwind_user_at_function_start
+static inline bool unwind_user_at_function_start(struct pt_regs *regs)
+{
+	return false;
+}
+#define unwind_user_at_function_start unwind_user_at_function_start
 #endif
 
 int unwind_user(struct unwind_stacktrace *trace, unsigned int max_entries);
kernel/unwind/user.c +0 -4
index 0ca434f..90ab3c1 100644
@@ -67,7 +67,6 @@ static int unwind_user_next_common(struct unwind_user_state *state,
 
 static int unwind_user_next_fp(struct unwind_user_state *state)
 {
-#ifdef CONFIG_HAVE_UNWIND_USER_FP
 	struct pt_regs *regs = task_pt_regs(current);
 
 	if (state->topmost && unwind_user_at_function_start(regs)) {
@@ -81,9 +80,6 @@ static int unwind_user_next_fp(struct unwind_user_state *state)
 		ARCH_INIT_USER_FP_FRAME(state->ws)
 	};
 	return unwind_user_next_common(state, &fp_frame);
-#else
-	return -EINVAL;
-#endif
 }
 
 static int unwind_user_next(struct unwind_user_state *state)
merge bot Applied
#6 lore raw

[tip: perf/core] x86/unwind_user: Guard unwind_user_word_size() by UNWIND_USER

In reply to Jens Remus
The following commit has been merged into the perf/core branch of tip:

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     aa6047ef7204ea1faa346b9123439abed0546f7e
Gitweb:        https://git.kernel.org/tip/aa6047ef7204ea1faa346b9123439abed0546f7e
Author:        Jens Remus <[email protected]>
AuthorDate:    Mon, 08 Dec 2025 17:03:51 +01:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Wed, 17 Dec 2025 13:31:08 +01:00

x86/unwind_user: Guard unwind_user_word_size() by UNWIND_USER

The unwind user framework in general requires an architecture-specific implementation of unwind_user_word_size() to be present for any unwind method, whether that is fp or a future other method, such as potentially sframe.

Guard unwind_user_word_size() by the availability of the UNWIND_USER framework instead of the specific HAVE_UNWIND_USER_FP method.

This facilitates to selectively disable HAVE_UNWIND_USER_FP on x86 (e.g. for test purposes) once a new unwind method is added to unwind user.

---
 arch/x86/include/asm/unwind_user.h | 30 ++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)
arch/x86/include/asm/unwind_user.h +17 -13
index 971ffe9..7f1229b 100644
@@ -2,23 +2,11 @@
 #ifndef _ASM_X86_UNWIND_USER_H
 #define _ASM_X86_UNWIND_USER_H
 
-#ifdef CONFIG_HAVE_UNWIND_USER_FP
+#ifdef CONFIG_UNWIND_USER
 
 #include <asm/ptrace.h>
 #include <asm/uprobes.h>
 
-#define ARCH_INIT_USER_FP_FRAME(ws)			\
-	.cfa_off	=  2*(ws),			\
-	.ra_off		= -1*(ws),			\
-	.fp_off		= -2*(ws),			\
-	.use_fp		= true,
-
-#define ARCH_INIT_USER_FP_ENTRY_FRAME(ws)		\
-	.cfa_off	=  1*(ws),			\
-	.ra_off		= -1*(ws),			\
-	.fp_off		= 0,				\
-	.use_fp		= false,
-
 static inline int unwind_user_word_size(struct pt_regs *regs)
 {
 	/* We can't unwind VM86 stacks */
@@ -31,6 +19,22 @@ static inline int unwind_user_word_size(struct pt_regs *regs)
 	return sizeof(long);
 }
 
+#endif /* CONFIG_UNWIND_USER */
+
+#ifdef CONFIG_HAVE_UNWIND_USER_FP
+
+#define ARCH_INIT_USER_FP_FRAME(ws)			\
+	.cfa_off	=  2*(ws),			\
+	.ra_off		= -1*(ws),			\
+	.fp_off		= -2*(ws),			\
+	.use_fp		= true,
+
+#define ARCH_INIT_USER_FP_ENTRY_FRAME(ws)		\
+	.cfa_off	=  1*(ws),			\
+	.ra_off		= -1*(ws),			\
+	.fp_off		= 0,				\
+	.use_fp		= false,
+
 static inline bool unwind_user_at_function_start(struct pt_regs *regs)
 {
 	return is_uprobe_at_func_entry(regs);
merge bot Applied
#2 lore raw

[tip: perf/core] unwind_user: Enhance comments on get CFA, FP, and RA

In reply to Jens Remus
The following commit has been merged into the perf/core branch of tip:

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     2d6ad925fb2386f3ee1d26f5022f7ea71bbc1541
Gitweb:        https://git.kernel.org/tip/2d6ad925fb2386f3ee1d26f5022f7ea71bbc1541
Author:        Jens Remus <[email protected]>
AuthorDate:    Mon, 08 Dec 2025 17:03:49 +01:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Wed, 17 Dec 2025 13:31:07 +01:00

unwind_user: Enhance comments on get CFA, FP, and RA

Move the comment "Get the Canonical Frame Address (CFA)" to the top of the sequence of statements that actually get the CFA. Reword the comment "Find the Return Address (RA)" to "Get ...", as the statements actually get the RA. Add a respective comment to the statements that get the FP. This will be useful once future commits extend the logic to get the RA and FP.

While at it align the comment on the "stack going in wrong direction" check to the following one on the "address is word aligned" check.

---
 kernel/unwind/user.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/unwind/user.c +4 -4
index 39e2707..0ca434f 100644
@@ -31,6 +31,7 @@ static int unwind_user_next_common(struct unwind_user_state *state,
 {
 	unsigned long cfa, fp, ra;
 
+	/* Get the Canonical Frame Address (CFA) */
 	if (frame->use_fp) {
 		if (state->fp < state->sp)
 			return -EINVAL;
@@ -38,11 +39,9 @@ static int unwind_user_next_common(struct unwind_user_state *state,
 	} else {
 		cfa = state->sp;
 	}
-
-	/* Get the Canonical Frame Address (CFA) */
 	cfa += frame->cfa_off;
 
-	/* stack going in wrong direction? */
+	/* Make sure that stack is not going in wrong direction */
 	if (cfa <= state->sp)
 		return -EINVAL;
 
@@ -50,10 +49,11 @@ static int unwind_user_next_common(struct unwind_user_state *state,
 	if (cfa & (state->ws - 1))
 		return -EINVAL;
 
-	/* Find the Return Address (RA) */
+	/* Get the Return Address (RA) */
 	if (get_user_word(&ra, cfa, frame->ra_off, state->ws))
 		return -EINVAL;
 
+	/* Get the Frame Pointer (FP) */
 	if (frame->fp_off && get_user_word(&fp, cfa, frame->fp_off, state->ws))
 		return -EINVAL;