[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <D9D41674-8EFF-4A30-97C5-F2C1B31C1F22@fb.com>
Date: Tue, 19 Jul 2022 23:24:35 +0000
From: Song Liu <songliubraving@...com>
To: Steven Rostedt <rostedt@...dmis.org>
CC: Song Liu <song@...nel.org>, bpf <bpf@...r.kernel.org>,
lkml <linux-kernel@...r.kernel.org>,
"live-patching@...r.kernel.org" <live-patching@...r.kernel.org>,
"daniel@...earbox.net" <daniel@...earbox.net>,
Kernel Team <Kernel-team@...com>,
"jolsa@...nel.org" <jolsa@...nel.org>
Subject: Re: [PATCH v4 bpf-next 2/4] ftrace: allow IPMODIFY and DIRECT ops on
the same function
> On Jul 19, 2022, at 11:28 AM, Steven Rostedt <rostedt@...dmis.org> wrote:
>
>> /**
>> * register_ftrace_function - register a function for profiling
>> * @ops: ops structure that holds the function for profiling.
>> @@ -8016,17 +8192,29 @@ int ftrace_is_dead(void)
>> * recursive loop.
>> */
>> int register_ftrace_function(struct ftrace_ops *ops)
>> + __releases(&direct_mutex)
>> {
>> + bool direct_mutex_locked = false;
>> int ret;
>>
>> ftrace_ops_init(ops);
>>
>
> I agree with Petr.
>
> Just grab the direct_mutex_lock here.
>
> mutex_lock(&direct_mutex);
Actually, we cannot blindly lock direct_mutex here, as
register_ftrace_direct() already locks it before calling
register_ftrace_function(). We still need the if (IPMODIFY)
check.
Thanks,
Song
>
>> + ret = prepare_direct_functions_for_ipmodify(ops);
>> + if (ret < 0)
>> + return ret;
>
Powered by blists - more mailing lists