Skip to contentSkip to conversation

function_graph: Add kernel-doc comments for ftrace_graph_ret_addr() function

PATCH In review Yang Li 2 participants 4 messages Jun 7, 2024 – Jun 10, 2024

Subsystems (2)
lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/2 function_graph: Add kernel-doc comments for ftrace_graph_ret_addr() function

Added kernel-doc comments for the ftrace_graph_ret_addr() function to improve code documentation and readability.

---
 kernel/trace/fgraph.c | 6 ++++++
 1 file changed, 6 insertions(+)
kernel/trace/fgraph.c +6 -0
index a13551a023aa..4ad33e4cb8da 100644
@@ -872,6 +872,12 @@ ftrace_graph_get_ret_stack(struct task_struct *task, int idx)
 /**
  * ftrace_graph_ret_addr - convert a potentially modified stack return address
  *			   to its original value
+ * @task: pointer to the task_struct of the task being examined
+ * @idx: pointer to a state variable, should be initialized to zero
+ *	 before the first call
+ * @ret: the current return address found on the stack
+ * @retp: pointer to the return address on the stack, ignored if
+ *	  HAVE_FUNCTION_GRAPH_RET_ADDR_PTR is not defined
  *
  * This function can be called by stack unwinding code to convert a found stack
  * return address ('ret') to its original value, in case the function graph
Signature · 1 line
2.20.1.7.g153144c
author
#1 lore raw

PATCH 2/2 ftrace: Add kernel-doc comments for unregister_ftrace_direct() function

Added kernel-doc comments for the unregister_ftrace_direct() function to improve code documentation and readability.

---
 kernel/trace/ftrace.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/trace/ftrace.c +2 -0
index 4aeb1183ea9f..3b0dbd55cc05 100644
@@ -5988,6 +5988,8 @@ EXPORT_SYMBOL_GPL(register_ftrace_direct);
  * unregister_ftrace_direct - Remove calls to custom trampoline
  * previously registered by register_ftrace_direct for @ops object.
  * @ops: The address of the struct ftrace_ops object
+ * @addr: The address of the direct call to remove
+ * @free_filters: Boolean indicating whether to free the filters
  *
  * This is used to remove a direct calls to @addr from the nop locations
  * of the functions registered in @ops (with by ftrace_set_filter_ip
Signature · 1 line
2.20.1.7.g153144c
maintainer
#2 lore raw

Re: [PATCH -next 2/2] ftrace: Add kernel-doc comments for unregister_ftrace_direct() function

Quoted 3 lines · On Fri, 7 Jun 2024 16:49:57 +0800 Yang Li <[email protected]> wrote:

Added kernel-doc comments for the unregister_ftrace_direct() function to improve code documentation and readability.

Someone else beat you to this.

-- Steve

Quoted 20 lines
---
 kernel/trace/ftrace.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/trace/ftrace.c +2 -0
index 4aeb1183ea9f..3b0dbd55cc05 100644
@@ -5988,6 +5988,8 @@ EXPORT_SYMBOL_GPL(register_ftrace_direct);
  * unregister_ftrace_direct - Remove calls to custom trampoline
  * previously registered by register_ftrace_direct for @ops object.
  * @ops: The address of the struct ftrace_ops object
+ * @addr: The address of the direct call to remove
+ * @free_filters: Boolean indicating whether to free the filters
  *
  * This is used to remove a direct calls to @addr from the nop locations
  * of the functions registered in @ops (with by ftrace_set_filter_ip
maintainer
#3 lore raw
In reply to Yang Li
Quoted 15 lines · On Fri, 7 Jun 2024 16:49:56 +0800 Yang Li <[email protected]> wrote:

Added kernel-doc comments for the ftrace_graph_ret_addr() function to improve code documentation and readability.

---
 kernel/trace/fgraph.c | 6 ++++++
 1 file changed, 6 insertions(+)
kernel/trace/fgraph.c +0 -0
index a13551a023aa..4ad33e4cb8da 100644

kernel/trace/fgraph.c ftrace_graph_get_ret_stack(struct task_struct *task, int idx) · line 877

Quoted 6 lines
kernel/trace/fgraph.c +3 -0
@@ -872,6 +872,12 @@ ftrace_graph_get_ret_stack(struct task_struct *task, int idx)
 /**
  * ftrace_graph_ret_addr - convert a potentially modified stack return address
  *			   to its original value
+ * @task: pointer to the task_struct of the task being examined
+ * @idx: pointer to a state variable, should be initialized to zero
+ *	 before the first call

parameter descriptions should not go across more than one line. At least not in my code. Also, you don't need to add that it needs to be initialized here. That belongs in the body.

And it's not a state variable. The description you got that from is wrong.

I'll go update it and give you a reported by, as the entire description needs a rewrite.

-- Steve

Quoted 6 lines
kernel/trace/fgraph.c +3 -0
+ * @ret: the current return address found on the stack
+ * @retp: pointer to the return address on the stack, ignored if
+ *	  HAVE_FUNCTION_GRAPH_RET_ADDR_PTR is not defined
  *
  * This function can be called by stack unwinding code to convert a found stack
  * return address ('ret') to its original value, in case the function graph