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 completions of packets in isochronous context

It is helpful to trace completion of packets in isochronous context when
the core function is requested them by both in-kernel units driver and
userspace applications.

This commit adds some tracepoints events for the aim.

Link: https://lore.kernel.org/r/20240623220859.851685-8-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

+99 -6
+4
drivers/firewire/core-trace.c
··· 20 20 self_id_sequence_get_port_status(self_id_sequence, quadlet_count, port_index); 21 21 } 22 22 } 23 + 24 + EXPORT_TRACEPOINT_SYMBOL_GPL(isoc_inbound_single_completions); 25 + EXPORT_TRACEPOINT_SYMBOL_GPL(isoc_inbound_multiple_completions); 26 + EXPORT_TRACEPOINT_SYMBOL_GPL(isoc_outbound_completions); 23 27 #endif
+17 -6
drivers/firewire/ohci.c
··· 2833 2833 } 2834 2834 } 2835 2835 2836 - static void flush_iso_completions(struct iso_context *ctx) 2836 + static void flush_iso_completions(struct iso_context *ctx, enum fw_iso_context_completions_cause cause) 2837 2837 { 2838 + trace_isoc_inbound_single_completions(&ctx->base, ctx->last_timestamp, cause, ctx->header, 2839 + ctx->header_length); 2840 + trace_isoc_outbound_completions(&ctx->base, ctx->last_timestamp, cause, ctx->header, 2841 + ctx->header_length); 2842 + 2838 2843 ctx->base.callback.sc(&ctx->base, ctx->last_timestamp, 2839 2844 ctx->header_length, ctx->header, 2840 2845 ctx->base.callback_data); ··· 2853 2848 if (ctx->header_length + ctx->base.header_size > PAGE_SIZE) { 2854 2849 if (ctx->base.drop_overflow_headers) 2855 2850 return; 2856 - flush_iso_completions(ctx); 2851 + flush_iso_completions(ctx, FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERFLOW); 2857 2852 } 2858 2853 2859 2854 ctx_hdr = ctx->header + ctx->header_length; ··· 2902 2897 copy_iso_headers(ctx, (u32 *) (last + 1)); 2903 2898 2904 2899 if (last->control & cpu_to_le16(DESCRIPTOR_IRQ_ALWAYS)) 2905 - flush_iso_completions(ctx); 2900 + flush_iso_completions(ctx, FW_ISO_CONTEXT_COMPLETIONS_CAUSE_IRQ); 2906 2901 2907 2902 return 1; 2908 2903 } ··· 2937 2932 completed, DMA_FROM_DEVICE); 2938 2933 2939 2934 if (last->control & cpu_to_le16(DESCRIPTOR_IRQ_ALWAYS)) { 2935 + trace_isoc_inbound_multiple_completions(&ctx->base, completed, 2936 + FW_ISO_CONTEXT_COMPLETIONS_CAUSE_IRQ); 2937 + 2940 2938 ctx->base.callback.mc(&ctx->base, 2941 2939 buffer_dma + completed, 2942 2940 ctx->base.callback_data); ··· 2955 2947 ctx->mc_buffer_bus & PAGE_MASK, 2956 2948 ctx->mc_buffer_bus & ~PAGE_MASK, 2957 2949 ctx->mc_completed, DMA_FROM_DEVICE); 2950 + 2951 + trace_isoc_inbound_multiple_completions(&ctx->base, ctx->mc_completed, 2952 + FW_ISO_CONTEXT_COMPLETIONS_CAUSE_FLUSH); 2958 2953 2959 2954 ctx->base.callback.mc(&ctx->base, 2960 2955 ctx->mc_buffer_bus + ctx->mc_completed, ··· 3023 3012 if (ctx->header_length + 4 > PAGE_SIZE) { 3024 3013 if (ctx->base.drop_overflow_headers) 3025 3014 return 1; 3026 - flush_iso_completions(ctx); 3015 + flush_iso_completions(ctx, FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERFLOW); 3027 3016 } 3028 3017 3029 3018 ctx_hdr = ctx->header + ctx->header_length; ··· 3034 3023 ctx->header_length += 4; 3035 3024 3036 3025 if (last->control & cpu_to_le16(DESCRIPTOR_IRQ_ALWAYS)) 3037 - flush_iso_completions(ctx); 3026 + flush_iso_completions(ctx, FW_ISO_CONTEXT_COMPLETIONS_CAUSE_IRQ); 3038 3027 3039 3028 return 1; 3040 3029 } ··· 3599 3588 case FW_ISO_CONTEXT_TRANSMIT: 3600 3589 case FW_ISO_CONTEXT_RECEIVE: 3601 3590 if (ctx->header_length != 0) 3602 - flush_iso_completions(ctx); 3591 + flush_iso_completions(ctx, FW_ISO_CONTEXT_COMPLETIONS_CAUSE_FLUSH); 3603 3592 break; 3604 3593 case FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL: 3605 3594 if (ctx->mc_completed != 0)
+78
include/trace/events/firewire.h
··· 821 821 #undef TP_STRUCT__entry_iso_packet 822 822 #undef TP_fast_assign_iso_packet 823 823 824 + #ifndef show_cause 825 + enum fw_iso_context_completions_cause { 826 + FW_ISO_CONTEXT_COMPLETIONS_CAUSE_FLUSH = 0, 827 + FW_ISO_CONTEXT_COMPLETIONS_CAUSE_IRQ, 828 + FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERFLOW, 829 + }; 830 + #define show_cause(cause) \ 831 + __print_symbolic(cause, \ 832 + { FW_ISO_CONTEXT_COMPLETIONS_CAUSE_FLUSH, "FLUSH" }, \ 833 + { FW_ISO_CONTEXT_COMPLETIONS_CAUSE_IRQ, "IRQ" }, \ 834 + { FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERFLOW, "HEADER_OVERFLOW" } \ 835 + ) 836 + #endif 837 + 838 + DECLARE_EVENT_CLASS(isoc_single_completions_template, 839 + TP_PROTO(const struct fw_iso_context *ctx, u16 timestamp, enum fw_iso_context_completions_cause cause, const u32 *header, unsigned int header_length), 840 + TP_ARGS(ctx, timestamp, cause, header, header_length), 841 + TP_STRUCT__entry( 842 + __field(u64, context) 843 + __field(u8, card_index) 844 + __field(u16, timestamp) 845 + __field(u8, cause) 846 + __dynamic_array(u32, header, header_length / QUADLET_SIZE) 847 + ), 848 + TP_fast_assign( 849 + __entry->context = (uintptr_t)ctx; 850 + __entry->card_index = ctx->card->index; 851 + __entry->timestamp = timestamp; 852 + __entry->cause = cause; 853 + memcpy(__get_dynamic_array(header), header, __get_dynamic_array_len(header)); 854 + ), 855 + TP_printk( 856 + "context=0x%llx card_index=%u timestap=0x%04x cause=%s header=%s", 857 + __entry->context, 858 + __entry->card_index, 859 + __entry->timestamp, 860 + show_cause(__entry->cause), 861 + __print_array(__get_dynamic_array(header), 862 + __get_dynamic_array_len(header) / QUADLET_SIZE, QUADLET_SIZE) 863 + ) 864 + ) 865 + 866 + DEFINE_EVENT_CONDITION(isoc_single_completions_template, isoc_outbound_completions, 867 + TP_PROTO(const struct fw_iso_context *ctx, u16 timestamp, enum fw_iso_context_completions_cause cause, const u32 *header, unsigned int header_length), 868 + TP_ARGS(ctx, timestamp, cause, header, header_length), 869 + TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT) 870 + ); 871 + 872 + DEFINE_EVENT_CONDITION(isoc_single_completions_template, isoc_inbound_single_completions, 873 + TP_PROTO(const struct fw_iso_context *ctx, u16 timestamp, enum fw_iso_context_completions_cause cause, const u32 *header, unsigned int header_length), 874 + TP_ARGS(ctx, timestamp, cause, header, header_length), 875 + TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE) 876 + ); 877 + 878 + TRACE_EVENT(isoc_inbound_multiple_completions, 879 + TP_PROTO(const struct fw_iso_context *ctx, unsigned int completed, enum fw_iso_context_completions_cause cause), 880 + TP_ARGS(ctx, completed, cause), 881 + TP_STRUCT__entry( 882 + __field(u64, context) 883 + __field(u8, card_index) 884 + __field(u16, completed) 885 + __field(u8, cause) 886 + ), 887 + TP_fast_assign( 888 + __entry->context = (uintptr_t)ctx; 889 + __entry->card_index = ctx->card->index; 890 + __entry->completed = completed; 891 + __entry->cause = cause; 892 + ), 893 + TP_printk( 894 + "context=0x%llx card_index=%u comleted=%u cause=%s", 895 + __entry->context, 896 + __entry->card_index, 897 + __entry->completed, 898 + show_cause(__entry->cause) 899 + ) 900 + ); 901 + 824 902 #undef QUADLET_SIZE 825 903 826 904 #endif // _FIREWIRE_TRACE_EVENT_H