All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] ALSA: firewire-lib: unify tracing events for isoc packet
@ 2019-05-19 10:01 Takashi Sakamoto
  2019-05-19 10:01 ` [PATCH 1/5] firewire-lib: use the same type of argument for CIP header for tracing event Takashi Sakamoto
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Takashi Sakamoto @ 2019-05-19 10:01 UTC (permalink / raw)
  To: clemens, tiwai; +Cc: alsa-devel

Hi,

This patchset is for Linux kernel v5.3 development.

ALSA IEC 61883-1/6 packet streaming engine has four types of tracing
events to probe data of handled isochronous packets on IEEE 1394 bus.
The most parameters of data are common independent of type of
isochronous payload and inbound/outbound direction.

This commit unifies the tracing events as 'amdtp_packet'. Instead of
named tracing events, filtering functionality of Linux tracing
framework is available to filter out target events, like:

$ echo 'src == 0xffc0' > /sys/kernel/debug/tracing/events/snd_firewire_lib/amdtp_packet/filter
$ echo 1 > /sys/kernel/debug/tracing/events/snd_firewire_lib/amdtp_packet/enable
$ cat /sys/kernel/debug/tracing/trace
...
...: amdtp_packet: 00 0594 ffc0 ffc1 00 002 00 240 41 1 09 {0x0,0x2,0x0,0xf0,0x90,0x1,0xff,0xff}
...: amdtp_packet: 00 0595 ffc0 ffc1 00 018 08 240 42 1 10 {0x0,0x2,0x0,0xf0,0x90,0x1,0x4b,0x3d}

Takashi Sakamoto (5):
  firewire-lib: use the same type of argument for CIP header for tracing
    event
  firewire-lib: add data_blocks/data_block_counter parameter to
    in_packet/out_packet tracing events
  firewire-lib: use the same unit for payload argument in tracing events
  firewire-lib: use dynamic array for CIP header of tracing events
  firewire-lib: unify tracing events to 'amdtp_packet' event

 sound/firewire/amdtp-stream-trace.h | 163 ++++------------------------
 sound/firewire/amdtp-stream.c       |  16 +--
 2 files changed, 28 insertions(+), 151 deletions(-)

-- 
2.20.1

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

* [PATCH 1/5] firewire-lib: use the same type of argument for CIP header for tracing event
  2019-05-19 10:01 [PATCH 0/5] ALSA: firewire-lib: unify tracing events for isoc packet Takashi Sakamoto
@ 2019-05-19 10:01 ` Takashi Sakamoto
  2019-05-19 10:01 ` [PATCH 2/5] firewire-lib: add data_blocks/data_block_counter parameter to in_packet/out_packet tracing events Takashi Sakamoto
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Takashi Sakamoto @ 2019-05-19 10:01 UTC (permalink / raw)
  To: clemens, tiwai; +Cc: alsa-devel

An argument for CIP header in 'in_packet' event is not the same type in
'out_packet' event. This is not good to unify these events.

This commit uses the same type of argument for these events.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/amdtp-stream-trace.h | 6 +++---
 sound/firewire/amdtp-stream.c       | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/firewire/amdtp-stream-trace.h b/sound/firewire/amdtp-stream-trace.h
index ac20acf48fc6..a86a827eab90 100644
--- a/sound/firewire/amdtp-stream-trace.h
+++ b/sound/firewire/amdtp-stream-trace.h
@@ -14,7 +14,7 @@
 #include <linux/tracepoint.h>
 
 TRACE_EVENT(in_packet,
-	TP_PROTO(const struct amdtp_stream *s, u32 cycles, u32 *cip_header, unsigned int payload_length, unsigned int index),
+	TP_PROTO(const struct amdtp_stream *s, u32 cycles, const __be32 *cip_header, unsigned int payload_length, unsigned int index),
 	TP_ARGS(s, cycles, cip_header, payload_length, index),
 	TP_STRUCT__entry(
 		__field(unsigned int, second)
@@ -35,8 +35,8 @@ TRACE_EVENT(in_packet,
 		__entry->channel = s->context->channel;
 		__entry->src = fw_parent_device(s->unit)->node_id;
 		__entry->dest = fw_parent_device(s->unit)->card->node_id;
-		__entry->cip_header0 = cip_header[0];
-		__entry->cip_header1 = cip_header[1];
+		__entry->cip_header0 = be32_to_cpu(cip_header[0]);
+		__entry->cip_header1 = be32_to_cpu(cip_header[1]);
 		__entry->payload_quadlets = payload_length / 4;
 		__entry->packet_index = s->packet_index;
 		__entry->irq = !!in_interrupt();
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index 43f28b813386..2614fa551e24 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -555,7 +555,7 @@ static int handle_in_packet(struct amdtp_stream *s,
 	cip_header[0] = be32_to_cpu(buffer[0]);
 	cip_header[1] = be32_to_cpu(buffer[1]);
 
-	trace_in_packet(s, cycle, cip_header, payload_length, index);
+	trace_in_packet(s, cycle, buffer, payload_length, index);
 
 	/*
 	 * This module supports 'Two-quadlet CIP header with SYT field'.
-- 
2.20.1

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

* [PATCH 2/5] firewire-lib: add data_blocks/data_block_counter parameter to in_packet/out_packet tracing events
  2019-05-19 10:01 [PATCH 0/5] ALSA: firewire-lib: unify tracing events for isoc packet Takashi Sakamoto
  2019-05-19 10:01 ` [PATCH 1/5] firewire-lib: use the same type of argument for CIP header for tracing event Takashi Sakamoto
@ 2019-05-19 10:01 ` Takashi Sakamoto
  2019-05-19 10:01 ` [PATCH 3/5] firewire-lib: use the same unit for payload argument in " Takashi Sakamoto
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Takashi Sakamoto @ 2019-05-19 10:01 UTC (permalink / raw)
  To: clemens, tiwai; +Cc: alsa-devel

Tracing events for packets without CIP header have a parameter of
data_blocks/data_block_counter, but events for packets with CIP header
don't. This is not good to unify these events.

This commit adds the missing parameters to the events. In timing to
probe 'in_packet' event, data_blocks and data_block_counter are not
calculated yet. This commit also changes the timing.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/amdtp-stream-trace.h | 24 ++++++++++++++++++------
 sound/firewire/amdtp-stream.c       |  6 +++---
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/sound/firewire/amdtp-stream-trace.h b/sound/firewire/amdtp-stream-trace.h
index a86a827eab90..95343fb17583 100644
--- a/sound/firewire/amdtp-stream-trace.h
+++ b/sound/firewire/amdtp-stream-trace.h
@@ -14,8 +14,8 @@
 #include <linux/tracepoint.h>
 
 TRACE_EVENT(in_packet,
-	TP_PROTO(const struct amdtp_stream *s, u32 cycles, const __be32 *cip_header, unsigned int payload_length, unsigned int index),
-	TP_ARGS(s, cycles, cip_header, payload_length, index),
+	TP_PROTO(const struct amdtp_stream *s, u32 cycles, const __be32 *cip_header, unsigned int payload_length, unsigned int data_blocks, unsigned int index),
+	TP_ARGS(s, cycles, cip_header, payload_length, data_blocks, index),
 	TP_STRUCT__entry(
 		__field(unsigned int, second)
 		__field(unsigned int, cycle)
@@ -25,6 +25,8 @@ TRACE_EVENT(in_packet,
 		__field(u32, cip_header0)
 		__field(u32, cip_header1)
 		__field(unsigned int, payload_quadlets)
+		__field(unsigned int, data_blocks)
+		__field(unsigned int, data_block_counter)
 		__field(unsigned int, packet_index)
 		__field(unsigned int, irq)
 		__field(unsigned int, index)
@@ -38,12 +40,14 @@ TRACE_EVENT(in_packet,
 		__entry->cip_header0 = be32_to_cpu(cip_header[0]);
 		__entry->cip_header1 = be32_to_cpu(cip_header[1]);
 		__entry->payload_quadlets = payload_length / 4;
+		__entry->data_blocks = data_blocks;
+		__entry->data_block_counter = s->data_block_counter,
 		__entry->packet_index = s->packet_index;
 		__entry->irq = !!in_interrupt();
 		__entry->index = index;
 	),
 	TP_printk(
-		"%02u %04u %04x %04x %02d %08x %08x %03u %02u %01u %02u",
+		"%02u %04u %04x %04x %02d %08x %08x %03u %02u %03u %02u %01u %02u",
 		__entry->second,
 		__entry->cycle,
 		__entry->src,
@@ -52,14 +56,16 @@ TRACE_EVENT(in_packet,
 		__entry->cip_header0,
 		__entry->cip_header1,
 		__entry->payload_quadlets,
+		__entry->data_blocks,
+		__entry->data_block_counter,
 		__entry->packet_index,
 		__entry->irq,
 		__entry->index)
 );
 
 TRACE_EVENT(out_packet,
-	TP_PROTO(const struct amdtp_stream *s, u32 cycles, __be32 *cip_header, unsigned int payload_length, unsigned int index),
-	TP_ARGS(s, cycles, cip_header, payload_length, index),
+	TP_PROTO(const struct amdtp_stream *s, u32 cycles, const __be32 *cip_header, unsigned int payload_length, unsigned int data_blocks, unsigned int index),
+	TP_ARGS(s, cycles, cip_header, payload_length, data_blocks, index),
 	TP_STRUCT__entry(
 		__field(unsigned int, second)
 		__field(unsigned int, cycle)
@@ -69,6 +75,8 @@ TRACE_EVENT(out_packet,
 		__field(u32, cip_header0)
 		__field(u32, cip_header1)
 		__field(unsigned int, payload_quadlets)
+		__field(unsigned int, data_blocks)
+		__field(unsigned int, data_block_counter)
 		__field(unsigned int, packet_index)
 		__field(unsigned int, irq)
 		__field(unsigned int, index)
@@ -82,12 +90,14 @@ TRACE_EVENT(out_packet,
 		__entry->cip_header0 = be32_to_cpu(cip_header[0]);
 		__entry->cip_header1 = be32_to_cpu(cip_header[1]);
 		__entry->payload_quadlets = payload_length / 4;
+		__entry->data_blocks = data_blocks;
+		__entry->data_block_counter = s->data_block_counter,
 		__entry->packet_index = s->packet_index;
 		__entry->irq = !!in_interrupt();
 		__entry->index = index;
 	),
 	TP_printk(
-		"%02u %04u %04x %04x %02d %08x %08x %03u %02u %01u %02u",
+		"%02u %04u %04x %04x %02d %08x %08x %03u %02u %03u %02u %01u %02u",
 		__entry->second,
 		__entry->cycle,
 		__entry->src,
@@ -96,6 +106,8 @@ TRACE_EVENT(out_packet,
 		__entry->cip_header0,
 		__entry->cip_header1,
 		__entry->payload_quadlets,
+		__entry->data_blocks,
+		__entry->data_block_counter,
 		__entry->packet_index,
 		__entry->irq,
 		__entry->index)
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index 2614fa551e24..67b60490e505 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -493,7 +493,7 @@ static int handle_out_packet(struct amdtp_stream *s,
 				(s->data_block_counter + data_blocks) & 0xff;
 	payload_length = 8 + data_blocks * 4 * s->data_block_quadlets;
 
-	trace_out_packet(s, cycle, buffer, payload_length, index);
+	trace_out_packet(s, cycle, buffer, payload_length, data_blocks, index);
 
 	if (queue_out_packet(s, payload_length) < 0)
 		return -EIO;
@@ -555,8 +555,6 @@ static int handle_in_packet(struct amdtp_stream *s,
 	cip_header[0] = be32_to_cpu(buffer[0]);
 	cip_header[1] = be32_to_cpu(buffer[1]);
 
-	trace_in_packet(s, cycle, buffer, payload_length, index);
-
 	/*
 	 * This module supports 'Two-quadlet CIP header with SYT field'.
 	 * For convenience, also check FMT field is AM824 or not.
@@ -635,6 +633,8 @@ static int handle_in_packet(struct amdtp_stream *s,
 		return -EIO;
 	}
 
+	trace_in_packet(s, cycle, buffer, payload_length, data_blocks, index);
+
 	syt = be32_to_cpu(buffer[1]) & CIP_SYT_MASK;
 	pcm_frames = s->process_data_blocks(s, buffer + 2, data_blocks, &syt);
 
-- 
2.20.1

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

* [PATCH 3/5] firewire-lib: use the same unit for payload argument in tracing events
  2019-05-19 10:01 [PATCH 0/5] ALSA: firewire-lib: unify tracing events for isoc packet Takashi Sakamoto
  2019-05-19 10:01 ` [PATCH 1/5] firewire-lib: use the same type of argument for CIP header for tracing event Takashi Sakamoto
  2019-05-19 10:01 ` [PATCH 2/5] firewire-lib: add data_blocks/data_block_counter parameter to in_packet/out_packet tracing events Takashi Sakamoto
@ 2019-05-19 10:01 ` Takashi Sakamoto
  2019-05-19 10:01 ` [PATCH 4/5] firewire-lib: use dynamic array for CIP header of " Takashi Sakamoto
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Takashi Sakamoto @ 2019-05-19 10:01 UTC (permalink / raw)
  To: clemens, tiwai; +Cc: alsa-devel

The most of tracing event in this module have the size of payload in
byte unit, however 'in_packet_without_header' event have the argument
in quadlet unit.

This commit change the unit for argument to be consistent.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/amdtp-stream-trace.h | 12 ++++++------
 sound/firewire/amdtp-stream.c       |  6 ++----
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/sound/firewire/amdtp-stream-trace.h b/sound/firewire/amdtp-stream-trace.h
index 95343fb17583..30c547552cd2 100644
--- a/sound/firewire/amdtp-stream-trace.h
+++ b/sound/firewire/amdtp-stream-trace.h
@@ -39,7 +39,7 @@ TRACE_EVENT(in_packet,
 		__entry->dest = fw_parent_device(s->unit)->card->node_id;
 		__entry->cip_header0 = be32_to_cpu(cip_header[0]);
 		__entry->cip_header1 = be32_to_cpu(cip_header[1]);
-		__entry->payload_quadlets = payload_length / 4;
+		__entry->payload_quadlets = payload_length / sizeof(__be32);
 		__entry->data_blocks = data_blocks;
 		__entry->data_block_counter = s->data_block_counter,
 		__entry->packet_index = s->packet_index;
@@ -89,7 +89,7 @@ TRACE_EVENT(out_packet,
 		__entry->dest = fw_parent_device(s->unit)->node_id;
 		__entry->cip_header0 = be32_to_cpu(cip_header[0]);
 		__entry->cip_header1 = be32_to_cpu(cip_header[1]);
-		__entry->payload_quadlets = payload_length / 4;
+		__entry->payload_quadlets = payload_length / sizeof(__be32);
 		__entry->data_blocks = data_blocks;
 		__entry->data_block_counter = s->data_block_counter,
 		__entry->packet_index = s->packet_index;
@@ -114,8 +114,8 @@ TRACE_EVENT(out_packet,
 );
 
 TRACE_EVENT(in_packet_without_header,
-	TP_PROTO(const struct amdtp_stream *s, u32 cycles, unsigned int payload_quadlets, unsigned int data_blocks, unsigned int index),
-	TP_ARGS(s, cycles, payload_quadlets, data_blocks, index),
+	TP_PROTO(const struct amdtp_stream *s, u32 cycles, unsigned int payload_length, unsigned int data_blocks, unsigned int index),
+	TP_ARGS(s, cycles, payload_length, data_blocks, index),
 	TP_STRUCT__entry(
 		__field(unsigned int, second)
 		__field(unsigned int, cycle)
@@ -135,7 +135,7 @@ TRACE_EVENT(in_packet_without_header,
 		__entry->channel = s->context->channel;
 		__entry->src = fw_parent_device(s->unit)->node_id;
 		__entry->dest = fw_parent_device(s->unit)->card->node_id;
-		__entry->payload_quadlets = payload_quadlets;
+		__entry->payload_quadlets = payload_length / sizeof(__be32);
 		__entry->data_blocks = data_blocks,
 		__entry->data_block_counter = s->data_block_counter,
 		__entry->packet_index = s->packet_index;
@@ -179,7 +179,7 @@ TRACE_EVENT(out_packet_without_header,
 		__entry->channel = s->context->channel;
 		__entry->src = fw_parent_device(s->unit)->card->node_id;
 		__entry->dest = fw_parent_device(s->unit)->node_id;
-		__entry->payload_quadlets = payload_length / 4;
+		__entry->payload_quadlets = payload_length / sizeof(__be32);
 		__entry->data_blocks = data_blocks,
 		__entry->data_block_counter = s->data_block_counter,
 		__entry->packet_index = s->packet_index;
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index 67b60490e505..15ae1f2989e5 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -659,16 +659,14 @@ static int handle_in_packet_without_header(struct amdtp_stream *s,
 			unsigned int index)
 {
 	__be32 *buffer;
-	unsigned int payload_quadlets;
 	unsigned int data_blocks;
 	struct snd_pcm_substream *pcm;
 	unsigned int pcm_frames;
 
 	buffer = s->buffer.packets[s->packet_index].buffer;
-	payload_quadlets = payload_length / 4;
-	data_blocks = payload_quadlets / s->data_block_quadlets;
+	data_blocks = payload_length / sizeof(__be32) / s->data_block_quadlets;
 
-	trace_in_packet_without_header(s, cycle, payload_quadlets, data_blocks,
+	trace_in_packet_without_header(s, cycle, payload_length, data_blocks,
 				       index);
 
 	pcm_frames = s->process_data_blocks(s, buffer, data_blocks, NULL);
-- 
2.20.1

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

* [PATCH 4/5] firewire-lib: use dynamic array for CIP header of tracing events
  2019-05-19 10:01 [PATCH 0/5] ALSA: firewire-lib: unify tracing events for isoc packet Takashi Sakamoto
                   ` (2 preceding siblings ...)
  2019-05-19 10:01 ` [PATCH 3/5] firewire-lib: use the same unit for payload argument in " Takashi Sakamoto
@ 2019-05-19 10:01 ` Takashi Sakamoto
  2019-05-19 10:01 ` [PATCH 5/5] firewire-lib: unify tracing events to 'amdtp_packet' event Takashi Sakamoto
  2019-05-21  5:48 ` [PATCH 0/5] ALSA: firewire-lib: unify tracing events for isoc packet Takashi Iwai
  5 siblings, 0 replies; 7+ messages in thread
From: Takashi Sakamoto @ 2019-05-19 10:01 UTC (permalink / raw)
  To: clemens, tiwai; +Cc: alsa-devel

This modules handles two types of isochronous packet; one has CIP header
in IEC 61883-1/6 and another doesn't. The module also have tracing events
corresponding to the types of packet. To unify the events, one event
should be probed with or without CIP header.

This commit uses dynamic array for the events to be available for the
types of packet.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/amdtp-stream-trace.h | 36 ++++++++++++++++-------------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/sound/firewire/amdtp-stream-trace.h b/sound/firewire/amdtp-stream-trace.h
index 30c547552cd2..614dfd08aa48 100644
--- a/sound/firewire/amdtp-stream-trace.h
+++ b/sound/firewire/amdtp-stream-trace.h
@@ -22,8 +22,7 @@ TRACE_EVENT(in_packet,
 		__field(int, channel)
 		__field(int, src)
 		__field(int, dest)
-		__field(u32, cip_header0)
-		__field(u32, cip_header1)
+		__dynamic_array(u8, cip_header, cip_header ? 8 : 0)
 		__field(unsigned int, payload_quadlets)
 		__field(unsigned int, data_blocks)
 		__field(unsigned int, data_block_counter)
@@ -37,8 +36,10 @@ TRACE_EVENT(in_packet,
 		__entry->channel = s->context->channel;
 		__entry->src = fw_parent_device(s->unit)->node_id;
 		__entry->dest = fw_parent_device(s->unit)->card->node_id;
-		__entry->cip_header0 = be32_to_cpu(cip_header[0]);
-		__entry->cip_header1 = be32_to_cpu(cip_header[1]);
+		if (cip_header) {
+			memcpy(__get_dynamic_array(cip_header), cip_header,
+			       __get_dynamic_array_len(cip_header));
+		}
 		__entry->payload_quadlets = payload_length / sizeof(__be32);
 		__entry->data_blocks = data_blocks;
 		__entry->data_block_counter = s->data_block_counter,
@@ -47,20 +48,21 @@ TRACE_EVENT(in_packet,
 		__entry->index = index;
 	),
 	TP_printk(
-		"%02u %04u %04x %04x %02d %08x %08x %03u %02u %03u %02u %01u %02u",
+		"%02u %04u %04x %04x %02d %03u %02u %03u %02u %01u %02u %s",
 		__entry->second,
 		__entry->cycle,
 		__entry->src,
 		__entry->dest,
 		__entry->channel,
-		__entry->cip_header0,
-		__entry->cip_header1,
 		__entry->payload_quadlets,
 		__entry->data_blocks,
 		__entry->data_block_counter,
 		__entry->packet_index,
 		__entry->irq,
-		__entry->index)
+		__entry->index,
+		__print_array(__get_dynamic_array(cip_header),
+			      __get_dynamic_array_len(cip_header),
+			      sizeof(u8)))
 );
 
 TRACE_EVENT(out_packet,
@@ -72,8 +74,7 @@ TRACE_EVENT(out_packet,
 		__field(int, channel)
 		__field(int, src)
 		__field(int, dest)
-		__field(u32, cip_header0)
-		__field(u32, cip_header1)
+		__dynamic_array(u8, cip_header, cip_header ? 8 : 0)
 		__field(unsigned int, payload_quadlets)
 		__field(unsigned int, data_blocks)
 		__field(unsigned int, data_block_counter)
@@ -87,8 +88,10 @@ TRACE_EVENT(out_packet,
 		__entry->channel = s->context->channel;
 		__entry->src = fw_parent_device(s->unit)->card->node_id;
 		__entry->dest = fw_parent_device(s->unit)->node_id;
-		__entry->cip_header0 = be32_to_cpu(cip_header[0]);
-		__entry->cip_header1 = be32_to_cpu(cip_header[1]);
+		if (cip_header) {
+			memcpy(__get_dynamic_array(cip_header), cip_header,
+			       __get_dynamic_array_len(cip_header));
+		}
 		__entry->payload_quadlets = payload_length / sizeof(__be32);
 		__entry->data_blocks = data_blocks;
 		__entry->data_block_counter = s->data_block_counter,
@@ -97,20 +100,21 @@ TRACE_EVENT(out_packet,
 		__entry->index = index;
 	),
 	TP_printk(
-		"%02u %04u %04x %04x %02d %08x %08x %03u %02u %03u %02u %01u %02u",
+		"%02u %04u %04x %04x %02d %03u %02u %03u %02u %01u %02u %s",
 		__entry->second,
 		__entry->cycle,
 		__entry->src,
 		__entry->dest,
 		__entry->channel,
-		__entry->cip_header0,
-		__entry->cip_header1,
 		__entry->payload_quadlets,
 		__entry->data_blocks,
 		__entry->data_block_counter,
 		__entry->packet_index,
 		__entry->irq,
-		__entry->index)
+		__entry->index,
+		__print_array(__get_dynamic_array(cip_header),
+			      __get_dynamic_array_len(cip_header),
+			      sizeof(u8)))
 );
 
 TRACE_EVENT(in_packet_without_header,
-- 
2.20.1

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

* [PATCH 5/5] firewire-lib: unify tracing events to 'amdtp_packet' event
  2019-05-19 10:01 [PATCH 0/5] ALSA: firewire-lib: unify tracing events for isoc packet Takashi Sakamoto
                   ` (3 preceding siblings ...)
  2019-05-19 10:01 ` [PATCH 4/5] firewire-lib: use dynamic array for CIP header of " Takashi Sakamoto
@ 2019-05-19 10:01 ` Takashi Sakamoto
  2019-05-21  5:48 ` [PATCH 0/5] ALSA: firewire-lib: unify tracing events for isoc packet Takashi Iwai
  5 siblings, 0 replies; 7+ messages in thread
From: Takashi Sakamoto @ 2019-05-19 10:01 UTC (permalink / raw)
  To: clemens, tiwai; +Cc: alsa-devel

Now four events of this module have the same arguments and probe timing.
This commit adds a new event, 'amdtp_packet', and replace them. Filtering
functionality of tracing framework is available to pick up events for
inbound/outbound isochronous packets.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/amdtp-stream-trace.h | 149 ++--------------------------
 sound/firewire/amdtp-stream.c       |  10 +-
 2 files changed, 11 insertions(+), 148 deletions(-)

diff --git a/sound/firewire/amdtp-stream-trace.h b/sound/firewire/amdtp-stream-trace.h
index 614dfd08aa48..ab708857979f 100644
--- a/sound/firewire/amdtp-stream-trace.h
+++ b/sound/firewire/amdtp-stream-trace.h
@@ -13,7 +13,7 @@
 
 #include <linux/tracepoint.h>
 
-TRACE_EVENT(in_packet,
+TRACE_EVENT(amdtp_packet,
 	TP_PROTO(const struct amdtp_stream *s, u32 cycles, const __be32 *cip_header, unsigned int payload_length, unsigned int data_blocks, unsigned int index),
 	TP_ARGS(s, cycles, cip_header, payload_length, data_blocks, index),
 	TP_STRUCT__entry(
@@ -34,60 +34,13 @@ TRACE_EVENT(in_packet,
 		__entry->second = cycles / CYCLES_PER_SECOND;
 		__entry->cycle = cycles % CYCLES_PER_SECOND;
 		__entry->channel = s->context->channel;
-		__entry->src = fw_parent_device(s->unit)->node_id;
-		__entry->dest = fw_parent_device(s->unit)->card->node_id;
-		if (cip_header) {
-			memcpy(__get_dynamic_array(cip_header), cip_header,
-			       __get_dynamic_array_len(cip_header));
+		if (s->direction == AMDTP_IN_STREAM) {
+			__entry->src = fw_parent_device(s->unit)->node_id;
+			__entry->dest = fw_parent_device(s->unit)->card->node_id;
+		} else {
+			__entry->src = fw_parent_device(s->unit)->card->node_id;
+			__entry->dest = fw_parent_device(s->unit)->node_id;
 		}
-		__entry->payload_quadlets = payload_length / sizeof(__be32);
-		__entry->data_blocks = data_blocks;
-		__entry->data_block_counter = s->data_block_counter,
-		__entry->packet_index = s->packet_index;
-		__entry->irq = !!in_interrupt();
-		__entry->index = index;
-	),
-	TP_printk(
-		"%02u %04u %04x %04x %02d %03u %02u %03u %02u %01u %02u %s",
-		__entry->second,
-		__entry->cycle,
-		__entry->src,
-		__entry->dest,
-		__entry->channel,
-		__entry->payload_quadlets,
-		__entry->data_blocks,
-		__entry->data_block_counter,
-		__entry->packet_index,
-		__entry->irq,
-		__entry->index,
-		__print_array(__get_dynamic_array(cip_header),
-			      __get_dynamic_array_len(cip_header),
-			      sizeof(u8)))
-);
-
-TRACE_EVENT(out_packet,
-	TP_PROTO(const struct amdtp_stream *s, u32 cycles, const __be32 *cip_header, unsigned int payload_length, unsigned int data_blocks, unsigned int index),
-	TP_ARGS(s, cycles, cip_header, payload_length, data_blocks, index),
-	TP_STRUCT__entry(
-		__field(unsigned int, second)
-		__field(unsigned int, cycle)
-		__field(int, channel)
-		__field(int, src)
-		__field(int, dest)
-		__dynamic_array(u8, cip_header, cip_header ? 8 : 0)
-		__field(unsigned int, payload_quadlets)
-		__field(unsigned int, data_blocks)
-		__field(unsigned int, data_block_counter)
-		__field(unsigned int, packet_index)
-		__field(unsigned int, irq)
-		__field(unsigned int, index)
-	),
-	TP_fast_assign(
-		__entry->second = cycles / CYCLES_PER_SECOND;
-		__entry->cycle = cycles % CYCLES_PER_SECOND;
-		__entry->channel = s->context->channel;
-		__entry->src = fw_parent_device(s->unit)->card->node_id;
-		__entry->dest = fw_parent_device(s->unit)->node_id;
 		if (cip_header) {
 			memcpy(__get_dynamic_array(cip_header), cip_header,
 			       __get_dynamic_array_len(cip_header));
@@ -117,94 +70,6 @@ TRACE_EVENT(out_packet,
 			      sizeof(u8)))
 );
 
-TRACE_EVENT(in_packet_without_header,
-	TP_PROTO(const struct amdtp_stream *s, u32 cycles, unsigned int payload_length, unsigned int data_blocks, unsigned int index),
-	TP_ARGS(s, cycles, payload_length, data_blocks, index),
-	TP_STRUCT__entry(
-		__field(unsigned int, second)
-		__field(unsigned int, cycle)
-		__field(int, channel)
-		__field(int, src)
-		__field(int, dest)
-		__field(unsigned int, payload_quadlets)
-		__field(unsigned int, data_blocks)
-		__field(unsigned int, data_block_counter)
-		__field(unsigned int, packet_index)
-		__field(unsigned int, irq)
-		__field(unsigned int, index)
-	),
-	TP_fast_assign(
-		__entry->second = cycles / CYCLES_PER_SECOND;
-		__entry->cycle = cycles % CYCLES_PER_SECOND;
-		__entry->channel = s->context->channel;
-		__entry->src = fw_parent_device(s->unit)->node_id;
-		__entry->dest = fw_parent_device(s->unit)->card->node_id;
-		__entry->payload_quadlets = payload_length / sizeof(__be32);
-		__entry->data_blocks = data_blocks,
-		__entry->data_block_counter = s->data_block_counter,
-		__entry->packet_index = s->packet_index;
-		__entry->irq = !!in_interrupt();
-		__entry->index = index;
-	),
-	TP_printk(
-		"%02u %04u %04x %04x %02d %03u %02u %03u %02u %01u %02u",
-		__entry->second,
-		__entry->cycle,
-		__entry->src,
-		__entry->dest,
-		__entry->channel,
-		__entry->payload_quadlets,
-		__entry->data_blocks,
-		__entry->data_block_counter,
-		__entry->packet_index,
-		__entry->irq,
-		__entry->index)
-);
-
-TRACE_EVENT(out_packet_without_header,
-	TP_PROTO(const struct amdtp_stream *s, u32 cycles, unsigned int payload_length, unsigned int data_blocks, unsigned int index),
-	TP_ARGS(s, cycles, payload_length, data_blocks, index),
-	TP_STRUCT__entry(
-		__field(unsigned int, second)
-		__field(unsigned int, cycle)
-		__field(int, channel)
-		__field(int, src)
-		__field(int, dest)
-		__field(unsigned int, payload_quadlets)
-		__field(unsigned int, data_blocks)
-		__field(unsigned int, data_block_counter)
-		__field(unsigned int, packet_index)
-		__field(unsigned int, irq)
-		__field(unsigned int, index)
-	),
-	TP_fast_assign(
-		__entry->second = cycles / CYCLES_PER_SECOND;
-		__entry->cycle = cycles % CYCLES_PER_SECOND;
-		__entry->channel = s->context->channel;
-		__entry->src = fw_parent_device(s->unit)->card->node_id;
-		__entry->dest = fw_parent_device(s->unit)->node_id;
-		__entry->payload_quadlets = payload_length / sizeof(__be32);
-		__entry->data_blocks = data_blocks,
-		__entry->data_block_counter = s->data_block_counter,
-		__entry->packet_index = s->packet_index;
-		__entry->irq = !!in_interrupt();
-		__entry->index = index;
-	),
-	TP_printk(
-		"%02u %04u %04x %04x %02d %03u %02u %03u %02u %01u %02u",
-		__entry->second,
-		__entry->cycle,
-		__entry->src,
-		__entry->dest,
-		__entry->channel,
-		__entry->payload_quadlets,
-		__entry->data_blocks,
-		__entry->data_block_counter,
-		__entry->packet_index,
-		__entry->irq,
-		__entry->index)
-);
-
 #endif
 
 #undef TRACE_INCLUDE_PATH
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index 15ae1f2989e5..6b3f936fab91 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -493,7 +493,7 @@ static int handle_out_packet(struct amdtp_stream *s,
 				(s->data_block_counter + data_blocks) & 0xff;
 	payload_length = 8 + data_blocks * 4 * s->data_block_quadlets;
 
-	trace_out_packet(s, cycle, buffer, payload_length, data_blocks, index);
+	trace_amdtp_packet(s, cycle, buffer, payload_length, data_blocks, index);
 
 	if (queue_out_packet(s, payload_length) < 0)
 		return -EIO;
@@ -524,8 +524,7 @@ static int handle_out_packet_without_header(struct amdtp_stream *s,
 
 	payload_length = data_blocks * 4 * s->data_block_quadlets;
 
-	trace_out_packet_without_header(s, cycle, payload_length, data_blocks,
-					index);
+	trace_amdtp_packet(s, cycle, NULL, payload_length, data_blocks, index);
 
 	if (queue_out_packet(s, payload_length) < 0)
 		return -EIO;
@@ -633,7 +632,7 @@ static int handle_in_packet(struct amdtp_stream *s,
 		return -EIO;
 	}
 
-	trace_in_packet(s, cycle, buffer, payload_length, data_blocks, index);
+	trace_amdtp_packet(s, cycle, buffer, payload_length, data_blocks, index);
 
 	syt = be32_to_cpu(buffer[1]) & CIP_SYT_MASK;
 	pcm_frames = s->process_data_blocks(s, buffer + 2, data_blocks, &syt);
@@ -666,8 +665,7 @@ static int handle_in_packet_without_header(struct amdtp_stream *s,
 	buffer = s->buffer.packets[s->packet_index].buffer;
 	data_blocks = payload_length / sizeof(__be32) / s->data_block_quadlets;
 
-	trace_in_packet_without_header(s, cycle, payload_length, data_blocks,
-				       index);
+	trace_amdtp_packet(s, cycle, NULL, payload_length, data_blocks, index);
 
 	pcm_frames = s->process_data_blocks(s, buffer, data_blocks, NULL);
 	s->data_block_counter = (s->data_block_counter + data_blocks) & 0xff;
-- 
2.20.1

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

* Re: [PATCH 0/5] ALSA: firewire-lib: unify tracing events for isoc packet
  2019-05-19 10:01 [PATCH 0/5] ALSA: firewire-lib: unify tracing events for isoc packet Takashi Sakamoto
                   ` (4 preceding siblings ...)
  2019-05-19 10:01 ` [PATCH 5/5] firewire-lib: unify tracing events to 'amdtp_packet' event Takashi Sakamoto
@ 2019-05-21  5:48 ` Takashi Iwai
  5 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2019-05-21  5:48 UTC (permalink / raw)
  To: Takashi Sakamoto; +Cc: alsa-devel, clemens

On Sun, 19 May 2019 12:01:04 +0200,
Takashi Sakamoto wrote:
> 
> Hi,
> 
> This patchset is for Linux kernel v5.3 development.
> 
> ALSA IEC 61883-1/6 packet streaming engine has four types of tracing
> events to probe data of handled isochronous packets on IEEE 1394 bus.
> The most parameters of data are common independent of type of
> isochronous payload and inbound/outbound direction.
> 
> This commit unifies the tracing events as 'amdtp_packet'. Instead of
> named tracing events, filtering functionality of Linux tracing
> framework is available to filter out target events, like:
> 
> $ echo 'src == 0xffc0' > /sys/kernel/debug/tracing/events/snd_firewire_lib/amdtp_packet/filter
> $ echo 1 > /sys/kernel/debug/tracing/events/snd_firewire_lib/amdtp_packet/enable
> $ cat /sys/kernel/debug/tracing/trace
> ...
> ...: amdtp_packet: 00 0594 ffc0 ffc1 00 002 00 240 41 1 09 {0x0,0x2,0x0,0xf0,0x90,0x1,0xff,0xff}
> ...: amdtp_packet: 00 0595 ffc0 ffc1 00 018 08 240 42 1 10 {0x0,0x2,0x0,0xf0,0x90,0x1,0x4b,0x3d}
> 
> Takashi Sakamoto (5):
>   firewire-lib: use the same type of argument for CIP header for tracing
>     event
>   firewire-lib: add data_blocks/data_block_counter parameter to
>     in_packet/out_packet tracing events
>   firewire-lib: use the same unit for payload argument in tracing events
>   firewire-lib: use dynamic array for CIP header of tracing events
>   firewire-lib: unify tracing events to 'amdtp_packet' event

Applied all five patches now.  Thanks.


Takashi

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

end of thread, other threads:[~2019-05-21  5:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-19 10:01 [PATCH 0/5] ALSA: firewire-lib: unify tracing events for isoc packet Takashi Sakamoto
2019-05-19 10:01 ` [PATCH 1/5] firewire-lib: use the same type of argument for CIP header for tracing event Takashi Sakamoto
2019-05-19 10:01 ` [PATCH 2/5] firewire-lib: add data_blocks/data_block_counter parameter to in_packet/out_packet tracing events Takashi Sakamoto
2019-05-19 10:01 ` [PATCH 3/5] firewire-lib: use the same unit for payload argument in " Takashi Sakamoto
2019-05-19 10:01 ` [PATCH 4/5] firewire-lib: use dynamic array for CIP header of " Takashi Sakamoto
2019-05-19 10:01 ` [PATCH 5/5] firewire-lib: unify tracing events to 'amdtp_packet' event Takashi Sakamoto
2019-05-21  5:48 ` [PATCH 0/5] ALSA: firewire-lib: unify tracing events for isoc packet Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.