[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 09 Sep 2022 23:43:39 +0530
From: "Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>
To: Song Liu <songliubraving@...com>
Cc: Kernel Team <Kernel-team@...com>, bpf <bpf@...r.kernel.org>,
"daniel@...earbox.net" <daniel@...earbox.net>,
"jolsa@...nel.org" <jolsa@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"live-patching@...r.kernel.org" <live-patching@...r.kernel.org>,
"rostedt@...dmis.org" <rostedt@...dmis.org>,
Song Liu <song@...nel.org>
Subject: Re: [PATCH v5 bpf-next 2/4] ftrace: Allow IPMODIFY and DIRECT ops on
the same function
Hi Song,
Song Liu wrote:
>
>
>> On Sep 9, 2022, at 4:58 AM, Naveen N. Rao <naveen.n.rao@...ux.ibm.com> wrote:
>>
>> Song Liu wrote:
>
> [...]
>
>>> +
>>> /**
>>> * register_ftrace_function - register a function for profiling
>>> * @ops: ops structure that holds the function for profiling.
>>> @@ -8018,14 +8206,15 @@ int register_ftrace_function(struct ftrace_ops *ops)
>>> {
>>> int ret;
>>> - ftrace_ops_init(ops);
>>> -
>>> - mutex_lock(&ftrace_lock);
>>> -
>>> - ret = ftrace_startup(ops, 0);
>>> + lock_direct_mutex();
>>
>> Trying to enable ftrace direct on powerpc, this is resulting in a hung task when testing samples/ftrace/ftrace-direct-modify.c
>>
>> Essentially, the sample calls modify_ftrace_direct(), which grabs direct_mutex before calling ftrace_modify_direct_caller()->register_ftrace_function().
>>
>
> Thanks for the report. Would the following change fix the issue?
>
> Song
>
> diff --git i/kernel/trace/ftrace.c w/kernel/trace/ftrace.c
> index bc921a3f7ea8..2f1e6cfa834e 100644
> --- i/kernel/trace/ftrace.c
> +++ w/kernel/trace/ftrace.c
> @@ -5496,7 +5496,7 @@ int __weak ftrace_modify_direct_caller(struct ftrace_func_entry *entry,
> if (ret)
> goto out_lock;
>
> - ret = register_ftrace_function(&stub_ops);
> + ret = register_ftrace_function_nolock(&stub_ops);
> if (ret) {
> ftrace_set_filter_ip(&stub_ops, ip, 1, 0);
> goto out_lock;
>
That fixes it for me.
Reported-and-Tested-by: Naveen N. Rao <naveen.n.rao@...ux.vnet.ibm.com>
Thanks!
- Naveen
Powered by blists - more mailing lists