]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net/smc: Introduce tracepoint for smcr link down
authorTony Lu <tonylu@linux.alibaba.com>
Mon, 1 Nov 2021 07:39:16 +0000 (15:39 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 1 Nov 2021 13:39:14 +0000 (13:39 +0000)
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 <tonylu@linux.alibaba.com>
Reviewed-by: Wen Gu <guwen@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/smc/smc_core.c
net/smc/smc_tracepoint.c
net/smc/smc_tracepoint.h

index 8e642f8f334f1080a4fa028dbc392c5c3882669a..49b8ba3bb6835e88c2e58a6abbabb3ea25da6906 100644 (file)
@@ -34,6 +34,7 @@
 #include "smc_ism.h"
 #include "smc_netlink.h"
 #include "smc_stats.h"
+#include "smc_tracepoint.h"
 
 #define SMC_LGR_NUM_INCR               256
 #define SMC_LGR_FREE_DELAY_SERV                (600 * HZ)
@@ -1620,15 +1621,19 @@ static void smcr_link_down(struct smc_link *lnk)
 /* must be called under lgr->llc_conf_mutex lock */
 void smcr_link_down_cond(struct smc_link *lnk)
 {
-       if (smc_link_downing(&lnk->state))
+       if (smc_link_downing(&lnk->state)) {
+               trace_smcr_link_down(lnk, __builtin_return_address(0));
                smcr_link_down(lnk);
+       }
 }
 
 /* will get the lgr->llc_conf_mutex lock */
 void smcr_link_down_cond_sched(struct smc_link *lnk)
 {
-       if (smc_link_downing(&lnk->state))
+       if (smc_link_downing(&lnk->state)) {
+               trace_smcr_link_down(lnk, __builtin_return_address(0));
                schedule_work(&lnk->link_down_wrk);
+       }
 }
 
 void smcr_port_err(struct smc_ib_device *smcibdev, u8 ibport)
index af031811ddb39017a94a4b70579ff3eeece6b382..8d47ced5a49236683b75fe7f86c4d3521f47e58b 100644 (file)
@@ -6,3 +6,4 @@
 EXPORT_TRACEPOINT_SYMBOL(smc_switch_to_fallback);
 EXPORT_TRACEPOINT_SYMBOL(smc_tx_sendmsg);
 EXPORT_TRACEPOINT_SYMBOL(smc_rx_recvmsg);
+EXPORT_TRACEPOINT_SYMBOL(smcr_link_down);
index eced1546afaebeaa6e35426538f39320b975c00d..b4c36795a9280f5016febe1da071731e521af9e6 100644 (file)
@@ -75,6 +75,36 @@ DEFINE_EVENT(smc_msg_event, smc_rx_recvmsg,
             TP_ARGS(smc, len)
 );
 
+TRACE_EVENT(smcr_link_down,
+
+           TP_PROTO(const struct smc_link *lnk, void *location),
+
+           TP_ARGS(lnk, location),
+
+           TP_STRUCT__entry(
+                            __field(const void *, lnk)
+                            __field(const void *, lgr)
+                            __field(int, state)
+                            __string(name, lnk->ibname)
+                            __field(void *, location)
+           ),
+
+           TP_fast_assign(
+                          const struct smc_link_group *lgr = lnk->lgr;
+
+                          __entry->lnk = lnk;
+                          __entry->lgr = lgr;
+                          __entry->state = lnk->state;
+                          __assign_str(name, lnk->ibname);
+                          __entry->location = location;
+           ),
+
+           TP_printk("lnk=%p lgr=%p state=%d dev=%s location=%p",
+                     __entry->lnk, __entry->lgr,
+                     __entry->state, __get_str(name),
+                     __entry->location)
+);
+
 #endif /* _TRACE_SMC_H */
 
 #undef TRACE_INCLUDE_PATH