[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6b0fc12d-e6c5-4a05-a6e6-46e5e5c9ae7b@huawei.com>
Date: Thu, 7 Sep 2023 09:39:56 +0800
From: Zheng Yejian <zhengyejian1@...wei.com>
To: Steven Rostedt <rostedt@...dmis.org>,
Naresh Kamboju <naresh.kamboju@...aro.org>
CC: <akaher@...are.com>, <linux-kernel@...r.kernel.org>,
<linux-kselftest@...r.kernel.org>,
<linux-trace-kernel@...r.kernel.org>, <mhiramat@...nel.org>,
<shuah@...nel.org>, <skhan@...uxfoundation.org>,
<yeweihua4@...wei.com>
Subject: Re: "[PATCH] selftests/ftrace: Correctly enable event in
instance-event.tc"
On 2023/9/7 06:46, Steven Rostedt wrote:
> On Wed, 6 Sep 2023 14:50:00 -0400
> Steven Rostedt <rostedt@...dmis.org> wrote:
>
>> BTW, when you ran these, did you apply:
>>
>> https://patchwork.kernel.org/project/linux-trace-kernel/patch/20230905183332.628d7cc0@gandalf.local.home/
>
> Can you both try the above patch and this patch?
>
> -- Steve
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
Hi, Steve
Only apply this new patch, the kasan issue seems gone.
--
Thanks,
Zheng Yejian
> index 35783a7baf15..0827037ee3b8 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -4973,6 +4973,33 @@ int tracing_open_generic_tr(struct inode *inode, struct file *filp)
> return 0;
> }
>
> +/*
> + * The private pointer of the inode is the trace_event_file.
> + * Update the tr ref count associated to it.
> + */
> +int tracing_open_file_tr(struct inode *inode, struct file *filp)
> +{
> + struct trace_event_file *file = inode->i_private;
> + int ret;
> +
> + ret = tracing_check_open_get_tr(file->tr);
> + if (ret)
> + return ret;
> +
> + filp->private_data = inode->i_private;
> +
> + return 0;
> +}
> +
> +int tracing_release_file_tr(struct inode *inode, struct file *filp)
> +{
> + struct trace_event_file *file = inode->i_private;
> +
> + trace_array_put(file->tr);
> +
> + return 0;
> +}
> +
> static int tracing_mark_open(struct inode *inode, struct file *filp)
> {
> stream_open(inode, filp);
> diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
> index 5669dd1f90d9..77debe53f07c 100644
> --- a/kernel/trace/trace.h
> +++ b/kernel/trace/trace.h
> @@ -610,6 +610,8 @@ void tracing_reset_all_online_cpus(void);
> void tracing_reset_all_online_cpus_unlocked(void);
> int tracing_open_generic(struct inode *inode, struct file *filp);
> int tracing_open_generic_tr(struct inode *inode, struct file *filp);
> +int tracing_open_file_tr(struct inode *inode, struct file *filp);
> +int tracing_release_file_tr(struct inode *inode, struct file *filp);
> bool tracing_is_disabled(void);
> bool tracer_tracing_is_on(struct trace_array *tr);
> void tracer_tracing_on(struct trace_array *tr);
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index ed367d713be0..2af92177b765 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -2103,9 +2103,10 @@ static const struct file_operations ftrace_set_event_notrace_pid_fops = {
> };
>
> static const struct file_operations ftrace_enable_fops = {
> - .open = tracing_open_generic,
> + .open = tracing_open_file_tr,
> .read = event_enable_read,
> .write = event_enable_write,
> + .release = tracing_release_file_tr,
> .llseek = default_llseek,
> };
>
> @@ -2122,9 +2123,10 @@ static const struct file_operations ftrace_event_id_fops = {
> };
>
> static const struct file_operations ftrace_event_filter_fops = {
> - .open = tracing_open_generic,
> + .open = tracing_open_file_tr,
> .read = event_filter_read,
> .write = event_filter_write,
> + .release = tracing_release_file_tr,
> .llseek = default_llseek,
> };
>
Powered by blists - more mailing lists