mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-04-13 09:59:31 +00:00
ftrace: Add comments to ftrace_hash_move() and friends
Describe what ftrace_hash_move() does and add some more comments to some other functions to make it easier to understand. Link: https://lore.kernel.org/linux-trace-kernel/20240605180409.179520305@goodmis.org Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Andrew Morton <akpm@linux-foundation.org> Acked-by: Mark Rutland <mark.rutland@arm.com> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
This commit is contained in:
parent
1a88c07167
commit
d66bb33479
1 changed files with 23 additions and 1 deletions
|
@ -169,6 +169,7 @@ static inline void ftrace_ops_init(struct ftrace_ops *ops)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Call this function for when a callback filters on set_ftrace_pid */
|
||||||
static void ftrace_pid_func(unsigned long ip, unsigned long parent_ip,
|
static void ftrace_pid_func(unsigned long ip, unsigned long parent_ip,
|
||||||
struct ftrace_ops *op, struct ftrace_regs *fregs)
|
struct ftrace_ops *op, struct ftrace_regs *fregs)
|
||||||
{
|
{
|
||||||
|
@ -1318,7 +1319,7 @@ static struct ftrace_hash *alloc_ftrace_hash(int size_bits)
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Used to save filters on functions for modules not loaded yet */
|
||||||
static int ftrace_add_mod(struct trace_array *tr,
|
static int ftrace_add_mod(struct trace_array *tr,
|
||||||
const char *func, const char *module,
|
const char *func, const char *module,
|
||||||
int enable)
|
int enable)
|
||||||
|
@ -1430,6 +1431,7 @@ static struct ftrace_hash *__move_hash(struct ftrace_hash *src, int size)
|
||||||
return new_hash;
|
return new_hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Move the @src entries to a newly allocated hash */
|
||||||
static struct ftrace_hash *
|
static struct ftrace_hash *
|
||||||
__ftrace_hash_move(struct ftrace_hash *src)
|
__ftrace_hash_move(struct ftrace_hash *src)
|
||||||
{
|
{
|
||||||
|
@ -1444,6 +1446,26 @@ __ftrace_hash_move(struct ftrace_hash *src)
|
||||||
return __move_hash(src, size);
|
return __move_hash(src, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ftrace_hash_move - move a new hash to a filter and do updates
|
||||||
|
* @ops: The ops with the hash that @dst points to
|
||||||
|
* @enable: True if for the filter hash, false for the notrace hash
|
||||||
|
* @dst: Points to the @ops hash that should be updated
|
||||||
|
* @src: The hash to update @dst with
|
||||||
|
*
|
||||||
|
* This is called when an ftrace_ops hash is being updated and the
|
||||||
|
* the kernel needs to reflect this. Note, this only updates the kernel
|
||||||
|
* function callbacks if the @ops is enabled (not to be confused with
|
||||||
|
* @enable above). If the @ops is enabled, its hash determines what
|
||||||
|
* callbacks get called. This function gets called when the @ops hash
|
||||||
|
* is updated and it requires new callbacks.
|
||||||
|
*
|
||||||
|
* On success the elements of @src is moved to @dst, and @dst is updated
|
||||||
|
* properly, as well as the functions determined by the @ops hashes
|
||||||
|
* are now calling the @ops callback function.
|
||||||
|
*
|
||||||
|
* Regardless of return type, @src should be freed with free_ftrace_hash().
|
||||||
|
*/
|
||||||
static int
|
static int
|
||||||
ftrace_hash_move(struct ftrace_ops *ops, int enable,
|
ftrace_hash_move(struct ftrace_ops *ops, int enable,
|
||||||
struct ftrace_hash **dst, struct ftrace_hash *src)
|
struct ftrace_hash **dst, struct ftrace_hash *src)
|
||||||
|
|
Loading…
Add table
Reference in a new issue