Re: [PATCH 02/11] [BUGFIX] ftrace, kprobes: Fix a deadlock onftrace_regex_lock

From: Steven Rostedt
Date: Thu May 09 2013 - 12:27:46 EST


On Thu, 2013-05-09 at 14:44 +0900, Masami Hiramatsu wrote:

> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 8a5c017..3f29b3d 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -64,9 +64,17 @@
>
> #define FL_GLOBAL_CONTROL_MASK (FTRACE_OPS_FL_GLOBAL | FTRACE_OPS_FL_CONTROL)
>
> +#ifdef CONFIG_DYNAMIC_FTRACE
> +#define INIT_REGEX_LOCK(opsname) \
> + .regex_lock = __MUTEX_INITIALIZER(opsname.regex_lock),
> +#else
> +#define INIT_REGEX_LOCK(opsname)
> +#endif
> +
> static struct ftrace_ops ftrace_list_end __read_mostly = {
> .func = ftrace_stub,
> .flags = FTRACE_OPS_FL_RECURSION_SAFE | FTRACE_OPS_FL_STUB,
> + INIT_REGEX_LOCK(ftrace_list_end)
> };
>

We probably should have a better way to initialize this. As there are 26
ftrace_ops currently in the kernel (and this patch doesn't cover all of
them). Maybe have the first time its registered to initialize it.

I think adding the INIT_REGEX_LOCK() all over the place is rather ugly.

-- Steve


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/