From: Steven Rostedt <rostedt@goodmis.org>
To: Peter Enderborg <peter.enderborg@sony.com>
Cc: <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH] trace: Return ENOTCONN instead of EBADF
Date: Mon, 12 Oct 2020 09:53:24 -0400 [thread overview]
Message-ID: <20201012095324.78996fd2@gandalf.local.home> (raw)
In-Reply-To: <20201012082642.1394-1-peter.enderborg@sony.com>
On Mon, 12 Oct 2020 10:26:42 +0200
Peter Enderborg <peter.enderborg@sony.com> wrote:
> When there is no clients listening on event the trace return
> EBADF. The file is not a bad file descriptor and to get the
> userspace able to do a proper error handling it need a different
> error code that separate a bad file descriptor from a empty listening.
I have no problem with this patch, but your description is incorrect. And
before making this change, I want to make sure that what you think is
happening is actually happening.
This has nothing to do with "clients listening". This happens when the ring
buffer is disabled for some reason. The most likely case of this happening
is if someone sets /sys/kernel/tracing/tracing_on to zero.
If this is still something you want applied, please update the change log
to a more accurate scenario.
Thanks,
-- Steve
>
> Signed-off-by: Peter Enderborg <peter.enderborg@sony.com>
> ---
> kernel/trace/trace.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index d3e5de717df2..6e592bf736df 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -6651,8 +6651,8 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
> event = __trace_buffer_lock_reserve(buffer, TRACE_PRINT, size,
> irq_flags, preempt_count());
> if (unlikely(!event))
> - /* Ring buffer disabled, return as if not open for write */
> - return -EBADF;
> + /* Ring buffer disabled, return as if not connected */
> + return -ENOTCONN;
>
> entry = ring_buffer_event_data(event);
> entry->ip = _THIS_IP_;
> @@ -6731,8 +6731,8 @@ tracing_mark_raw_write(struct file *filp, const char __user *ubuf,
> event = __trace_buffer_lock_reserve(buffer, TRACE_RAW_DATA, size,
> irq_flags, preempt_count());
> if (!event)
> - /* Ring buffer disabled, return as if not open for write */
> - return -EBADF;
> + /* Ring buffer disabled, return not connected */
> + return -ENOTCONN;
>
> entry = ring_buffer_event_data(event);
>
next prev parent reply other threads:[~2020-10-12 13:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-12 8:26 Peter Enderborg
2020-10-12 13:53 ` Steven Rostedt [this message]
2020-10-12 14:26 ` Enderborg, Peter
2020-10-12 14:45 ` Steven Rostedt
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=20201012095324.78996fd2@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peter.enderborg@sony.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
all inboxes | Powered by JetHome®