From: Steven Rostedt <rostedt@goodmis.org>
To: sunliming <sunliming@kylinos.cn>
Cc: mhiramat@kernel.org, beaub@linux.microsoft.com,
kelulanainsley@gmail.com, linux-trace-kernel@vger.kernel.org,
linux-kernel@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH v3 1/3] tracing/user_events: Fix incorrect return value for writing operation when events are disable
Date: Mon, 26 Jun 2023 02:15:30 -0400 [thread overview]
Message-ID: <20230626021530.26603164@rorschach.local.home> (raw)
In-Reply-To: <20230621060827.151564-2-sunliming@kylinos.cn>
On Wed, 21 Jun 2023 14:08:24 +0800
sunliming <sunliming@kylinos.cn> wrote:
> The writing operation return the count of writes regardless of whether events
> are enabled or disabled. Switch it to return 0 to indicates that the event
> is disabled.
>
> Signed-off-by: sunliming <sunliming@kylinos.cn>
> ---
> kernel/trace/trace_events_user.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
> index 1ac5ba5685ed..c085ff829a58 100644
> --- a/kernel/trace/trace_events_user.c
> +++ b/kernel/trace/trace_events_user.c
> @@ -1957,7 +1957,8 @@ static ssize_t user_events_write_core(struct file *file, struct iov_iter *i)
>
> if (unlikely(faulted))
> return -EFAULT;
> - }
> + } else
> + return 0;
>
sunliming,
If you missed the conversation about the pull request with Linus, he
pointed out (correctly) that we were mistaken to tell you to return
zero. It should return an error if the ring buffer is disabled.
But instead of returning -EFAULT, let's follow the behavior of
trace_marker and return -EBADF. This way user space has a better idea
why it failed.
Care to send another update?
Thanks!
-- Steve
> return ret;
> }
prev parent reply other threads:[~2023-06-26 6:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-21 6:08 [PATCH v3 0/3] tracing/user_events: Fix incorrect return value for sunliming
2023-06-21 6:08 ` [PATCH v3 1/3] tracing/user_events: Fix incorrect return value for writing operation when events are disable sunliming
2023-06-22 20:20 ` Beau Belgrave
2023-06-26 6:15 ` Steven Rostedt [this message]
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=20230626021530.26603164@rorschach.local.home \
--to=rostedt@goodmis.org \
--cc=beaub@linux.microsoft.com \
--cc=kelulanainsley@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=sunliming@kylinos.cn \
--cc=torvalds@linux-foundation.org \
/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).