Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

svcrdma: Display chunk completion ID when posting a rw_ctxt

Re-use the post_rw tracepoint (safely) to trace cc_info lifetime
events, including completion IDs.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

+24 -46
+12 -44
include/trace/events/rpcrdma.h
··· 1802 1802 ) 1803 1803 ); 1804 1804 1805 - DECLARE_EVENT_CLASS(svcrdma_sendcomp_event, 1806 - TP_PROTO( 1807 - const struct ib_wc *wc 1808 - ), 1809 - 1810 - TP_ARGS(wc), 1811 - 1812 - TP_STRUCT__entry( 1813 - __field(const void *, cqe) 1814 - __field(unsigned int, status) 1815 - __field(unsigned int, vendor_err) 1816 - ), 1817 - 1818 - TP_fast_assign( 1819 - __entry->cqe = wc->wr_cqe; 1820 - __entry->status = wc->status; 1821 - if (wc->status) 1822 - __entry->vendor_err = wc->vendor_err; 1823 - else 1824 - __entry->vendor_err = 0; 1825 - ), 1826 - 1827 - TP_printk("cqe=%p status=%s (%u/0x%x)", 1828 - __entry->cqe, rdma_show_wc_status(__entry->status), 1829 - __entry->status, __entry->vendor_err 1830 - ) 1831 - ); 1832 - 1833 - #define DEFINE_SENDCOMP_EVENT(name) \ 1834 - DEFINE_EVENT(svcrdma_sendcomp_event, svcrdma_wc_##name, \ 1835 - TP_PROTO( \ 1836 - const struct ib_wc *wc \ 1837 - ), \ 1838 - TP_ARGS(wc)) 1839 - 1840 1805 TRACE_EVENT(svcrdma_post_send, 1841 1806 TP_PROTO( 1842 1807 const struct svc_rdma_send_ctxt *ctxt ··· 1881 1916 ) 1882 1917 ); 1883 1918 1884 - TRACE_EVENT(svcrdma_post_rw, 1919 + TRACE_EVENT(svcrdma_post_chunk, 1885 1920 TP_PROTO( 1886 - const void *cqe, 1921 + const struct rpc_rdma_cid *cid, 1887 1922 int sqecount 1888 1923 ), 1889 1924 1890 - TP_ARGS(cqe, sqecount), 1925 + TP_ARGS(cid, sqecount), 1891 1926 1892 1927 TP_STRUCT__entry( 1893 - __field(const void *, cqe) 1928 + __field(u32, cq_id) 1929 + __field(int, completion_id) 1894 1930 __field(int, sqecount) 1895 1931 ), 1896 1932 1897 1933 TP_fast_assign( 1898 - __entry->cqe = cqe; 1934 + __entry->cq_id = cid->ci_queue_id; 1935 + __entry->completion_id = cid->ci_completion_id; 1899 1936 __entry->sqecount = sqecount; 1900 1937 ), 1901 1938 1902 - TP_printk("cqe=%p sqecount=%d", 1903 - __entry->cqe, __entry->sqecount 1939 + TP_printk("cq.id=%u cid=%d sqecount=%d", 1940 + __entry->cq_id, __entry->completion_id, 1941 + __entry->sqecount 1904 1942 ) 1905 1943 ); 1906 1944 1907 - DEFINE_SENDCOMP_EVENT(read); 1908 - DEFINE_SENDCOMP_EVENT(write); 1945 + DEFINE_COMPLETION_EVENT(svcrdma_wc_read); 1946 + DEFINE_COMPLETION_EVENT(svcrdma_wc_write); 1909 1947 1910 1948 TRACE_EVENT(svcrdma_qp_error, 1911 1949 TP_PROTO(
+12 -2
net/sunrpc/xprtrdma/svc_rdma_rw.c
··· 145 145 * demand, and not cached. 146 146 */ 147 147 struct svc_rdma_chunk_ctxt { 148 + struct rpc_rdma_cid cc_cid; 148 149 struct ib_cqe cc_cqe; 149 150 struct svcxprt_rdma *cc_rdma; 150 151 struct list_head cc_rwctxts; 151 152 int cc_sqecount; 152 153 }; 153 154 155 + static void svc_rdma_cc_cid_init(struct svcxprt_rdma *rdma, 156 + struct rpc_rdma_cid *cid) 157 + { 158 + cid->ci_queue_id = rdma->sc_sq_cq->res.id; 159 + cid->ci_completion_id = atomic_inc_return(&rdma->sc_completion_ids); 160 + } 161 + 154 162 static void svc_rdma_cc_init(struct svcxprt_rdma *rdma, 155 163 struct svc_rdma_chunk_ctxt *cc) 156 164 { 165 + svc_rdma_cc_cid_init(rdma, &cc->cc_cid); 157 166 cc->cc_rdma = rdma; 158 167 svc_xprt_get(&rdma->sc_xprt); 159 168 ··· 246 237 struct svc_rdma_write_info *info = 247 238 container_of(cc, struct svc_rdma_write_info, wi_cc); 248 239 249 - trace_svcrdma_wc_write(wc); 240 + trace_svcrdma_wc_write(wc, &cc->cc_cid); 250 241 251 242 atomic_add(cc->cc_sqecount, &rdma->sc_sq_avail); 252 243 wake_up(&rdma->sc_send_wait); ··· 304 295 struct svc_rdma_read_info *info = 305 296 container_of(cc, struct svc_rdma_read_info, ri_cc); 306 297 307 - trace_svcrdma_wc_read(wc); 298 + trace_svcrdma_wc_read(wc, &cc->cc_cid); 308 299 309 300 atomic_add(cc->cc_sqecount, &rdma->sc_sq_avail); 310 301 wake_up(&rdma->sc_send_wait); ··· 360 351 do { 361 352 if (atomic_sub_return(cc->cc_sqecount, 362 353 &rdma->sc_sq_avail) > 0) { 354 + trace_svcrdma_post_chunk(&cc->cc_cid, cc->cc_sqecount); 363 355 ret = ib_post_send(rdma->sc_qp, first_wr, &bad_wr); 364 356 if (ret) 365 357 break;