]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
greybus: tracing: add timing traces
authorAlex Elder <elder@linaro.org>
Fri, 3 Jun 2016 20:55:38 +0000 (15:55 -0500)
committerGreg Kroah-Hartman <gregkh@google.com>
Sat, 4 Jun 2016 00:03:23 +0000 (17:03 -0700)
Bryan reports he used certain message traces to determine when time
sync messages transit the boundary between the Greybus core and the
host device.  This patch adds two trace events--one a message event
for outbound messages (because it indicates its operation and its
destination), and one host device event for incoming messages
(because message information isn't available as early as desired).
These events are being created to allow the same sort of analysis
of messages without having to store extra information for every
message trace.  (The next patch changes the information a message
trace records.)

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/connection.c
drivers/staging/greybus/es2.c
drivers/staging/greybus/greybus_trace.h
drivers/staging/greybus/hd.c

index d35e95a17c565ab2d55cf2384d917b90a76c1b53..7def600ddeb5851877c761dc7608add4b982d13a 100644 (file)
@@ -81,6 +81,8 @@ void greybus_data_rcvd(struct gb_host_device *hd, u16 cport_id,
 {
        struct gb_connection *connection;
 
+       trace_gb_hd_in(hd);
+
        connection = gb_connection_hd_find(hd, cport_id);
        if (!connection) {
                dev_err(&hd->dev,
index 68a8461ea84ca73057589aa0e5f938c180fb31ac..bdf502493e31c82ace0d4075d5ec7edbee198062 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/unaligned.h>
 
 #include "greybus.h"
+#include "greybus_trace.h"
 #include "kernel_ver.h"
 #include "connection.h"
 
@@ -467,6 +468,9 @@ static int message_send(struct gb_host_device *hd, u16 cport_id,
                          message->buffer, buffer_size,
                          cport_out_callback, message);
        urb->transfer_flags |= URB_ZERO_PACKET;
+
+       trace_gb_message_submit(message);
+
        retval = usb_submit_urb(urb, gfp_mask);
        if (retval) {
                dev_err(&udev->dev, "failed to submit out-urb: %d\n", retval);
index a0757404dc4c6e93488f8e0ed3038c3f05d074df..62f5803a408d533fdb09dafe6f207f7da619e048 100644 (file)
@@ -88,6 +88,12 @@ DEFINE_MESSAGE_EVENT(gb_message_cancel_outgoing);
  */
 DEFINE_MESSAGE_EVENT(gb_message_cancel_incoming);
 
+/*
+ * Occurs in the host driver message_send() function just prior to
+ * handing off the data to be processed by hardware.
+ */
+DEFINE_MESSAGE_EVENT(gb_message_submit);
+
 #undef DEFINE_MESSAGE_EVENT
 
 DECLARE_EVENT_CLASS(gb_operation,
@@ -471,7 +477,7 @@ DEFINE_HD_EVENT(gb_hd_release);
 
 /*
  * Occurs after a new host device has been added, after the
- * connection to its SVC has been enabled.
+ * connection to its SVC has been enabled.
  */
 DEFINE_HD_EVENT(gb_hd_add);
 
@@ -481,6 +487,13 @@ DEFINE_HD_EVENT(gb_hd_add);
  */
 DEFINE_HD_EVENT(gb_hd_del);
 
+/*
+ * Occurs when a host device has passed received data to the Greybus
+ * core, after it has been determined it is destined for a valid
+ * CPort.
+ */
+DEFINE_HD_EVENT(gb_hd_in);
+
 #undef DEFINE_HD_EVENT
 
 #endif /* _TRACE_GREYBUS_H */
index 12ac0b6584d8a9f7b2181a1f2e2f159593e73ab3..6d952ba441a6c2ae2c0266a069c5ba5d4f0bc591 100644 (file)
@@ -13,6 +13,9 @@
 #include "greybus.h"
 #include "greybus_trace.h"
 
+EXPORT_TRACEPOINT_SYMBOL_GPL(gb_message_submit);
+EXPORT_TRACEPOINT_SYMBOL_GPL(gb_hd_in);
+
 static struct ida gb_hd_bus_id_map;
 
 int gb_hd_output(struct gb_host_device *hd, void *req, u16 size, u8 cmd,