Skip to contentSkip to conversation

docs/arch: remove deprecated function name

PATCH Superseded Jiayuan Chen 3 participants 6 messages Jan 14, 2025 – Feb 6, 2025

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docs/arch: remove deprecated function name

The dumpstack.c file has undergone many modifications, and the print_context_stack() function was removed or rewritten a long time ago, so it's better to remove the incorrect guidance. Additionally, no new functions will be added to the documentation, as it may be modified again in the future. Using 'question mark' and 'dumpstack' is sufficient to index this document.

---
 Documentation/arch/x86/kernel-stacks.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/arch/x86/kernel-stacks.rst +1 -1
index 738671a4070b..2d355e78008e 100644
@@ -113,7 +113,7 @@ Printing backtraces on x86
 
 The question about the '?' preceding function names in an x86 stacktrace
 keeps popping up, here's an indepth explanation. It helps if the reader
-stares at print_context_stack() and the whole machinery in and around
+stares at 'question mark' and the whole machinery in and around
 arch/x86/kernel/dumpstack.c.
 
 Adapted from Ingo's mail, Message-ID: <[email protected]>:
Signature · 1 line
2.43.5
maintainer
#1 lore raw
Quoted 17 lines · Jiayuan Chen

The dumpstack.c file has undergone many modifications, and the print_context_stack() function was removed or rewritten a long time ago, so it's better to remove the incorrect guidance. Additionally, no new functions will be added to the documentation, as it may be modified again in the future. Using 'question mark' and 'dumpstack' is sufficient to index this document.

---
 Documentation/arch/x86/kernel-stacks.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/arch/x86/kernel-stacks.rst +0 -0
index 738671a4070b..2d355e78008e 100644

Documentation/arch/x86/kernel-stacks.rst Printing backtraces on x86 · line 117

Quoted 6 lines
Documentation/arch/x86/kernel-stacks.rst +1 -1
@@ -113,7 +113,7 @@ Printing backtraces on x86
 
 The question about the '?' preceding function names in an x86 stacktrace
 keeps popping up, here's an indepth explanation. It helps if the reader
-stares at print_context_stack() and the whole machinery in and around
+stares at 'question mark' and the whole machinery in and around
 arch/x86/kernel/dumpstack.c.

Maybe - probably - I'm missing something, but I don't see how this is going to help our readers? If there *is* a function that will, by virtue of being stared at, help bring enlightenment, why wouldn't we name it?

Thanks,

jon

#2 lore raw
Quoted 14 lines · Jonathan Corbet

Documentation/arch/x86/kernel-stacks.rst Printing backtraces on x86 · line 117

Quoted 6 lines · Jiayuan Chen

The question about the '?' preceding function names in an x86 stacktrace keeps popping up, here's an indepth explanation. It helps if the reader

Documentation/arch/x86/kernel-stacks.rst +1 -1
-stares at print_context_stack() and the whole machinery in and around
+stares at 'question mark' and the whole machinery in and around
 arch/x86/kernel/dumpstack.c.

Maybe - probably - I'm missing something, but I don't see how this is going to help our readers? If there *is* a function that will, by virtue of being stared at, help bring enlightenment, why wouldn't we name it?

Quoted 3 lines

Thanks,

jon

You're right.
As Randy mentioned, printk_stack_address() can probably be used as a drop-in replacement for the original function, and I found that it hasn't been touched since 3.12 anyway.

reviewer
#3 lore raw
In reply to Jiayuan Chen

Hi--

Quoted 17 lines · Jiayuan Chen

The dumpstack.c file has undergone many modifications, and the print_context_stack() function was removed or rewritten a long time ago, so it's better to remove the incorrect guidance. Additionally, no new functions will be added to the documentation, as it may be modified again in the future. Using 'question mark' and 'dumpstack' is sufficient to index this document.

---
 Documentation/arch/x86/kernel-stacks.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/arch/x86/kernel-stacks.rst +0 -0
index 738671a4070b..2d355e78008e 100644

Documentation/arch/x86/kernel-stacks.rst Printing backtraces on x86 · line 116

Quoted 4 lines
Documentation/arch/x86/kernel-stacks.rst +0 -1
@@ -113,7 +113,7 @@ Printing backtraces on x86
 
 The question about the '?' preceding function names in an x86 stacktrace
 keeps popping up, here's an indepth explanation. It helps if the reader
-stares at print_context_stack() and the whole machinery in and around

stares at printk_stack_address() and its callers
and pay special attention to the 'reliable' parameter ('?' basically means that the address is unreliable)

Also see the comment from dumpstack.c:

/*
* Scan the stack, printing any text addresses we find. At the
* same time, follow proper stack frames with the unwinder. *
* Addresses found during the scan which are not reported by
* the unwinder are considered to be additional clues which are
* sometimes useful for debugging and are prefixed with '?'.
* This also serves as a failsafe option in case the unwinder
* goes off in the weeds.
*/

Quoted 4 lines
Documentation/arch/x86/kernel-stacks.rst +1 -0
+stares at 'question mark' and the whole machinery in and around
 arch/x86/kernel/dumpstack.c.
 
 Adapted from Ingo's mail, Message-ID: <[email protected]>:
Signature · 1 line
~Randy
#4 lore raw

PATCH v2 1/1 docs/arch: remove deprecated function name

In reply to Jiayuan Chen

The dumpstack.c file has undergone many modifications, and the print_context_stack() function was removed or rewritten a long time ago, so it's better to remove the incorrect guidance.

I also want to preserve the original contributor info by keeping email adress and name.

---
 Documentation/arch/x86/kernel-stacks.rst | 51 +++++++++---------------
 1 file changed, 18 insertions(+), 33 deletions(-)
Documentation/arch/x86/kernel-stacks.rst +18 -33
index 738671a4070b..f780f4b09761 100644
@@ -112,41 +112,26 @@ Printing backtraces on x86
 ==========================
 
 The question about the '?' preceding function names in an x86 stacktrace
-keeps popping up, here's an indepth explanation. It helps if the reader
-stares at print_context_stack() and the whole machinery in and around
-arch/x86/kernel/dumpstack.c.
+keeps popping up, here provides guidance about it. It helps if the reader
+stares at printk_stack_addressk() and its callers and pay special
+attention to the 'reliable' parameter ('?' basically means that the
+address is unreliable).
 
-Adapted from Ingo's mail, Message-ID: <[email protected]>:
+The detail about '?' can be found in the comments within dumpstack.c:
+::
 
-We always scan the full kernel stack for return addresses stored on
-the kernel stack(s) [1]_, from stack top to stack bottom, and print out
-anything that 'looks like' a kernel text address.
+    /*
+     * Scan the stack, printing any text addresses we find.  At the
+     * same time, follow proper stack frames with the unwinder.
+     *
+     * Addresses found during the scan which are not reported by
+     * the unwinder are considered to be additional clues which are
+     * sometimes useful for debugging and are prefixed with '?'.
+     * This also serves as a failsafe option in case the unwinder
+     * goes off in the weeds.
+     */
 
-If it fits into the frame pointer chain, we print it without a question
-mark, knowing that it's part of the real backtrace.
 
-If the address does not fit into our expected frame pointer chain we
-still print it, but we print a '?'. It can mean two things:
+You can also get more info from Ingo's original emal [1]_
 
- - either the address is not part of the call chain: it's just stale
-   values on the kernel stack, from earlier function calls. This is
-   the common case.
-
- - or it is part of the call chain, but the frame pointer was not set
-   up properly within the function, so we don't recognize it.
-
-This way we will always print out the real call chain (plus a few more
-entries), regardless of whether the frame pointer was set up correctly
-or not - but in most cases we'll get the call chain right as well. The
-entries printed are strictly in stack order, so you can deduce more
-information from that as well.
-
-The most important property of this method is that we _never_ lose
-information: we always strive to print _all_ addresses on the stack(s)
-that look like kernel text addresses, so if debug information is wrong,
-we still print out the real call chain as well - just with more question
-marks than ideal.
-
-.. [1] For things like IRQ and IST stacks, we also scan those stacks, in
-       the right order, and try to cross from one stack into another
-       reconstructing the call chain. This works most of the time.
+.. [1] https://lore.kernel.org/lkml/[email protected]/
Signature · 1 line
2.43.5
reviewer
#5 lore raw

Hi:

Quoted 17 lines · Jiayuan Chen

The dumpstack.c file has undergone many modifications, and the print_context_stack() function was removed or rewritten a long time ago, so it's better to remove the incorrect guidance.

I also want to preserve the original contributor info by keeping email adress and name.

---
 Documentation/arch/x86/kernel-stacks.rst | 51 +++++++++---------------
 1 file changed, 18 insertions(+), 33 deletions(-)
Documentation/arch/x86/kernel-stacks.rst +0 -0
index 738671a4070b..f780f4b09761 100644

Documentation/arch/x86/kernel-stacks.rst Printing backtraces on x86 · line 115

Quoted 7 lines
Documentation/arch/x86/kernel-stacks.rst +1 -3
@@ -112,41 +112,26 @@ Printing backtraces on x86
 ==========================
 
 The question about the '?' preceding function names in an x86 stacktrace
-keeps popping up, here's an indepth explanation. It helps if the reader
-stares at print_context_stack() and the whole machinery in and around
-arch/x86/kernel/dumpstack.c.
+keeps popping up, here provides guidance about it. It helps if the reader

popping up. This provides

Documentation/arch/x86/kernel-stacks.rst Printing backtraces on x86 · line 116

Quoted 1 line
Documentation/arch/x86/kernel-stacks.rst +1 -0
+stares at printk_stack_addressk() and its callers and pay special

pays

Quoted 17 lines
Documentation/arch/x86/kernel-stacks.rst +11 -4
+attention to the 'reliable' parameter ('?' basically means that the
+address is unreliable).
 
-Adapted from Ingo's mail, Message-ID: <[email protected]>:
+The detail about '?' can be found in the comments within dumpstack.c:
+::
 
-We always scan the full kernel stack for return addresses stored on
-the kernel stack(s) [1]_, from stack top to stack bottom, and print out
-anything that 'looks like' a kernel text address.
+    /*
+     * Scan the stack, printing any text addresses we find.  At the
+     * same time, follow proper stack frames with the unwinder.
+     *
+     * Addresses found during the scan which are not reported by
+     * the unwinder are considered to be additional clues which are
+     * sometimes useful for debugging and are prefixed with '?'.

Documentation/arch/x86/kernel-stacks.rst Printing backtraces on x86 · line 135

Quoted 10 lines
Documentation/arch/x86/kernel-stacks.rst +4 -4
+     * This also serves as a failsafe option in case the unwinder
+     * goes off in the weeds.
+     */
 
-If it fits into the frame pointer chain, we print it without a question
-mark, knowing that it's part of the real backtrace.
 
-If the address does not fit into our expected frame pointer chain we
-still print it, but we print a '?'. It can mean two things:
+You can also get more info from Ingo's original emal [1]_

email
and end that sentence with a period ('.').

Quoted 24 lines
Documentation/arch/x86/kernel-stacks.rst +1 -22
- - either the address is not part of the call chain: it's just stale
-   values on the kernel stack, from earlier function calls. This is
-   the common case.
-
- - or it is part of the call chain, but the frame pointer was not set
-   up properly within the function, so we don't recognize it.
-
-This way we will always print out the real call chain (plus a few more
-entries), regardless of whether the frame pointer was set up correctly
-or not - but in most cases we'll get the call chain right as well. The
-entries printed are strictly in stack order, so you can deduce more
-information from that as well.
-
-The most important property of this method is that we _never_ lose
-information: we always strive to print _all_ addresses on the stack(s)
-that look like kernel text addresses, so if debug information is wrong,
-we still print out the real call chain as well - just with more question
-marks than ideal.
-
-.. [1] For things like IRQ and IST stacks, we also scan those stacks, in
-       the right order, and try to cross from one stack into another
-       reconstructing the call chain. This works most of the time.
+.. [1] https://lore.kernel.org/lkml/[email protected]/
Signature · 1 line
~Randy