Skip to content

Commit 4e64210

Browse files
committed
firewire: core: add tracepoints events for starting/stopping of isochronous context
It is helpful to trace the starting and stopping of isochronous context when the core function is requested them by both in-kernel unit drivers and userspace applications. This commit adds some tracepoints events for the aim. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Sakamoto <[email protected]>
1 parent 9f16ac7 commit 4e64210

File tree

2 files changed

+116
-0
lines changed

2 files changed

+116
-0
lines changed

drivers/firewire/core-iso.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ EXPORT_SYMBOL(fw_iso_context_destroy);
171171
int fw_iso_context_start(struct fw_iso_context *ctx,
172172
int cycle, int sync, int tags)
173173
{
174+
trace_isoc_outbound_start(ctx, cycle);
175+
trace_isoc_inbound_single_start(ctx, cycle, sync, tags);
176+
trace_isoc_inbound_multiple_start(ctx, cycle, sync, tags);
177+
174178
return ctx->card->driver->start_iso(ctx, cycle, sync, tags);
175179
}
176180
EXPORT_SYMBOL(fw_iso_context_start);
@@ -205,6 +209,10 @@ EXPORT_SYMBOL(fw_iso_context_flush_completions);
205209

206210
int fw_iso_context_stop(struct fw_iso_context *ctx)
207211
{
212+
trace_isoc_outbound_stop(ctx);
213+
trace_isoc_inbound_single_stop(ctx);
214+
trace_isoc_inbound_multiple_stop(ctx);
215+
208216
return ctx->card->driver->stop_iso(ctx);
209217
}
210218
EXPORT_SYMBOL(fw_iso_context_stop);

include/trace/events/firewire.h

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,114 @@ TRACE_EVENT(isoc_inbound_multiple_channels,
562562
)
563563
);
564564

565+
TRACE_EVENT_CONDITION(isoc_outbound_start,
566+
TP_PROTO(const struct fw_iso_context *ctx, int cycle_match),
567+
TP_ARGS(ctx, cycle_match),
568+
TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT),
569+
TP_STRUCT__entry(
570+
__field(u64, context)
571+
__field(u8, card_index)
572+
__field(bool, cycle_match)
573+
__field(u16, cycle)
574+
),
575+
TP_fast_assign(
576+
__entry->context = (uintptr_t)ctx;
577+
__entry->card_index = ctx->card->index;
578+
__entry->cycle_match = cycle_match < 0 ? false : true;
579+
__entry->cycle = __entry->cycle_match ? (u16)cycle_match : 0;
580+
),
581+
TP_printk(
582+
"context=0x%llx card_index=%u cycle_match=%s cycle=0x%04x",
583+
__entry->context,
584+
__entry->card_index,
585+
__entry->cycle_match ? "true" : "false",
586+
__entry->cycle
587+
)
588+
);
589+
590+
DECLARE_EVENT_CLASS(isoc_inbound_start_template,
591+
TP_PROTO(const struct fw_iso_context *ctx, int cycle_match, unsigned int sync, unsigned int tags),
592+
TP_ARGS(ctx, cycle_match, sync, tags),
593+
TP_STRUCT__entry(
594+
__field(u64, context)
595+
__field(u8, card_index)
596+
__field(bool, cycle_match)
597+
__field(u16, cycle)
598+
__field(u8, sync)
599+
__field(u8, tags)
600+
),
601+
TP_fast_assign(
602+
__entry->context = (uintptr_t)ctx;
603+
__entry->card_index = ctx->card->index;
604+
__entry->cycle_match = cycle_match < 0 ? false : true;
605+
__entry->cycle = __entry->cycle_match ? (u16)cycle_match : 0;
606+
__entry->sync = sync;
607+
__entry->tags = tags;
608+
),
609+
TP_printk(
610+
"context=0x%llx card_index=%u cycle_match=%s cycle=0x%04x sync=%u tags=%s",
611+
__entry->context,
612+
__entry->card_index,
613+
__entry->cycle_match ? "true" : "false",
614+
__entry->cycle,
615+
__entry->sync,
616+
__print_flags(__entry->tags, "|",
617+
{ FW_ISO_CONTEXT_MATCH_TAG0, "0" },
618+
{ FW_ISO_CONTEXT_MATCH_TAG1, "1" },
619+
{ FW_ISO_CONTEXT_MATCH_TAG2, "2" },
620+
{ FW_ISO_CONTEXT_MATCH_TAG3, "3" }
621+
)
622+
)
623+
);
624+
625+
DEFINE_EVENT_CONDITION(isoc_inbound_start_template, isoc_inbound_single_start,
626+
TP_PROTO(const struct fw_iso_context *ctx, int cycle_match, unsigned int sync, unsigned int tags),
627+
TP_ARGS(ctx, cycle_match, sync, tags),
628+
TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE)
629+
);
630+
631+
DEFINE_EVENT_CONDITION(isoc_inbound_start_template, isoc_inbound_multiple_start,
632+
TP_PROTO(const struct fw_iso_context *ctx, int cycle_match, unsigned int sync, unsigned int tags),
633+
TP_ARGS(ctx, cycle_match, sync, tags),
634+
TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL)
635+
);
636+
637+
DECLARE_EVENT_CLASS(isoc_stop_template,
638+
TP_PROTO(const struct fw_iso_context *ctx),
639+
TP_ARGS(ctx),
640+
TP_STRUCT__entry(
641+
__field(u64, context)
642+
__field(u8, card_index)
643+
),
644+
TP_fast_assign(
645+
__entry->context = (uintptr_t)ctx;
646+
__entry->card_index = ctx->card->index;
647+
),
648+
TP_printk(
649+
"context=0x%llx card_index=%u",
650+
__entry->context,
651+
__entry->card_index
652+
)
653+
)
654+
655+
DEFINE_EVENT_CONDITION(isoc_stop_template, isoc_outbound_stop,
656+
TP_PROTO(const struct fw_iso_context *ctx),
657+
TP_ARGS(ctx),
658+
TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT)
659+
);
660+
661+
DEFINE_EVENT_CONDITION(isoc_stop_template, isoc_inbound_single_stop,
662+
TP_PROTO(const struct fw_iso_context *ctx),
663+
TP_ARGS(ctx),
664+
TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE)
665+
);
666+
667+
DEFINE_EVENT_CONDITION(isoc_stop_template, isoc_inbound_multiple_stop,
668+
TP_PROTO(const struct fw_iso_context *ctx),
669+
TP_ARGS(ctx),
670+
TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL)
671+
);
672+
565673
#undef QUADLET_SIZE
566674

567675
#endif // _FIREWIRE_TRACE_EVENT_H

0 commit comments

Comments
 (0)