Skip to content

Commit a3a0e81

Browse files
Tony Ludavem330
authored andcommitted
net/smc: Introduce tracepoint for smcr link down
SMC-R link down event is important to help us find links' issues, we should track this event, especially in the single nic mode, which means upper layer connection would be shut down. Then find out the direct link-down reason in time, not only increased the counter, also the location of the code who triggered this event. Signed-off-by: Tony Lu <[email protected]> Reviewed-by: Wen Gu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent aff3083 commit a3a0e81

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

net/smc/smc_core.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "smc_ism.h"
3535
#include "smc_netlink.h"
3636
#include "smc_stats.h"
37+
#include "smc_tracepoint.h"
3738

3839
#define SMC_LGR_NUM_INCR 256
3940
#define SMC_LGR_FREE_DELAY_SERV (600 * HZ)
@@ -1620,15 +1621,19 @@ static void smcr_link_down(struct smc_link *lnk)
16201621
/* must be called under lgr->llc_conf_mutex lock */
16211622
void smcr_link_down_cond(struct smc_link *lnk)
16221623
{
1623-
if (smc_link_downing(&lnk->state))
1624+
if (smc_link_downing(&lnk->state)) {
1625+
trace_smcr_link_down(lnk, __builtin_return_address(0));
16241626
smcr_link_down(lnk);
1627+
}
16251628
}
16261629

16271630
/* will get the lgr->llc_conf_mutex lock */
16281631
void smcr_link_down_cond_sched(struct smc_link *lnk)
16291632
{
1630-
if (smc_link_downing(&lnk->state))
1633+
if (smc_link_downing(&lnk->state)) {
1634+
trace_smcr_link_down(lnk, __builtin_return_address(0));
16311635
schedule_work(&lnk->link_down_wrk);
1636+
}
16321637
}
16331638

16341639
void smcr_port_err(struct smc_ib_device *smcibdev, u8 ibport)

net/smc/smc_tracepoint.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
EXPORT_TRACEPOINT_SYMBOL(smc_switch_to_fallback);
77
EXPORT_TRACEPOINT_SYMBOL(smc_tx_sendmsg);
88
EXPORT_TRACEPOINT_SYMBOL(smc_rx_recvmsg);
9+
EXPORT_TRACEPOINT_SYMBOL(smcr_link_down);

net/smc/smc_tracepoint.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,36 @@ DEFINE_EVENT(smc_msg_event, smc_rx_recvmsg,
7575
TP_ARGS(smc, len)
7676
);
7777

78+
TRACE_EVENT(smcr_link_down,
79+
80+
TP_PROTO(const struct smc_link *lnk, void *location),
81+
82+
TP_ARGS(lnk, location),
83+
84+
TP_STRUCT__entry(
85+
__field(const void *, lnk)
86+
__field(const void *, lgr)
87+
__field(int, state)
88+
__string(name, lnk->ibname)
89+
__field(void *, location)
90+
),
91+
92+
TP_fast_assign(
93+
const struct smc_link_group *lgr = lnk->lgr;
94+
95+
__entry->lnk = lnk;
96+
__entry->lgr = lgr;
97+
__entry->state = lnk->state;
98+
__assign_str(name, lnk->ibname);
99+
__entry->location = location;
100+
),
101+
102+
TP_printk("lnk=%p lgr=%p state=%d dev=%s location=%p",
103+
__entry->lnk, __entry->lgr,
104+
__entry->state, __get_str(name),
105+
__entry->location)
106+
);
107+
78108
#endif /* _TRACE_SMC_H */
79109

80110
#undef TRACE_INCLUDE_PATH

0 commit comments

Comments
 (0)