linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] blktrace: Fix output non-blktrace event when blk_classic option enabled
@ 2022-11-22  4:04 Yang Jihong
  2022-12-07  1:34 ` Yang Jihong
  2022-12-08 16:27 ` Jens Axboe
  0 siblings, 2 replies; 5+ messages in thread
From: Yang Jihong @ 2022-11-22  4:04 UTC (permalink / raw)
  To: axboe, rostedt, mhiramat, acme, mingo, linux-block, linux-kernel
  Cc: yangjihong1

When the blk_classic option is enabled, non-blktrace events must be
filtered out. Otherwise, events of other types are output in the blktrace
classic format, which is unexpected.

The problem can be triggered in the following ways:

  # echo 1 > /sys/kernel/debug/tracing/options/blk_classic
  # echo 1 > /sys/kernel/debug/tracing/events/enable
  # echo blk > /sys/kernel/debug/tracing/current_tracer
  # cat /sys/kernel/debug/tracing/trace_pipe

Fixes: c71a89615411 ("blktrace: add ftrace plugin")
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
---
 kernel/trace/blktrace.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index a995ea1ef849..a66cff5a1857 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -1548,7 +1548,8 @@ blk_trace_event_print_binary(struct trace_iterator *iter, int flags,
 
 static enum print_line_t blk_tracer_print_line(struct trace_iterator *iter)
 {
-	if (!(blk_tracer_flags.val & TRACE_BLK_OPT_CLASSIC))
+	if ((iter->ent->type != TRACE_BLK) ||
+	    !(blk_tracer_flags.val & TRACE_BLK_OPT_CLASSIC))
 		return TRACE_TYPE_UNHANDLED;
 
 	return print_one_line(iter, true);
-- 
2.30.GIT


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] blktrace: Fix output non-blktrace event when blk_classic option enabled
  2022-11-22  4:04 [PATCH] blktrace: Fix output non-blktrace event when blk_classic option enabled Yang Jihong
@ 2022-12-07  1:34 ` Yang Jihong
  2022-12-08 16:26   ` Jens Axboe
  2022-12-08 16:27 ` Jens Axboe
  1 sibling, 1 reply; 5+ messages in thread
From: Yang Jihong @ 2022-12-07  1:34 UTC (permalink / raw)
  To: axboe, rostedt, mhiramat, acme, mingo, linux-block, linux-kernel

Hello,

PING.

Thanks,
Yang.

On 2022/11/22 12:04, Yang Jihong wrote:
> When the blk_classic option is enabled, non-blktrace events must be
> filtered out. Otherwise, events of other types are output in the blktrace
> classic format, which is unexpected.
> 
> The problem can be triggered in the following ways:
> 
>    # echo 1 > /sys/kernel/debug/tracing/options/blk_classic
>    # echo 1 > /sys/kernel/debug/tracing/events/enable
>    # echo blk > /sys/kernel/debug/tracing/current_tracer
>    # cat /sys/kernel/debug/tracing/trace_pipe
> 
> Fixes: c71a89615411 ("blktrace: add ftrace plugin")
> Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
> ---
>   kernel/trace/blktrace.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
> index a995ea1ef849..a66cff5a1857 100644
> --- a/kernel/trace/blktrace.c
> +++ b/kernel/trace/blktrace.c
> @@ -1548,7 +1548,8 @@ blk_trace_event_print_binary(struct trace_iterator *iter, int flags,
>   
>   static enum print_line_t blk_tracer_print_line(struct trace_iterator *iter)
>   {
> -	if (!(blk_tracer_flags.val & TRACE_BLK_OPT_CLASSIC))
> +	if ((iter->ent->type != TRACE_BLK) ||
> +	    !(blk_tracer_flags.val & TRACE_BLK_OPT_CLASSIC))
>   		return TRACE_TYPE_UNHANDLED;
>   
>   	return print_one_line(iter, true);
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] blktrace: Fix output non-blktrace event when blk_classic option enabled
  2022-12-07  1:34 ` Yang Jihong
@ 2022-12-08 16:26   ` Jens Axboe
  2022-12-09  1:51     ` Yang Jihong
  0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2022-12-08 16:26 UTC (permalink / raw)
  To: Yang Jihong, rostedt, mhiramat, acme, mingo, linux-block, linux-kernel

On 12/6/22 6:34 PM, Yang Jihong wrote:
> Hello,
> 
> PING.

Get your company email fixed so that messages don't get marked as spam,
that would help ensure your patches are more visible.

-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] blktrace: Fix output non-blktrace event when blk_classic option enabled
  2022-11-22  4:04 [PATCH] blktrace: Fix output non-blktrace event when blk_classic option enabled Yang Jihong
  2022-12-07  1:34 ` Yang Jihong
@ 2022-12-08 16:27 ` Jens Axboe
  1 sibling, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2022-12-08 16:27 UTC (permalink / raw)
  To: rostedt, mhiramat, acme, mingo, linux-block, linux-kernel, Yang Jihong


On Tue, 22 Nov 2022 12:04:10 +0800, Yang Jihong wrote:
> When the blk_classic option is enabled, non-blktrace events must be
> filtered out. Otherwise, events of other types are output in the blktrace
> classic format, which is unexpected.
> 
> The problem can be triggered in the following ways:
> 
>   # echo 1 > /sys/kernel/debug/tracing/options/blk_classic
>   # echo 1 > /sys/kernel/debug/tracing/events/enable
>   # echo blk > /sys/kernel/debug/tracing/current_tracer
>   # cat /sys/kernel/debug/tracing/trace_pipe
> 
> [...]

Applied, thanks!

[1/1] blktrace: Fix output non-blktrace event when blk_classic option enabled
      commit: f596da3efaf4130ff61cd029558845808df9bf99

Best regards,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] blktrace: Fix output non-blktrace event when blk_classic option enabled
  2022-12-08 16:26   ` Jens Axboe
@ 2022-12-09  1:51     ` Yang Jihong
  0 siblings, 0 replies; 5+ messages in thread
From: Yang Jihong @ 2022-12-09  1:51 UTC (permalink / raw)
  To: Jens Axboe, rostedt, mhiramat, acme, mingo, linux-block, linux-kernel

Hello,

On 2022/12/9 0:26, Jens Axboe wrote:
> Get your company email fixed so that messages don't get marked as spam,
> that would help ensure your patches are more visible.

OK, I'll consult with the relevant department of our company about this 
issue.

Thanks,
Yang

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-12-09  1:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-22  4:04 [PATCH] blktrace: Fix output non-blktrace event when blk_classic option enabled Yang Jihong
2022-12-07  1:34 ` Yang Jihong
2022-12-08 16:26   ` Jens Axboe
2022-12-09  1:51     ` Yang Jihong
2022-12-08 16:27 ` Jens Axboe

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).