[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240501073238.72769-4-o-takashi@sakamocchi.jp>
Date: Wed, 1 May 2024 16:32:36 +0900
From: Takashi Sakamoto <o-takashi@...amocchi.jp>
To: linux1394-devel@...ts.sourceforge.net
Cc: linux-kernel@...r.kernel.org,
adamg@...ox.com
Subject: [PATCH 3/5] firewire: core: add tracepoints events for initiating bus reset
At a commit 673249124304 ("firewire: core: option to log bus reset
initiation"), some kernel log messages were added to trace initiation of
bus reset. The kernel log messages are really helpful, while nowadays it
is not preferable just for debugging purpose. For the purpose, Linux
kernel tracepoints is more preferable.
This commit adds some alternative tracepoints events.
Signed-off-by: Takashi Sakamoto <o-takashi@...amocchi.jp>
---
drivers/firewire/core-card.c | 7 +++++++
include/trace/events/firewire.h | 33 +++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+)
diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c
index dac1b0fc7a42..5d43acf45a7d 100644
--- a/drivers/firewire/core-card.c
+++ b/drivers/firewire/core-card.c
@@ -23,6 +23,7 @@
#include <asm/byteorder.h>
#include "core.h"
+#include <trace/events/firewire.h>
#define define_fw_printk_level(func, kern_level) \
void func(const struct fw_card *card, const char *fmt, ...) \
@@ -221,6 +222,8 @@ static int reset_bus(struct fw_card *card, bool short_reset)
int reg = short_reset ? 5 : 1;
int bit = short_reset ? PHY_BUS_SHORT_RESET : PHY_BUS_RESET;
+ trace_bus_reset_initiate(card->generation, short_reset);
+
if (unlikely(fw_core_param_debug & FW_CORE_PARAM_DEBUG_BUSRESETS))
fw_notice(card, "initiating %s bus reset\n",
short_reset ? "short" : "long");
@@ -230,6 +233,8 @@ static int reset_bus(struct fw_card *card, bool short_reset)
void fw_schedule_bus_reset(struct fw_card *card, bool delayed, bool short_reset)
{
+ trace_bus_reset_schedule(card->generation, short_reset);
+
if (unlikely(fw_core_param_debug & FW_CORE_PARAM_DEBUG_BUSRESETS))
fw_notice(card, "scheduling %s bus reset\n",
short_reset ? "short" : "long");
@@ -252,6 +257,8 @@ static void br_work(struct work_struct *work)
/* Delay for 2s after last reset per IEEE 1394 clause 8.2.1. */
if (card->reset_jiffies != 0 &&
time_before64(get_jiffies_64(), card->reset_jiffies + 2 * HZ)) {
+ trace_bus_reset_postpone(card->generation, card->br_short);
+
if (unlikely(fw_core_param_debug & FW_CORE_PARAM_DEBUG_BUSRESETS))
fw_notice(card, "delaying bus reset\n");
if (!queue_delayed_work(fw_workqueue, &card->br_work, 2 * HZ))
diff --git a/include/trace/events/firewire.h b/include/trace/events/firewire.h
index db49b9828bd1..92bcbe69bb42 100644
--- a/include/trace/events/firewire.h
+++ b/include/trace/events/firewire.h
@@ -284,6 +284,39 @@ TRACE_EVENT(async_phy_inbound,
)
);
+DECLARE_EVENT_CLASS(bus_reset_arrange_template,
+ TP_PROTO(unsigned int generation, bool short_reset),
+ TP_ARGS(generation, short_reset),
+ TP_STRUCT__entry(
+ __field(u8, generation)
+ __field(bool, short_reset)
+ ),
+ TP_fast_assign(
+ __entry->generation = generation;
+ __entry->short_reset = short_reset;
+ ),
+ TP_printk(
+ "generation=%u short_reset=%s",
+ __entry->generation,
+ __entry->short_reset ? "true" : "false"
+ )
+);
+
+DEFINE_EVENT(bus_reset_arrange_template, bus_reset_initiate,
+ TP_PROTO(unsigned int generation, bool short_reset),
+ TP_ARGS(generation, short_reset)
+);
+
+DEFINE_EVENT(bus_reset_arrange_template, bus_reset_schedule,
+ TP_PROTO(unsigned int generation, bool short_reset),
+ TP_ARGS(generation, short_reset)
+);
+
+DEFINE_EVENT(bus_reset_arrange_template, bus_reset_postpone,
+ TP_PROTO(unsigned int generation, bool short_reset),
+ TP_ARGS(generation, short_reset)
+);
+
#endif // _FIREWIRE_TRACE_EVENT_H
#include <trace/define_trace.h>
--
2.43.0
Powered by blists - more mailing lists