From: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>
To: Song Liu <songliubraving@fb.com>
Cc: Kernel Team <Kernel-team@fb.com>, bpf <bpf@vger.kernel.org>,
"daniel@iogearbox.net" <daniel@iogearbox.net>,
"jolsa@kernel.org" <jolsa@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"live-patching@vger.kernel.org" <live-patching@vger.kernel.org>,
"rostedt@goodmis.org" <rostedt@goodmis.org>,
Song Liu <song@kernel.org>
Subject: Re: [PATCH v5 bpf-next 2/4] ftrace: Allow IPMODIFY and DIRECT ops on the same function
Date: Fri, 09 Sep 2022 23:43:39 +0530 [thread overview]
Message-ID: <1662747146.nqpswjliso.naveen@linux.ibm.com> (raw)
In-Reply-To: <B59F0FD0-FA3E-4A8B-B588-8F9AA8AC602A@fb.com>
Hi Song,
Song Liu wrote:
>
>
>> On Sep 9, 2022, at 4:58 AM, Naveen N. Rao <naveen.n.rao@linux.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@linux.vnet.ibm.com>
Thanks!
- Naveen
next prev parent reply other threads:[~2022-09-09 18:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-20 0:21 [PATCH v5 bpf-next 0/4] ftrace: host klp and bpf trampoline together Song Liu
2022-07-20 0:21 ` [PATCH v5 bpf-next 1/4] ftrace: Add modify_ftrace_direct_multi_nolock Song Liu
2022-07-20 0:21 ` [PATCH v5 bpf-next 2/4] ftrace: Allow IPMODIFY and DIRECT ops on the same function Song Liu
2022-09-09 11:58 ` Naveen N. Rao
2022-09-09 14:05 ` Song Liu
2022-09-09 18:13 ` Naveen N. Rao [this message]
2022-07-20 0:21 ` [PATCH v5 bpf-next 3/4] bpf, x64: Allow to use caller address from stack Song Liu
2022-07-20 0:21 ` [PATCH v5 bpf-next 4/4] bpf: Support bpf_trampoline on functions with IPMODIFY (e.g. livepatch) Song Liu
2022-07-22 7:31 ` Jiri Olsa
2022-07-22 15:58 ` Song Liu
2022-07-21 22:59 ` [PATCH v5 bpf-next 0/4] ftrace: host klp and bpf trampoline together Song Liu
2022-07-22 16:56 ` Steven Rostedt
2022-07-22 18:02 ` Song Liu
2022-07-22 20:10 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1662747146.nqpswjliso.naveen@linux.ibm.com \
--to=naveen.n.rao@linux.ibm.com \
--cc=Kernel-team@fb.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=song@kernel.org \
--cc=songliubraving@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).