Re: [PATCHv5 bpf-next 3/9] ftrace: Export some of hash related functions

Steven Rostedt
2025-12-18T01:07:17Z

On Mon, 15 Dec 2025 22:13:56 +0100
Jiri Olsa <jolsa@kernel.org> wrote:

> index 505b7d3f5641..c0a72fcae1f6 100644
> --- a/include/linux/ftrace.h
> +++ b/include/linux/ftrace.h
> @@ -82,6 +82,7 @@ static inline void early_trace_init(void) { }
>
> struct module;
> struct ftrace_hash;
> +struct ftrace_func_entry;
>
> #if defined(CONFIG_FUNCTION_TRACER) && defined(CONFIG_MODULES) && \
> defined(CONFIG_DYNAMIC_FTRACE)
> @@ -405,6 +406,14 @@ enum ftrace_ops_cmd {
> typedef int (*ftrace_ops_func_t)(struct ftrace_ops *op, enum ftrace_ops_cmd cmd);
>
> #ifdef CONFIG_DYNAMIC_FTRACE
> +
> +#define FTRACE_HASH_DEFAULT_BITS 10
> +
> +struct ftrace_hash *alloc_ftrace_hash(int size_bits);
> +void free_ftrace_hash(struct ftrace_hash *hash);
> +struct ftrace_func_entry *add_hash_entry_direct(struct ftrace_hash *hash,

As this is no longer static and is exported to other users within the
kernel, it should be renamed to: add_ftrace_hash_entry_direct()
to keep the namespace unique.

-- Steve

> + unsigned long ip, unsigned long direct);
> +
> /* The hash used to know what functions callbacks trace */
> struct ftrace_ops_hash {
> struct ftrace_hash __rcu *notrace_hash;