Skip to content

Commit 25e6e00

Browse files
committed
firewire: core: add tracepoints events for allocation/deallocation of isochronous context
It is helpful to trace the allocation and dealocation of isochronous 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 ae24ba7 commit 25e6e00

File tree

2 files changed

+115
-0
lines changed

2 files changed

+115
-0
lines changed

drivers/firewire/core-iso.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
#include "core.h"
2424

25+
#include <trace/events/firewire.h>
26+
2527
/*
2628
* Isochronous DMA context management
2729
*/
@@ -148,12 +150,20 @@ struct fw_iso_context *fw_iso_context_create(struct fw_card *card,
148150
ctx->callback.sc = callback;
149151
ctx->callback_data = callback_data;
150152

153+
trace_isoc_outbound_allocate(ctx, channel, speed);
154+
trace_isoc_inbound_single_allocate(ctx, channel, header_size);
155+
trace_isoc_inbound_multiple_allocate(ctx);
156+
151157
return ctx;
152158
}
153159
EXPORT_SYMBOL(fw_iso_context_create);
154160

155161
void fw_iso_context_destroy(struct fw_iso_context *ctx)
156162
{
163+
trace_isoc_outbound_destroy(ctx);
164+
trace_isoc_inbound_single_destroy(ctx);
165+
trace_isoc_inbound_multiple_destroy(ctx);
166+
157167
ctx->card->driver->free_iso_context(ctx);
158168
}
159169
EXPORT_SYMBOL(fw_iso_context_destroy);

include/trace/events/firewire.h

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,111 @@ TRACE_EVENT(self_id_sequence,
436436
#undef PHY_PACKET_SELF_ID_GET_POWER_CLASS
437437
#undef PHY_PACKET_SELF_ID_GET_INITIATED_RESET
438438

439+
TRACE_EVENT_CONDITION(isoc_outbound_allocate,
440+
TP_PROTO(const struct fw_iso_context *ctx, unsigned int channel, unsigned int scode),
441+
TP_ARGS(ctx, channel, scode),
442+
TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT),
443+
TP_STRUCT__entry(
444+
__field(u64, context)
445+
__field(u8, card_index)
446+
__field(u8, channel)
447+
__field(u8, scode)
448+
),
449+
TP_fast_assign(
450+
__entry->context = (uintptr_t)ctx;
451+
__entry->card_index = ctx->card->index;
452+
__entry->channel = channel;
453+
__entry->scode = scode;
454+
),
455+
TP_printk(
456+
"context=0x%llx card_index=%u channel=%u scode=%u",
457+
__entry->context,
458+
__entry->card_index,
459+
__entry->channel,
460+
__entry->scode
461+
)
462+
);
463+
464+
TRACE_EVENT_CONDITION(isoc_inbound_single_allocate,
465+
TP_PROTO(const struct fw_iso_context *ctx, unsigned int channel, unsigned int header_size),
466+
TP_ARGS(ctx, channel, header_size),
467+
TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE),
468+
TP_STRUCT__entry(
469+
__field(u64, context)
470+
__field(u8, card_index)
471+
__field(u8, channel)
472+
__field(u8, header_size)
473+
),
474+
TP_fast_assign(
475+
__entry->context = (uintptr_t)ctx;
476+
__entry->card_index = ctx->card->index;
477+
__entry->channel = channel;
478+
__entry->header_size = header_size;
479+
),
480+
TP_printk(
481+
"context=0x%llx card_index=%u channel=%u header_size=%u",
482+
__entry->context,
483+
__entry->card_index,
484+
__entry->channel,
485+
__entry->header_size
486+
)
487+
);
488+
489+
TRACE_EVENT_CONDITION(isoc_inbound_multiple_allocate,
490+
TP_PROTO(const struct fw_iso_context *ctx),
491+
TP_ARGS(ctx),
492+
TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL),
493+
TP_STRUCT__entry(
494+
__field(u64, context)
495+
__field(u8, card_index)
496+
),
497+
TP_fast_assign(
498+
__entry->context = (uintptr_t)ctx;
499+
__entry->card_index = ctx->card->index;
500+
),
501+
TP_printk(
502+
"context=0x%llx card_index=%u",
503+
__entry->context,
504+
__entry->card_index
505+
)
506+
);
507+
508+
DECLARE_EVENT_CLASS(isoc_destroy_template,
509+
TP_PROTO(const struct fw_iso_context *ctx),
510+
TP_ARGS(ctx),
511+
TP_STRUCT__entry(
512+
__field(u64, context)
513+
__field(u8, card_index)
514+
),
515+
TP_fast_assign(
516+
__entry->context = (uintptr_t)ctx;
517+
__entry->card_index = ctx->card->index;
518+
),
519+
TP_printk(
520+
"context=0x%llx card_index=%u",
521+
__entry->context,
522+
__entry->card_index
523+
)
524+
)
525+
526+
DEFINE_EVENT_CONDITION(isoc_destroy_template, isoc_outbound_destroy,
527+
TP_PROTO(const struct fw_iso_context *ctx),
528+
TP_ARGS(ctx),
529+
TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT)
530+
);
531+
532+
DEFINE_EVENT_CONDITION(isoc_destroy_template, isoc_inbound_single_destroy,
533+
TP_PROTO(const struct fw_iso_context *ctx),
534+
TP_ARGS(ctx),
535+
TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE)
536+
);
537+
538+
DEFINE_EVENT_CONDITION(isoc_destroy_template, isoc_inbound_multiple_destroy,
539+
TP_PROTO(const struct fw_iso_context *ctx),
540+
TP_ARGS(ctx),
541+
TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL)
542+
);
543+
439544
#undef QUADLET_SIZE
440545

441546
#endif // _FIREWIRE_TRACE_EVENT_H

0 commit comments

Comments
 (0)