Rename the unwind_stacktrace structure to unwind_user_stacktrace to make
it consistent with the rest of the API.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Indu Bhagat <indu.bhagat@oracle.com>
Cc: "Jose E. Marchesi" <jemarch@gnu.org>
Cc: Beau Belgrave <beaub@linux.microsoft.com>
Cc: Jens Remus <jremus@linux.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/unwind_deferred.h | 10 +++++-----
include/linux/unwind_user.h | 2 +-
include/linux/unwind_user_types.h | 2 +-
kernel/unwind/deferred.c | 6 +++---
kernel/unwind/user.c | 2 +-
5 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/include/linux/unwind_deferred.h b/include/linux/unwind_deferred.h
index ddc985ba982a..62f1faf5f2b8 100644
--- a/include/linux/unwind_deferred.h
+++ b/include/linux/unwind_deferred.h
@@ -8,7 +8,7 @@
struct unwind_work;
-typedef void (*unwind_callback_t)(struct unwind_work *work, struct unwind_stacktrace *trace, u64 cookie);
+typedef void (*unwind_callback_t)(struct unwind_work *work, struct unwind_user_stacktrace *trace, u64 cookie);
struct unwind_work {
struct list_head list;
@@ -33,8 +33,8 @@ enum {
void unwind_task_init(struct task_struct *task);
void unwind_task_free(struct task_struct *task);
-int unwind_user_faultable(struct unwind_stacktrace *trace);
-int unwind_user_trace_cached(struct unwind_stacktrace *trace);
+int unwind_user_faultable(struct unwind_user_stacktrace *trace);
+int unwind_user_trace_cached(struct unwind_user_stacktrace *trace);
int unwind_deferred_init(struct unwind_work *work, unwind_callback_t func);
int unwind_deferred_request(struct unwind_work *work, u64 *cookie);
@@ -67,8 +67,8 @@ static __always_inline void unwind_reset_info(void)
static inline void unwind_task_init(struct task_struct *task) {}
static inline void unwind_task_free(struct task_struct *task) {}
-static inline int unwind_user_faultable(struct unwind_stacktrace *trace) { return -ENOSYS; }
-static inline int unwind_user_trace_cached(struct unwind_stacktrace *trace) { return -ENOSYS; }
+static inline int unwind_user_faultable(struct unwind_user_stacktrace *trace) { return -ENOSYS; }
+static inline int unwind_user_trace_cached(struct unwind_user_stacktrace *trace) { return -ENOSYS; }
static inline int unwind_deferred_init(struct unwind_work *work, unwind_callback_t func) { return -ENOSYS; }
static inline int unwind_deferred_request(struct unwind_work *work, u64 *timestamp) { return -ENOSYS; }
static inline void unwind_deferred_cancel(struct unwind_work *work) {}
diff --git a/include/linux/unwind_user.h b/include/linux/unwind_user.h
index 0308adb349fc..6022c77518f3 100644
--- a/include/linux/unwind_user.h
+++ b/include/linux/unwind_user.h
@@ -25,6 +25,6 @@ static inline void arch_unwind_user_init(struct unwind_user_state *state, struct
static inline void arch_unwind_user_next(struct unwind_user_state *state) {}
#endif
-int unwind_user(struct unwind_stacktrace *trace, unsigned int max_entries);
+int unwind_user(struct unwind_user_stacktrace *trace, unsigned int max_entries);
#endif /* _LINUX_UNWIND_USER_H */
diff --git a/include/linux/unwind_user_types.h b/include/linux/unwind_user_types.h
index fc440ae3a29b..860f84cd7998 100644
--- a/include/linux/unwind_user_types.h
+++ b/include/linux/unwind_user_types.h
@@ -28,7 +28,7 @@ enum unwind_user_type {
UNWIND_USER_TYPE_FP = (1U << UNWIND_USER_TYPE_FP_BIT),
};
-struct unwind_stacktrace {
+struct unwind_user_stacktrace {
unsigned int nr;
unsigned long *entries;
};
diff --git a/kernel/unwind/deferred.c b/kernel/unwind/deferred.c
index 02ab1d2afc21..4006d253c793 100644
--- a/kernel/unwind/deferred.c
+++ b/kernel/unwind/deferred.c
@@ -105,7 +105,7 @@ static u64 get_cookie(struct unwind_task_info *info)
* Return: 0 on success and negative on error
* On success @trace will contain the user space stacktrace
*/
-int unwind_user_faultable(struct unwind_stacktrace *trace)
+int unwind_user_faultable(struct unwind_user_stacktrace *trace)
{
struct unwind_task_info *info = ¤t->unwind_info;
struct unwind_cache *cache;
@@ -158,7 +158,7 @@ EXPORT_SYMBOL_GPL(unwind_user_faultable);
* Return: 0 on success and negative on error
* On success @trace will contain the user space stacktrace
*/
-int unwind_user_trace_cached(struct unwind_stacktrace *trace)
+int unwind_user_trace_cached(struct unwind_user_stacktrace *trace)
{
struct unwind_task_info *info = ¤t->unwind_info;
struct unwind_cache *cache;
@@ -180,7 +180,7 @@ EXPORT_SYMBOL_GPL(unwind_user_trace_cached);
static void process_unwind_deferred(struct task_struct *task)
{
struct unwind_task_info *info = &task->unwind_info;
- struct unwind_stacktrace trace;
+ struct unwind_user_stacktrace trace;
struct unwind_work *work;
unsigned long bits;
u64 cookie;
diff --git a/kernel/unwind/user.c b/kernel/unwind/user.c
index 9aefbfc8427a..dfe7bf50d8f6 100644
--- a/kernel/unwind/user.c
+++ b/kernel/unwind/user.c
@@ -167,7 +167,7 @@ static int unwind_user_start(struct unwind_user_state *state)
return 0;
}
-int unwind_user(struct unwind_stacktrace *trace, unsigned int max_entries)
+int unwind_user(struct unwind_user_stacktrace *trace, unsigned int max_entries)
{
struct unwind_user_state state;
--
2.43.0
On Wed, 9 Jul 2025 17:25:51 -0400
Mathieu Desnoyers <mathieu.desnoyers@efficios.com> wrote:
> Rename the unwind_stacktrace structure to unwind_user_stacktrace to make
> it consistent with the rest of the API.
We originally had that name, but decided it was too long. As only the
deferred unwind uses "unwind_" and it is currently only for user space, do
we really need to have a 22 character structure name? 17 is already big
enough.
And say we make an unwind_kernel_stacktrace()? I doubt we ever would, but
if we did, it would still use the same structure. There's nothing
inherently user space here (with maybe the exception of the compat type,
but still).
And how is this unique to user space? The kernel can have sframes too.
Actually, I think we should rename "enum unwind_user_type" to
"enum unwind_type".
struct unwind_entry {
enum unwind_type type;
unsigned long ip;
};
As it is only being used for user space now, but it doesn't mean it can't
be used for the kernel.
Heck, there's already work to use sframes in kernel code to replace ORC so
that architectures like ARM64 can have live kernel patching.
-- Steve
On Wed, 9 Jul 2025 17:41:39 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> On Wed, 9 Jul 2025 17:25:51 -0400
> Mathieu Desnoyers <mathieu.desnoyers@efficios.com> wrote:
>
> > Rename the unwind_stacktrace structure to unwind_user_stacktrace to make
> > it consistent with the rest of the API.
>
> We originally had that name, but decided it was too long. As only the
> deferred unwind uses "unwind_" and it is currently only for user space, do
> we really need to have a 22 character structure name? 17 is already big
> enough.
>
> And say we make an unwind_kernel_stacktrace()? I doubt we ever would, but
> if we did, it would still use the same structure. There's nothing
> inherently user space here (with maybe the exception of the compat type,
> but still).
>
> And how is this unique to user space? The kernel can have sframes too.
>
> Actually, I think we should rename "enum unwind_user_type" to
> "enum unwind_type".
>
> struct unwind_entry {
> enum unwind_type type;
> unsigned long ip;
> };
>
> As it is only being used for user space now, but it doesn't mean it can't
> be used for the kernel.
>
> Heck, there's already work to use sframes in kernel code to replace ORC so
> that architectures like ARM64 can have live kernel patching.
Actually, I'm going to leave everything as is. The "struct unwind_user_*"
is only used internally in the user code and is not part of the API of
the infrastructure. The "struct unwind_stackframe" is used in the API
as a parameter. To me, it makes more sense to keep it short than adding
"user" to it and making all the callbacks have a longer name.
I know your patch 5 exposes more, but we'll deal with that when the
time comes.
-- Steve
© 2016 - 2025 Red Hat, Inc.