Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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/20240623220859.851685-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

+115
+10
drivers/firewire/core-iso.c
··· 22 22 23 23 #include "core.h" 24 24 25 + #include <trace/events/firewire.h> 26 + 25 27 /* 26 28 * Isochronous DMA context management 27 29 */ ··· 150 148 ctx->callback.sc = callback; 151 149 ctx->callback_data = callback_data; 152 150 151 + trace_isoc_outbound_allocate(ctx, channel, speed); 152 + trace_isoc_inbound_single_allocate(ctx, channel, header_size); 153 + trace_isoc_inbound_multiple_allocate(ctx); 154 + 153 155 return ctx; 154 156 } 155 157 EXPORT_SYMBOL(fw_iso_context_create); 156 158 157 159 void fw_iso_context_destroy(struct fw_iso_context *ctx) 158 160 { 161 + trace_isoc_outbound_destroy(ctx); 162 + trace_isoc_inbound_single_destroy(ctx); 163 + trace_isoc_inbound_multiple_destroy(ctx); 164 + 159 165 ctx->card->driver->free_iso_context(ctx); 160 166 } 161 167 EXPORT_SYMBOL(fw_iso_context_destroy);
+105
include/trace/events/firewire.h
··· 436 436 #undef PHY_PACKET_SELF_ID_GET_POWER_CLASS 437 437 #undef PHY_PACKET_SELF_ID_GET_INITIATED_RESET 438 438 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 + 439 544 #undef QUADLET_SIZE 440 545 441 546 #endif // _FIREWIRE_TRACE_EVENT_H