mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 13:41:51 +00:00
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. Link: https://lore.kernel.org/r/20240501073238.72769-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
This commit is contained in:
parent
42374303b7
commit
08dd8602aa
@ -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))
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user