From patchwork Mon Nov 9 19:39:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever III X-Patchwork-Id: 11892371 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA6741746 for ; Mon, 9 Nov 2020 19:39:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C7F3E206E3 for ; Mon, 9 Nov 2020 19:39:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PLTcR3ZY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729854AbgKITjT (ORCPT ); Mon, 9 Nov 2020 14:39:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729697AbgKITjS (ORCPT ); Mon, 9 Nov 2020 14:39:18 -0500 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0AEBC0613CF; Mon, 9 Nov 2020 11:39:18 -0800 (PST) Received: by mail-qk1-x743.google.com with SMTP id u4so6370399qkk.10; Mon, 09 Nov 2020 11:39:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=0w3mXRdPsspn3ceNYTnJhvzjpJ3GQTNLXqPAgXD8Eao=; b=PLTcR3ZYQroKj4oglw0wzfAaYy99rqhncFJ95G+5J7BkO0CyI0tcLpklN60zL0/Obs hDvKrU6Srs64bo3YkQ29FHeVadhhHiJdNZh61/E+/PlKA6ArHTvLb9lLaUTeBAbiArSB 4kUFEDx/vgAp5qIO2/wlQQXsU+QfGi8N30cUKrKSLxZKIMGfl56+Uw2RsUJ1LgI3CyDH xTLKFpVMntxfK0vSkRCe5N8dp4vFv//gx6yE9C9LELBz/ZZUh31WTG7EIqDufcSGm77m BG2ojGB03qwKAd/QJZQo19oh2MW047p4vNKhdSOEeM3IRFHdIngSrZLs0PPYdBdRh6+0 Epig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=0w3mXRdPsspn3ceNYTnJhvzjpJ3GQTNLXqPAgXD8Eao=; b=dCG6IbTavsGbSnX1QK5YIZLPJHpZ9l4w7HJojWGj2Uko03N/mwb5ktnBCDcBg9HnN1 dG3Bm2oI1jpNCK1AG8VS4MOUhAsQ/H1KniTmzO96/fIXbL8njoF9evrhw+LupaDL3wfR UfFAgaX+oWZ0LS562q9SlhJbWvjkXb1+iGvOR+vnCSJVv2H2jvsPFrF4ktvTdt/8gotf sdiiGS1+IWISjPwjClhQxvpo0siS+9sxjVFdLvBiqTKkPMpxKgzkhgUK5uw9rMj8xttq UFwsQqRY9caM80fRInQwQ2eSoQsykajlpMWPaubkj8q6h0n3nNbIdX8khBEWIfqOmShd N5Kg== X-Gm-Message-State: AOAM530VfkNQBJSdzlpeeM8riQWUaqvztQcj/U5yxtR87HJ/CMRN7eWC A81SdgN/ZqDEBL89VkqxvpxYsAdWdHA= X-Google-Smtp-Source: ABdhPJyc5C2uP6JVzkKgWrVaIYbEhxtlLtXxDPoOjgbDg7G7KtEQmZOi0rK9N/OOLmnA2cj1NVZNLA== X-Received: by 2002:a37:b785:: with SMTP id h127mr14815096qkf.77.1604950757523; Mon, 09 Nov 2020 11:39:17 -0800 (PST) Received: from gateway.1015granger.net (c-68-61-232-219.hsd1.mi.comcast.net. [68.61.232.219]) by smtp.gmail.com with ESMTPSA id a206sm6792021qkb.64.2020.11.09.11.39.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 11:39:16 -0800 (PST) Sender: Chuck Lever Received: from manet.1015granger.net (manet.1015granger.net [192.168.1.51]) by gateway.1015granger.net (8.14.7/8.14.7) with ESMTP id 0A9JdF7d021791; Mon, 9 Nov 2020 19:39:15 GMT Subject: [PATCH v1 01/13] xprtrdma: Replace dprintk call sites in ERR_CHUNK path From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org Date: Mon, 09 Nov 2020 14:39:15 -0500 Message-ID: <160495075571.2072548.12857644844291007553.stgit@manet.1015granger.net> In-Reply-To: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> References: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> User-Agent: StGit/0.23-29-ga622f1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Signed-off-by: Chuck Lever --- include/trace/events/rpcrdma.h | 82 ++++++++++++++++++++++++++++++++++++++++ net/sunrpc/xprtrdma/rpc_rdma.c | 13 +----- 2 files changed, 85 insertions(+), 10 deletions(-) diff --git a/include/trace/events/rpcrdma.h b/include/trace/events/rpcrdma.h index bf1065772228..d5e66428e27e 100644 --- a/include/trace/events/rpcrdma.h +++ b/include/trace/events/rpcrdma.h @@ -1128,6 +1128,88 @@ DEFINE_REPLY_EVENT(xprtrdma_reply_rqst); DEFINE_REPLY_EVENT(xprtrdma_reply_short); DEFINE_REPLY_EVENT(xprtrdma_reply_hdr); +TRACE_EVENT(xprtrdma_err_vers, + TP_PROTO( + const struct rpc_rqst *rqst, + __be32 *min, + __be32 *max + ), + + TP_ARGS(rqst, min, max), + + TP_STRUCT__entry( + __field(unsigned int, task_id) + __field(unsigned int, client_id) + __field(u32, xid) + __field(u32, min) + __field(u32, max) + ), + + TP_fast_assign( + __entry->task_id = rqst->rq_task->tk_pid; + __entry->client_id = rqst->rq_task->tk_client->cl_clid; + __entry->xid = be32_to_cpu(rqst->rq_xid); + __entry->min = be32_to_cpup(min); + __entry->max = be32_to_cpup(max); + ), + + TP_printk("task:%u@%u xid=0x%08x versions=[%u, %u]", + __entry->task_id, __entry->client_id, __entry->xid, + __entry->min, __entry->max + ) +); + +TRACE_EVENT(xprtrdma_err_chunk, + TP_PROTO( + const struct rpc_rqst *rqst + ), + + TP_ARGS(rqst), + + TP_STRUCT__entry( + __field(unsigned int, task_id) + __field(unsigned int, client_id) + __field(u32, xid) + ), + + TP_fast_assign( + __entry->task_id = rqst->rq_task->tk_pid; + __entry->client_id = rqst->rq_task->tk_client->cl_clid; + __entry->xid = be32_to_cpu(rqst->rq_xid); + ), + + TP_printk("task:%u@%u xid=0x%08x", + __entry->task_id, __entry->client_id, __entry->xid + ) +); + +TRACE_EVENT(xprtrdma_err_unrecognized, + TP_PROTO( + const struct rpc_rqst *rqst, + __be32 *procedure + ), + + TP_ARGS(rqst, procedure), + + TP_STRUCT__entry( + __field(unsigned int, task_id) + __field(unsigned int, client_id) + __field(u32, xid) + __field(u32, procedure) + ), + + TP_fast_assign( + __entry->task_id = rqst->rq_task->tk_pid; + __entry->client_id = rqst->rq_task->tk_client->cl_clid; + __entry->procedure = be32_to_cpup(procedure); + ), + + TP_printk("task:%u@%u xid=0x%08x procedure=%u", + __entry->task_id, __entry->client_id, __entry->xid, + __entry->procedure + ) +); + TRACE_EVENT(xprtrdma_fixup, TP_PROTO( const struct rpc_rqst *rqst, diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c index 0f5120c7668f..c178f93aa40b 100644 --- a/net/sunrpc/xprtrdma/rpc_rdma.c +++ b/net/sunrpc/xprtrdma/rpc_rdma.c @@ -1322,20 +1322,13 @@ rpcrdma_decode_error(struct rpcrdma_xprt *r_xprt, struct rpcrdma_rep *rep, p = xdr_inline_decode(xdr, 2 * sizeof(*p)); if (!p) break; - dprintk("RPC: %s: server reports " - "version error (%u-%u), xid %08x\n", __func__, - be32_to_cpup(p), be32_to_cpu(*(p + 1)), - be32_to_cpu(rep->rr_xid)); + trace_xprtrdma_err_vers(rqst, p, p + 1); break; case err_chunk: - dprintk("RPC: %s: server reports " - "header decoding error, xid %08x\n", __func__, - be32_to_cpu(rep->rr_xid)); + trace_xprtrdma_err_chunk(rqst); break; default: - dprintk("RPC: %s: server reports " - "unrecognized error %d, xid %08x\n", __func__, - be32_to_cpup(p), be32_to_cpu(rep->rr_xid)); + trace_xprtrdma_err_unrecognized(rqst, p); } return -EIO; From patchwork Mon Nov 9 19:39:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever III X-Patchwork-Id: 11892375 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA2DB1391 for ; Mon, 9 Nov 2020 19:39:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA003206D8 for ; Mon, 9 Nov 2020 19:39:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iWsSDtxW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730045AbgKITjY (ORCPT ); Mon, 9 Nov 2020 14:39:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729697AbgKITjY (ORCPT ); Mon, 9 Nov 2020 14:39:24 -0500 Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 140E6C0613CF; Mon, 9 Nov 2020 11:39:24 -0800 (PST) Received: by mail-qk1-x741.google.com with SMTP id b18so9101841qkc.9; Mon, 09 Nov 2020 11:39:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=APnuPL/aojxnXvlxsQQygIUtKJ2olB6s4yI0GG/OMHo=; b=iWsSDtxWQVaK3Hs3hoUjkslGFQHPOfYulcrcWIhLn7n6hm+HhETBlVPUeBzEghybsc 16T+OGhZmeF0FHcGlx1PgWjmFGKXnl8yLD5Pj+E+d1VtQBrz9MlyvwkHUnpuhK1peb0L BdgxIJCH4pbhthjBkkr2RAJin6fK7jQboZsBV0ue6Gm8wl+oI2QEjoJr1NCMoOuAUhPw OJlJSeAqLZnBjZD/SqTbHkn6HEJtACiBYvnfwh5bZM5j5oWKgxwKxEzhYFtSQ3YPu63O Gcp02/UZvaOfJz8ct5nZ2KXwwjAAQaX9saNNvBqcsPGBDmUp7FW4TrxcpHQQyuBZH+Bg ifMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=APnuPL/aojxnXvlxsQQygIUtKJ2olB6s4yI0GG/OMHo=; b=UoOLhC1gPqDUrpdZjA26QJ2uMey5VnOWrbBzeIXPEWE5zCD7VdjvyOKa4eI7nN/j1e f9wWuOlto398EaWoWg0ex4xzWQKkQ0Xnh0pxx9MGtOx1k4CbVmTEebeVcxqGx2dGR/xA cFpCP8mEaJS9KkB38KgMScafHAywdGJ5F/GdOhehBors1dB0MhTjkoIXjgh31Qs3CcoF YbTkvjqZw7QeBq5NG66Je8tDjaNndgBT0c36i7x5MH2O/3ILGO+O0WOGr8vpe17H6Uiy DNQOr7uCljcF6aMAqRUgq5K4Spnpw4qQ5o7bEcAXeSIfQK5lES82XuLSzn4ZzacRfW/l LBCQ== X-Gm-Message-State: AOAM5304145I8Yx2ATSL5rwk0DmnhwsRvX3/LoMbiCZpMnzNbHZfS6lG peL/ccn5gOUOVbXXiMqZmiBovaSZC4E= X-Google-Smtp-Source: ABdhPJyfLad5pHTXUkARoEBcJs03Mm1Hr5Y6cSElcvrG/9k1UknJfxSZBQhAST5Wq2K2f5yWRaPnDg== X-Received: by 2002:a37:ac10:: with SMTP id e16mr14808597qkm.318.1604950762901; Mon, 09 Nov 2020 11:39:22 -0800 (PST) Received: from gateway.1015granger.net (c-68-61-232-219.hsd1.mi.comcast.net. [68.61.232.219]) by smtp.gmail.com with ESMTPSA id j25sm6481135qtk.79.2020.11.09.11.39.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 11:39:22 -0800 (PST) Sender: Chuck Lever Received: from manet.1015granger.net (manet.1015granger.net [192.168.1.51]) by gateway.1015granger.net (8.14.7/8.14.7) with ESMTP id 0A9JdLLZ021794; Mon, 9 Nov 2020 19:39:21 GMT Subject: [PATCH v1 02/13] xprtrdma: Introduce Receive completion IDs From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org Date: Mon, 09 Nov 2020 14:39:21 -0500 Message-ID: <160495076114.2072548.12296791888135843037.stgit@manet.1015granger.net> In-Reply-To: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> References: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> User-Agent: StGit/0.23-29-ga622f1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Set up a completion ID in each rpcrdma_rep. The ID is used to match an incoming Receive completion to a transport and to a previous ib_post_recv(). Signed-off-by: Chuck Lever --- include/trace/events/rpcrdma.h | 46 +++++++-------------------------------- net/sunrpc/xprtrdma/verbs.c | 6 ++++- net/sunrpc/xprtrdma/xprt_rdma.h | 5 ++++ 3 files changed, 18 insertions(+), 39 deletions(-) diff --git a/include/trace/events/rpcrdma.h b/include/trace/events/rpcrdma.h index d5e66428e27e..1c91c8e721e7 100644 --- a/include/trace/events/rpcrdma.h +++ b/include/trace/events/rpcrdma.h @@ -771,15 +771,17 @@ TRACE_EVENT(xprtrdma_post_recv, TP_ARGS(rep), TP_STRUCT__entry( - __field(const void *, rep) + __field(u32, cq_id) + __field(int, completion_id) ), TP_fast_assign( - __entry->rep = rep; + __entry->cq_id = rep->rr_cid.ci_queue_id; + __entry->completion_id = rep->rr_cid.ci_completion_id; ), - TP_printk("rep=%p", - __entry->rep + TP_printk("cq.id=%d cid=%d", + __entry->cq_id, __entry->completion_id ) ); @@ -845,6 +847,8 @@ TRACE_EVENT(xprtrdma_post_linv, ** Completion events **/ +DEFINE_COMPLETION_EVENT(xprtrdma_wc_receive); + TRACE_EVENT(xprtrdma_wc_send, TP_PROTO( const struct rpcrdma_sendctx *sc, @@ -876,40 +880,6 @@ TRACE_EVENT(xprtrdma_wc_send, ) ); -TRACE_EVENT(xprtrdma_wc_receive, - TP_PROTO( - const struct ib_wc *wc - ), - - TP_ARGS(wc), - - TP_STRUCT__entry( - __field(const void *, rep) - __field(u32, byte_len) - __field(unsigned int, status) - __field(u32, vendor_err) - ), - - TP_fast_assign( - __entry->rep = container_of(wc->wr_cqe, struct rpcrdma_rep, - rr_cqe); - __entry->status = wc->status; - if (wc->status) { - __entry->byte_len = 0; - __entry->vendor_err = wc->vendor_err; - } else { - __entry->byte_len = wc->byte_len; - __entry->vendor_err = 0; - } - ), - - TP_printk("rep=%p %u bytes: %s (%u/0x%x)", - __entry->rep, __entry->byte_len, - rdma_show_wc_status(__entry->status), - __entry->status, __entry->vendor_err - ) -); - DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_fastreg); DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li); DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li_wake); diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index ad6e2e4994ce..2c8d2801ec4f 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -186,7 +186,7 @@ static void rpcrdma_wc_receive(struct ib_cq *cq, struct ib_wc *wc) struct rpcrdma_xprt *r_xprt = cq->cq_context; /* WARNING: Only wr_cqe and status are reliable at this point */ - trace_xprtrdma_wc_receive(wc); + trace_xprtrdma_wc_receive(wc, &rep->rr_cid); --r_xprt->rx_ep->re_receive_count; if (wc->status != IB_WC_SUCCESS) goto out_flushed; @@ -972,6 +972,9 @@ struct rpcrdma_rep *rpcrdma_rep_create(struct rpcrdma_xprt *r_xprt, if (!rpcrdma_regbuf_dma_map(r_xprt, rep->rr_rdmabuf)) goto out_free_regbuf; + rep->rr_cid.ci_completion_id = + atomic_inc_return(&r_xprt->rx_ep->re_completion_ids); + xdr_buf_init(&rep->rr_hdrbuf, rdmab_data(rep->rr_rdmabuf), rdmab_length(rep->rr_rdmabuf)); rep->rr_cqe.done = rpcrdma_wc_receive; @@ -1411,6 +1414,7 @@ void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp) if (!rep) break; + rep->rr_cid.ci_queue_id = ep->re_attr.recv_cq->res.id; trace_xprtrdma_post_recv(rep); rep->rr_recv_wr.next = wr; wr = &rep->rr_recv_wr; diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h index 43974ef39a50..b94940bc67aa 100644 --- a/net/sunrpc/xprtrdma/xprt_rdma.h +++ b/net/sunrpc/xprtrdma/xprt_rdma.h @@ -53,6 +53,7 @@ #include /* RDMA verbs api */ #include /* rpc_xprt */ +#include /* completion IDs */ #include /* RPC/RDMA protocol */ #include /* xprt parameters */ @@ -93,6 +94,8 @@ struct rpcrdma_ep { unsigned int re_max_requests; /* depends on device */ unsigned int re_inline_send; /* negotiated */ unsigned int re_inline_recv; /* negotiated */ + + atomic_t re_completion_ids; }; /* Pre-allocate extra Work Requests for handling backward receives @@ -180,6 +183,8 @@ enum { struct rpcrdma_rep { struct ib_cqe rr_cqe; + struct rpc_rdma_cid rr_cid; + __be32 rr_xid; __be32 rr_vers; __be32 rr_proc; From patchwork Mon Nov 9 19:39:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever III X-Patchwork-Id: 11892379 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A37B416C1 for ; Mon, 9 Nov 2020 19:39:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7CCD9206E3 for ; Mon, 9 Nov 2020 19:39:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nhLb1hSP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730210AbgKITj3 (ORCPT ); Mon, 9 Nov 2020 14:39:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729697AbgKITj3 (ORCPT ); Mon, 9 Nov 2020 14:39:29 -0500 Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53C99C0613CF; Mon, 9 Nov 2020 11:39:29 -0800 (PST) Received: by mail-qk1-x744.google.com with SMTP id u4so6370971qkk.10; Mon, 09 Nov 2020 11:39:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=W5nj+qdtjuQl8iY/Sq15Ie6k3wJ8XrsPFpmMXP2aUqQ=; b=nhLb1hSPeku7T6zxDVRz6i+JND1f7abw1dYmlDSAud5G11o0vyIxljoFKmtLMo5228 mk1omBGbk3k6U2jxtOZWVkYnxUcQB20rilSspWnLE7Y2nuIZ+WBGz5x0LkIPTti2n/In q6WDxHZTNRsQAvHgXYDAhr9fPrGM1ktwpy+rEqIO7pyaMGWL9vCc26H5Xa4slvNPBgjg yvSuk7QFFfMtLkOQlssy/0pHzzviiRvlI+474DGTZvosjggGTsYIf0W2d6E1B83CnX+F x1UDfWmFWk9E9kZMifmmr8cBKV/gM2OnCsKi9v6kQp+d1hGUAozEqbCBhVwpVqzNGpe9 ogWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=W5nj+qdtjuQl8iY/Sq15Ie6k3wJ8XrsPFpmMXP2aUqQ=; b=uLu5LVtyxKnOl9IDdtV57I4mCYvIDiBx/sZHoRczy+zr4c+X22zVO7VrNbO3IphpPH tbiioT9zHUOiphpc/OCSjzh492RTbXx/byUh55dGjIa+wnLIAWPK9KxYc7mEgAMLdnqD kogN2YWqx4khMKFlsGY6KvUMKutzKS/1l8UyZwXHNGkK5b48NkZ9WrVRBjt6rKfr+jXG LA2IXf45KuDvWviiTv2J9x5hedvXgVAFa3T0zhrT3IilQi0oxFUJlJVGj9KdZwGkUBFi TFiBRCOUfYUmE9qzGTfGD0jduDdaLsFwjOHJxQUM7QPW1kzgBdcmL6+crXf2TKJ4uX6e sDfQ== X-Gm-Message-State: AOAM531uw2jxnq91+ocM5KbDlOTJORVgZTOXBPy4P5bAYI4V40gkJXhi NFs6J1wVaLB2Lt7D8gFI1aLkBkmX8Q8= X-Google-Smtp-Source: ABdhPJw9APsu0F+/DkKVLl7sSvcLpeI1fMzyVWeAcBDJWsoU0ZuyAhiWcUd0ePOAQgBiiMiipoMmnQ== X-Received: by 2002:a37:7b44:: with SMTP id w65mr15933036qkc.350.1604950768192; Mon, 09 Nov 2020 11:39:28 -0800 (PST) Received: from gateway.1015granger.net (c-68-61-232-219.hsd1.mi.comcast.net. [68.61.232.219]) by smtp.gmail.com with ESMTPSA id i15sm2376491qke.16.2020.11.09.11.39.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 11:39:27 -0800 (PST) Sender: Chuck Lever Received: from manet.1015granger.net (manet.1015granger.net [192.168.1.51]) by gateway.1015granger.net (8.14.7/8.14.7) with ESMTP id 0A9JdQMY021797; Mon, 9 Nov 2020 19:39:26 GMT Subject: [PATCH v1 03/13] xprtrdma: Introduce Send completion IDs From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org Date: Mon, 09 Nov 2020 14:39:26 -0500 Message-ID: <160495076648.2072548.12867018705746911489.stgit@manet.1015granger.net> In-Reply-To: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> References: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> User-Agent: StGit/0.23-29-ga622f1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Set up a completion ID in each rpcrdma_req. The ID is used to match an incoming Send completion to a transport and to a previous ib_post_send(). Signed-off-by: Chuck Lever --- include/trace/events/rpcrdma.h | 47 +++++++-------------------------------- net/sunrpc/xprtrdma/verbs.c | 5 +++- net/sunrpc/xprtrdma/xprt_rdma.h | 1 + 3 files changed, 14 insertions(+), 39 deletions(-) diff --git a/include/trace/events/rpcrdma.h b/include/trace/events/rpcrdma.h index 1c91c8e721e7..ab239f4f924e 100644 --- a/include/trace/events/rpcrdma.h +++ b/include/trace/events/rpcrdma.h @@ -735,8 +735,8 @@ TRACE_EVENT(xprtrdma_post_send, TP_ARGS(req), TP_STRUCT__entry( - __field(const void *, req) - __field(const void *, sc) + __field(u32, cq_id) + __field(int, completion_id) __field(unsigned int, task_id) __field(unsigned int, client_id) __field(int, num_sge) @@ -745,20 +745,21 @@ TRACE_EVENT(xprtrdma_post_send, TP_fast_assign( const struct rpc_rqst *rqst = &req->rl_slot; + const struct rpcrdma_sendctx *sc = req->rl_sendctx; + __entry->cq_id = sc->sc_cid.ci_queue_id; + __entry->completion_id = sc->sc_cid.ci_completion_id; __entry->task_id = rqst->rq_task->tk_pid; __entry->client_id = rqst->rq_task->tk_client ? rqst->rq_task->tk_client->cl_clid : -1; - __entry->req = req; - __entry->sc = req->rl_sendctx; __entry->num_sge = req->rl_wr.num_sge; __entry->signaled = req->rl_wr.send_flags & IB_SEND_SIGNALED; ), - TP_printk("task:%u@%u req=%p sc=%p (%d SGE%s) %s", + TP_printk("task:%u@%u cq.id=%u cid=%d (%d SGE%s) %s", __entry->task_id, __entry->client_id, - __entry->req, __entry->sc, __entry->num_sge, - (__entry->num_sge == 1 ? "" : "s"), + __entry->cq_id, __entry->completion_id, + __entry->num_sge, (__entry->num_sge == 1 ? "" : "s"), (__entry->signaled ? "signaled" : "") ) ); @@ -848,37 +849,7 @@ TRACE_EVENT(xprtrdma_post_linv, **/ DEFINE_COMPLETION_EVENT(xprtrdma_wc_receive); - -TRACE_EVENT(xprtrdma_wc_send, - TP_PROTO( - const struct rpcrdma_sendctx *sc, - const struct ib_wc *wc - ), - - TP_ARGS(sc, wc), - - TP_STRUCT__entry( - __field(const void *, req) - __field(const void *, sc) - __field(unsigned int, unmap_count) - __field(unsigned int, status) - __field(unsigned int, vendor_err) - ), - - TP_fast_assign( - __entry->req = sc->sc_req; - __entry->sc = sc; - __entry->unmap_count = sc->sc_unmap_count; - __entry->status = wc->status; - __entry->vendor_err = __entry->status ? wc->vendor_err : 0; - ), - - TP_printk("req=%p sc=%p unmapped=%u: %s (%u/0x%x)", - __entry->req, __entry->sc, __entry->unmap_count, - rdma_show_wc_status(__entry->status), - __entry->status, __entry->vendor_err - ) -); +DEFINE_COMPLETION_EVENT(xprtrdma_wc_send); DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_fastreg); DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li); diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index 2c8d2801ec4f..63837b5d14e5 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -167,7 +167,7 @@ static void rpcrdma_wc_send(struct ib_cq *cq, struct ib_wc *wc) struct rpcrdma_xprt *r_xprt = cq->cq_context; /* WARNING: Only wr_cqe and status are reliable at this point */ - trace_xprtrdma_wc_send(sc, wc); + trace_xprtrdma_wc_send(wc, &sc->sc_cid); rpcrdma_sendctx_put_locked(r_xprt, sc); rpcrdma_flush_disconnect(r_xprt, wc); } @@ -643,6 +643,9 @@ static struct rpcrdma_sendctx *rpcrdma_sendctx_create(struct rpcrdma_ep *ep) return NULL; sc->sc_cqe.done = rpcrdma_wc_send; + sc->sc_cid.ci_queue_id = ep->re_attr.send_cq->res.id; + sc->sc_cid.ci_completion_id = + atomic_inc_return(&ep->re_completion_ids); return sc; } diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h index b94940bc67aa..4eb8e32b9f4a 100644 --- a/net/sunrpc/xprtrdma/xprt_rdma.h +++ b/net/sunrpc/xprtrdma/xprt_rdma.h @@ -216,6 +216,7 @@ enum { struct rpcrdma_req; struct rpcrdma_sendctx { struct ib_cqe sc_cqe; + struct rpc_rdma_cid sc_cid; struct rpcrdma_req *sc_req; unsigned int sc_unmap_count; struct ib_sge sc_sges[]; From patchwork Mon Nov 9 19:39:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever III X-Patchwork-Id: 11892383 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C13016C1 for ; Mon, 9 Nov 2020 19:39:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 760E4206D8 for ; Mon, 9 Nov 2020 19:39:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rdfatSjt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730470AbgKITjf (ORCPT ); Mon, 9 Nov 2020 14:39:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729831AbgKITjf (ORCPT ); Mon, 9 Nov 2020 14:39:35 -0500 Received: from mail-qt1-x843.google.com (mail-qt1-x843.google.com [IPv6:2607:f8b0:4864:20::843]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CE7BC0613CF; Mon, 9 Nov 2020 11:39:35 -0800 (PST) Received: by mail-qt1-x843.google.com with SMTP id t5so6882954qtp.2; Mon, 09 Nov 2020 11:39:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=dlaNl8psgDveUmc9otkF1XnarLugqrJ7ajs/WgVC65s=; b=rdfatSjtsDEoFMoy8KEt1MRlRjaJkIWUd3fmOcwAvN/97dhdgcjEKMNqMVRn+tVcgp 6Waa04oida43VWPuEMREeBD5TSSqKEignxQ3EwM/EDfK9q13Sbd/XfgIdoKIP1aJQMN9 sMJ5YgnhKiKmBvQ/oEP/1jUD1X0IEJAijrjaCdgh5KAI4YcIa6ogf0KD7SIsxvhBegO4 lTp72zWxKMmR0O4XHGvaini3B2PnApI4sUku5oXgyMGIM6kIn815q3Li1WwJqkHUQLIQ LZGRNxtuxTu3deKLnHh18/jInq/MOoNH67AqCbPOsDZ0nPOp9V55OTpLll67etKoEiip dqNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=dlaNl8psgDveUmc9otkF1XnarLugqrJ7ajs/WgVC65s=; b=JNrTk0HEEcM11NZ+obuaNfSNCgMD/wjjGK3XHeTD66UzsuKA/eYaPjeidiNetVGulf /DVJsnTubN7SMnDs+7XcBI+vXTFxx4KlOJVsryg9XIp3rEMulBEQCnJIoZl5rz8IVHiC HWYaVLBSqFXcz+5bBeTnVczYCHDbuXzkttkmYiWHuIY424lZ9sivX8l8wRXD5OtQjz5G 2IQTZRSXop8oyTSWvlr9RmOTM6KtZ1xutFluEFXw660KYMAce6fldDK8V+x4OjAm1Gd/ k1yP63ln+fNJpIVSRJNfCIrWEA2Ejsn0cVcZ/weHV0f8lMpja67l+PrEadf1rLOhVNeX Qirg== X-Gm-Message-State: AOAM532XbGEzcQeyC5l8zFV5N8WQFn0Tcx/bsPUYCCT+p8qnTHCcBqQh X9vDfoKJkUXVnFqIkoybsW19zYhMj7U= X-Google-Smtp-Source: ABdhPJxzwK+Bnqv3ZkQ4W0+d5LPrJKilFhmRRfEzPw0jrXyzwyChxQvMPCn8wJ8y0xNv/UOnmHIb9Q== X-Received: by 2002:ac8:59c9:: with SMTP id f9mr14014439qtf.85.1604950773967; Mon, 09 Nov 2020 11:39:33 -0800 (PST) Received: from gateway.1015granger.net (c-68-61-232-219.hsd1.mi.comcast.net. [68.61.232.219]) by smtp.gmail.com with ESMTPSA id h16sm6722130qka.47.2020.11.09.11.39.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 11:39:33 -0800 (PST) Sender: Chuck Lever Received: from manet.1015granger.net (manet.1015granger.net [192.168.1.51]) by gateway.1015granger.net (8.14.7/8.14.7) with ESMTP id 0A9JdV5B021800; Mon, 9 Nov 2020 19:39:31 GMT Subject: [PATCH v1 04/13] xprtrdma: Introduce FRWR completion IDs From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org Date: Mon, 09 Nov 2020 14:39:31 -0500 Message-ID: <160495077182.2072548.2905105620059977472.stgit@manet.1015granger.net> In-Reply-To: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> References: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> User-Agent: StGit/0.23-29-ga622f1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Set up a completion ID in each rpcrdma_frwr. The ID is used to match an incoming completion to a transport (CQ) and other MR-related activity. Signed-off-by: Chuck Lever --- include/trace/events/rpcrdma.h | 44 ++++----------------------------------- net/sunrpc/xprtrdma/frwr_ops.c | 29 ++++++++++++++++++++------ net/sunrpc/xprtrdma/xprt_rdma.h | 1 + 3 files changed, 27 insertions(+), 47 deletions(-) diff --git a/include/trace/events/rpcrdma.h b/include/trace/events/rpcrdma.h index ab239f4f924e..9e30f8aa3562 100644 --- a/include/trace/events/rpcrdma.h +++ b/include/trace/events/rpcrdma.h @@ -261,41 +261,6 @@ DECLARE_EVENT_CLASS(xprtrdma_wrch_event, ), \ TP_ARGS(task, mr, nsegs)) -DECLARE_EVENT_CLASS(xprtrdma_frwr_done, - TP_PROTO( - const struct ib_wc *wc, - const struct rpcrdma_frwr *frwr - ), - - TP_ARGS(wc, frwr), - - TP_STRUCT__entry( - __field(u32, mr_id) - __field(unsigned int, status) - __field(unsigned int, vendor_err) - ), - - TP_fast_assign( - __entry->mr_id = frwr->fr_mr->res.id; - __entry->status = wc->status; - __entry->vendor_err = __entry->status ? wc->vendor_err : 0; - ), - - TP_printk( - "mr.id=%u: %s (%u/0x%x)", - __entry->mr_id, rdma_show_wc_status(__entry->status), - __entry->status, __entry->vendor_err - ) -); - -#define DEFINE_FRWR_DONE_EVENT(name) \ - DEFINE_EVENT(xprtrdma_frwr_done, name, \ - TP_PROTO( \ - const struct ib_wc *wc, \ - const struct rpcrdma_frwr *frwr \ - ), \ - TP_ARGS(wc, frwr)) - TRACE_DEFINE_ENUM(DMA_BIDIRECTIONAL); TRACE_DEFINE_ENUM(DMA_TO_DEVICE); TRACE_DEFINE_ENUM(DMA_FROM_DEVICE); @@ -850,11 +815,10 @@ TRACE_EVENT(xprtrdma_post_linv, DEFINE_COMPLETION_EVENT(xprtrdma_wc_receive); DEFINE_COMPLETION_EVENT(xprtrdma_wc_send); - -DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_fastreg); -DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li); -DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li_wake); -DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li_done); +DEFINE_COMPLETION_EVENT(xprtrdma_wc_fastreg); +DEFINE_COMPLETION_EVENT(xprtrdma_wc_li); +DEFINE_COMPLETION_EVENT(xprtrdma_wc_li_wake); +DEFINE_COMPLETION_EVENT(xprtrdma_wc_li_done); TRACE_EVENT(xprtrdma_frwr_alloc, TP_PROTO( diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c index 44888f5badef..2cc6862a52dc 100644 --- a/net/sunrpc/xprtrdma/frwr_ops.c +++ b/net/sunrpc/xprtrdma/frwr_ops.c @@ -363,12 +363,21 @@ static void frwr_wc_fastreg(struct ib_cq *cq, struct ib_wc *wc) container_of(cqe, struct rpcrdma_frwr, fr_cqe); /* WARNING: Only wr_cqe and status are reliable at this point */ - trace_xprtrdma_wc_fastreg(wc, frwr); + trace_xprtrdma_wc_fastreg(wc, &frwr->fr_cid); /* The MR will get recycled when the associated req is retransmitted */ rpcrdma_flush_disconnect(cq->cq_context, wc); } +static void frwr_cid_init(struct rpcrdma_ep *ep, + struct rpcrdma_frwr *frwr) +{ + struct rpc_rdma_cid *cid = &frwr->fr_cid; + + cid->ci_queue_id = ep->re_attr.send_cq->res.id; + cid->ci_completion_id = frwr->fr_mr->res.id; +} + /** * frwr_send - post Send WRs containing the RPC Call message * @r_xprt: controlling transport instance @@ -385,6 +394,7 @@ static void frwr_wc_fastreg(struct ib_cq *cq, struct ib_wc *wc) */ int frwr_send(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) { + struct rpcrdma_ep *ep = r_xprt->rx_ep; struct ib_send_wr *post_wr; struct rpcrdma_mr *mr; @@ -395,6 +405,7 @@ int frwr_send(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) frwr = &mr->frwr; frwr->fr_cqe.done = frwr_wc_fastreg; + frwr_cid_init(ep, frwr); frwr->fr_regwr.wr.next = post_wr; frwr->fr_regwr.wr.wr_cqe = &frwr->fr_cqe; frwr->fr_regwr.wr.num_sge = 0; @@ -404,7 +415,7 @@ int frwr_send(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) post_wr = &frwr->fr_regwr.wr; } - return ib_post_send(r_xprt->rx_ep->re_id->qp, post_wr, NULL); + return ib_post_send(ep->re_id->qp, post_wr, NULL); } /** @@ -448,7 +459,7 @@ static void frwr_wc_localinv(struct ib_cq *cq, struct ib_wc *wc) struct rpcrdma_mr *mr = container_of(frwr, struct rpcrdma_mr, frwr); /* WARNING: Only wr_cqe and status are reliable at this point */ - trace_xprtrdma_wc_li(wc, frwr); + trace_xprtrdma_wc_li(wc, &frwr->fr_cid); __frwr_release_mr(wc, mr); rpcrdma_flush_disconnect(cq->cq_context, wc); @@ -469,7 +480,7 @@ static void frwr_wc_localinv_wake(struct ib_cq *cq, struct ib_wc *wc) struct rpcrdma_mr *mr = container_of(frwr, struct rpcrdma_mr, frwr); /* WARNING: Only wr_cqe and status are reliable at this point */ - trace_xprtrdma_wc_li_wake(wc, frwr); + trace_xprtrdma_wc_li_wake(wc, &frwr->fr_cid); __frwr_release_mr(wc, mr); complete(&frwr->fr_linv_done); @@ -490,6 +501,7 @@ static void frwr_wc_localinv_wake(struct ib_cq *cq, struct ib_wc *wc) void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) { struct ib_send_wr *first, **prev, *last; + struct rpcrdma_ep *ep = r_xprt->rx_ep; const struct ib_send_wr *bad_wr; struct rpcrdma_frwr *frwr; struct rpcrdma_mr *mr; @@ -509,6 +521,7 @@ void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) frwr = &mr->frwr; frwr->fr_cqe.done = frwr_wc_localinv; + frwr_cid_init(ep, frwr); last = &frwr->fr_invwr; last->next = NULL; last->wr_cqe = &frwr->fr_cqe; @@ -534,7 +547,7 @@ void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) * unless re_id->qp is a valid pointer. */ bad_wr = NULL; - rc = ib_post_send(r_xprt->rx_ep->re_id->qp, first, &bad_wr); + rc = ib_post_send(ep->re_id->qp, first, &bad_wr); /* The final LOCAL_INV WR in the chain is supposed to * do the wake. If it was never posted, the wake will @@ -574,7 +587,7 @@ static void frwr_wc_localinv_done(struct ib_cq *cq, struct ib_wc *wc) struct rpcrdma_rep *rep = mr->mr_req->rl_reply; /* WARNING: Only wr_cqe and status are reliable at this point */ - trace_xprtrdma_wc_li_done(wc, frwr); + trace_xprtrdma_wc_li_done(wc, &frwr->fr_cid); __frwr_release_mr(wc, mr); /* Ensure @rep is generated before __frwr_release_mr */ @@ -597,6 +610,7 @@ static void frwr_wc_localinv_done(struct ib_cq *cq, struct ib_wc *wc) void frwr_unmap_async(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) { struct ib_send_wr *first, *last, **prev; + struct rpcrdma_ep *ep = r_xprt->rx_ep; const struct ib_send_wr *bad_wr; struct rpcrdma_frwr *frwr; struct rpcrdma_mr *mr; @@ -614,6 +628,7 @@ void frwr_unmap_async(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) frwr = &mr->frwr; frwr->fr_cqe.done = frwr_wc_localinv; + frwr_cid_init(ep, frwr); last = &frwr->fr_invwr; last->next = NULL; last->wr_cqe = &frwr->fr_cqe; @@ -639,7 +654,7 @@ void frwr_unmap_async(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) * unless re_id->qp is a valid pointer. */ bad_wr = NULL; - rc = ib_post_send(r_xprt->rx_ep->re_id->qp, first, &bad_wr); + rc = ib_post_send(ep->re_id->qp, first, &bad_wr); if (!rc) return; diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h index 4eb8e32b9f4a..cef9d0f2e2c8 100644 --- a/net/sunrpc/xprtrdma/xprt_rdma.h +++ b/net/sunrpc/xprtrdma/xprt_rdma.h @@ -231,6 +231,7 @@ struct rpcrdma_sendctx { struct rpcrdma_frwr { struct ib_mr *fr_mr; struct ib_cqe fr_cqe; + struct rpc_rdma_cid fr_cid; struct completion fr_linv_done; union { struct ib_reg_wr fr_regwr; From patchwork Mon Nov 9 19:39:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever III X-Patchwork-Id: 11892387 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4917316C1 for ; Mon, 9 Nov 2020 19:39:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 20B0B206E3 for ; Mon, 9 Nov 2020 19:39:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sUxs7RUm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729831AbgKITjk (ORCPT ); Mon, 9 Nov 2020 14:39:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729697AbgKITjk (ORCPT ); Mon, 9 Nov 2020 14:39:40 -0500 Received: from mail-qt1-x843.google.com (mail-qt1-x843.google.com [IPv6:2607:f8b0:4864:20::843]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9F4DC0613CF; Mon, 9 Nov 2020 11:39:39 -0800 (PST) Received: by mail-qt1-x843.google.com with SMTP id p12so6871164qtp.7; Mon, 09 Nov 2020 11:39:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=JxQnsVHTLgZB1dpwkyNcwz47s2yUqojEka1kJLGKHng=; b=sUxs7RUmRlTWzLxF75ouRAYoLvm9VJTka3Bh3IkDYQhObo68w10RXshQEIf8ihvliM HRMp+DN5Bws4VU/GkiGg+/zdlXDOWOWDG0E7/Nb6IXLWN4m4oPCxrbFUOgLt1IwMLKn8 1lltCFtcPsIRgtWvGlZF90sRKx+gJE4FA9tvg9v+3NrSCLFzkGVsg1QjQArf6zPUvmPw YPt5kyZeanHSpnIyvFlyZCoPjZifZZeqbYPXECi1D/gXB2eidXEO3Hl9nyhbmBV9swuU YjPvSbsJk9PPbORIBVuAklAPyJ4xRe1LG1CZ//gV2l292BMV1QVzUvLi7f1G8rXquTRu y+EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=JxQnsVHTLgZB1dpwkyNcwz47s2yUqojEka1kJLGKHng=; b=U+63DrGmrKSHOXlhfR0h++sleuHdCjrwHqhOxgC7BzzYXFPnoNtmglOXDEXmZoLT79 rnPJH6gNFiVqD7FJEzGLUqY4jgqW3Fds+pBBuX+xZwdTrstGAdjJoc8iE2eA6WTV0wKg oL/pUZTIU5KVuJbOZBIgnqkKaz59iiC2Vr69zeCFUb+McUruSD9ZrhcchOoPb6lUbbSC LfrToYKpketu8HmiDe+RGysLHLWZGFkqdphUh2xqeCQZxCB2iwc+6IkqOeMhCrcKMaAK BAMvW+mfYjrxGvrDZDKMA4tBhNzS2sZvKwWz0n58DuhEqnkpE3m2sWbMFtAr9TjRNzcl yx4A== X-Gm-Message-State: AOAM532KgEKICQCbhswT6Mx706o78TNkNSmEjLI2EyYyvOX0swxu8seF QGLzZZPTHO/ziaQRElLaP3KuaLoNBjE= X-Google-Smtp-Source: ABdhPJw0/fmjh5BWh25xuup/o2OBf8BsEQ7YVHZf9hDZls/eXgybkEG1B+r0aRW3xxycezeUkKrjIQ== X-Received: by 2002:ac8:454d:: with SMTP id z13mr12682058qtn.175.1604950778846; Mon, 09 Nov 2020 11:39:38 -0800 (PST) Received: from gateway.1015granger.net (c-68-61-232-219.hsd1.mi.comcast.net. [68.61.232.219]) by smtp.gmail.com with ESMTPSA id r204sm6968266qka.122.2020.11.09.11.39.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 11:39:38 -0800 (PST) Sender: Chuck Lever Received: from manet.1015granger.net (manet.1015granger.net [192.168.1.51]) by gateway.1015granger.net (8.14.7/8.14.7) with ESMTP id 0A9JdbHn021804; Mon, 9 Nov 2020 19:39:37 GMT Subject: [PATCH v1 05/13] xprtrdma: Clean up trace_xprtrdma_post_linv From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org Date: Mon, 09 Nov 2020 14:39:37 -0500 Message-ID: <160495077716.2072548.2427574020160558580.stgit@manet.1015granger.net> In-Reply-To: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> References: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> User-Agent: StGit/0.23-29-ga622f1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org - Replace the display of kernel memory addresses - Add "_err" to the end of its name to indicate that it's a tracepoint that fires only when there's an error Signed-off-by: Chuck Lever --- include/trace/events/rpcrdma.h | 16 +++++++++------- net/sunrpc/xprtrdma/frwr_ops.c | 4 ++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/include/trace/events/rpcrdma.h b/include/trace/events/rpcrdma.h index 9e30f8aa3562..b0750c0d2753 100644 --- a/include/trace/events/rpcrdma.h +++ b/include/trace/events/rpcrdma.h @@ -784,7 +784,7 @@ TRACE_EVENT(xprtrdma_post_recvs, ) ); -TRACE_EVENT(xprtrdma_post_linv, +TRACE_EVENT(xprtrdma_post_linv_err, TP_PROTO( const struct rpcrdma_req *req, int status @@ -793,19 +793,21 @@ TRACE_EVENT(xprtrdma_post_linv, TP_ARGS(req, status), TP_STRUCT__entry( - __field(const void *, req) + __field(unsigned int, task_id) + __field(unsigned int, client_id) __field(int, status) - __field(u32, xid) ), TP_fast_assign( - __entry->req = req; + const struct rpc_task *task = req->rl_slot.rq_task; + + __entry->task_id = task->tk_pid; + __entry->client_id = task->tk_client->cl_clid; __entry->status = status; - __entry->xid = be32_to_cpu(req->rl_slot.rq_xid); ), - TP_printk("req=%p xid=0x%08x status=%d", - __entry->req, __entry->xid, __entry->status + TP_printk("task:%u@%u status=%d", + __entry->task_id, __entry->client_id, __entry->status ) ); diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c index 2cc6862a52dc..76322b1acf3d 100644 --- a/net/sunrpc/xprtrdma/frwr_ops.c +++ b/net/sunrpc/xprtrdma/frwr_ops.c @@ -560,7 +560,7 @@ void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) /* Recycle MRs in the LOCAL_INV chain that did not get posted. */ - trace_xprtrdma_post_linv(req, rc); + trace_xprtrdma_post_linv_err(req, rc); while (bad_wr) { frwr = container_of(bad_wr, struct rpcrdma_frwr, fr_invwr); @@ -660,7 +660,7 @@ void frwr_unmap_async(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) /* Recycle MRs in the LOCAL_INV chain that did not get posted. */ - trace_xprtrdma_post_linv(req, rc); + trace_xprtrdma_post_linv_err(req, rc); while (bad_wr) { frwr = container_of(bad_wr, struct rpcrdma_frwr, fr_invwr); mr = container_of(frwr, struct rpcrdma_mr, frwr); From patchwork Mon Nov 9 19:39:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever III X-Patchwork-Id: 11892391 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ABF361391 for ; Mon, 9 Nov 2020 19:39:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 86CE3206E3 for ; Mon, 9 Nov 2020 19:39:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N1s/Z2yp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730490AbgKITjp (ORCPT ); Mon, 9 Nov 2020 14:39:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729697AbgKITjp (ORCPT ); Mon, 9 Nov 2020 14:39:45 -0500 Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 718C5C0613CF; Mon, 9 Nov 2020 11:39:45 -0800 (PST) Received: by mail-qk1-x72f.google.com with SMTP id h15so9081438qkl.13; Mon, 09 Nov 2020 11:39:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=pFmSTPq2X6QoYR0uzNsi6sAGzG1HoxcBY5oCQljopBM=; b=N1s/Z2yp7ojCW7vty2oumHHzUH9dSbWUryjTkmeWBin4WVevHaJzfhkm9Z1aElD+DY 52bw+h/GrakBSoyalnHTJLDgMVAghUXunUwHCOYIlreGw+KfcKqhH8+lN/IQXpGOBLzk 9QF4ezLsMJa5lDTydH1WvHsoOYM0Epvp3q4K6c2geqmKHBg+IeFnRUBC8R0kSvkO1Qdl BWTSCn4cWElzVq1D+egwbhAcLp51VmZyC9hHHZgKX9VCu4dQYcv2tcWDCo258uFFg+iF 3eRY6kM7G3zmKDRwyHpER18DsJ6fovsrlnv9ZrlqLLuik3sh6HJMz3F4unbezXXWdEZv /zgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=pFmSTPq2X6QoYR0uzNsi6sAGzG1HoxcBY5oCQljopBM=; b=J7PhF3SmgkeoD58SuMWZO6CAxjZpEf3Uswlu5cDOV1pZYjRz83It7pDK03MgvmgFJ5 H51T4WS2dG5zx7Sk6ZwPXinJMoYopbhuwtOPNQkvGVcyYIkrbbJsahHAO0qLCJltGbru oCP679Cw/gfuNtTxzLUSPSNkDG0ZW/vPOGr3/lVb98okqpBYVsuT82n+IiuLJ7Z8d8XO zLIZslvTSOsNtdfLAmBZuSi5+lQ0A4uCxlPrc30lhGtdv3c4OGlTw9jWXPf5XHVxXvRp +0E/xdbqHK3KgEfNE9PxRxbp/QZv6T+vawOZM43zyKF3zePrUt1aIUpen7PADoQvYRdN 5d1g== X-Gm-Message-State: AOAM5338E1z2YG+ylZVUbp8oD+6zqYAtTg8rVBpt5f6yTANQOVLT2jsF MWzwNTZECn0gRGBg+0/+HEyFNxqINtI= X-Google-Smtp-Source: ABdhPJzFfIR5HyUfkVAzAHFsU5h3QtBMFgjHeCSzUvggbkOo3wKbHgazP7PDLO/yZ4Mat54+cTPUvg== X-Received: by 2002:a05:620a:697:: with SMTP id f23mr15132905qkh.374.1604950784300; Mon, 09 Nov 2020 11:39:44 -0800 (PST) Received: from gateway.1015granger.net (c-68-61-232-219.hsd1.mi.comcast.net. [68.61.232.219]) by smtp.gmail.com with ESMTPSA id v14sm6671285qkb.15.2020.11.09.11.39.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 11:39:43 -0800 (PST) Sender: Chuck Lever Received: from manet.1015granger.net (manet.1015granger.net [192.168.1.51]) by gateway.1015granger.net (8.14.7/8.14.7) with ESMTP id 0A9Jdg4S021807; Mon, 9 Nov 2020 19:39:42 GMT Subject: [PATCH v1 06/13] xprtrdma: Clean up reply parsing error tracepoints From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org Date: Mon, 09 Nov 2020 14:39:42 -0500 Message-ID: <160495078250.2072548.16793898833643155194.stgit@manet.1015granger.net> In-Reply-To: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> References: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> User-Agent: StGit/0.23-29-ga622f1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org - Rename the tracepoints with the "_err" suffix to indicate these are rare error events - Replace display of kernel memory addresses - Tie the XID and error to a connection IP address instead Signed-off-by: Chuck Lever --- include/trace/events/rpcrdma.h | 27 ++++++++++++++------------- net/sunrpc/xprtrdma/rpc_rdma.c | 10 +++++----- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/include/trace/events/rpcrdma.h b/include/trace/events/rpcrdma.h index b0750c0d2753..93d717d8139f 100644 --- a/include/trace/events/rpcrdma.h +++ b/include/trace/events/rpcrdma.h @@ -60,7 +60,7 @@ DECLARE_EVENT_CLASS(rpcrdma_completion_class, ), \ TP_ARGS(wc, cid)) -DECLARE_EVENT_CLASS(xprtrdma_reply_event, +DECLARE_EVENT_CLASS(xprtrdma_reply_class, TP_PROTO( const struct rpcrdma_rep *rep ), @@ -68,29 +68,30 @@ DECLARE_EVENT_CLASS(xprtrdma_reply_event, TP_ARGS(rep), TP_STRUCT__entry( - __field(const void *, rep) - __field(const void *, r_xprt) __field(u32, xid) __field(u32, version) __field(u32, proc) + __string(addr, rpcrdma_addrstr(rep->rr_rxprt)) + __string(port, rpcrdma_portstr(rep->rr_rxprt)) ), TP_fast_assign( - __entry->rep = rep; - __entry->r_xprt = rep->rr_rxprt; __entry->xid = be32_to_cpu(rep->rr_xid); __entry->version = be32_to_cpu(rep->rr_vers); __entry->proc = be32_to_cpu(rep->rr_proc); + __assign_str(addr, rpcrdma_addrstr(rep->rr_rxprt)); + __assign_str(port, rpcrdma_portstr(rep->rr_rxprt)); ), - TP_printk("rxprt %p xid=0x%08x rep=%p: version %u proc %u", - __entry->r_xprt, __entry->xid, __entry->rep, - __entry->version, __entry->proc + TP_printk("peer=[%s]:%s xid=0x%08x version=%u proc=%u", + __get_str(addr), __get_str(port), + __entry->xid, __entry->version, __entry->proc ) ); #define DEFINE_REPLY_EVENT(name) \ - DEFINE_EVENT(xprtrdma_reply_event, name, \ + DEFINE_EVENT(xprtrdma_reply_class, \ + xprtrdma_reply_##name##_err, \ TP_PROTO( \ const struct rpcrdma_rep *rep \ ), \ @@ -1030,10 +1031,10 @@ TRACE_EVENT(xprtrdma_defer_cmp, ) ); -DEFINE_REPLY_EVENT(xprtrdma_reply_vers); -DEFINE_REPLY_EVENT(xprtrdma_reply_rqst); -DEFINE_REPLY_EVENT(xprtrdma_reply_short); -DEFINE_REPLY_EVENT(xprtrdma_reply_hdr); +DEFINE_REPLY_EVENT(vers); +DEFINE_REPLY_EVENT(rqst); +DEFINE_REPLY_EVENT(short); +DEFINE_REPLY_EVENT(hdr); TRACE_EVENT(xprtrdma_err_vers, TP_PROTO( diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c index c178f93aa40b..29f847c8f609 100644 --- a/net/sunrpc/xprtrdma/rpc_rdma.c +++ b/net/sunrpc/xprtrdma/rpc_rdma.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* - * Copyright (c) 2014-2017 Oracle. All rights reserved. + * Copyright (c) 2014-2020, Oracle and/or its affiliates. * Copyright (c) 2003-2007 Network Appliance, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -1369,7 +1369,7 @@ void rpcrdma_complete_rqst(struct rpcrdma_rep *rep) return; out_badheader: - trace_xprtrdma_reply_hdr(rep); + trace_xprtrdma_reply_hdr_err(rep); r_xprt->rx_stats.bad_reply_count++; rqst->rq_task->tk_status = status; status = 0; @@ -1462,16 +1462,16 @@ void rpcrdma_reply_handler(struct rpcrdma_rep *rep) return; out_badversion: - trace_xprtrdma_reply_vers(rep); + trace_xprtrdma_reply_vers_err(rep); goto out; out_norqst: spin_unlock(&xprt->queue_lock); - trace_xprtrdma_reply_rqst(rep); + trace_xprtrdma_reply_rqst_err(rep); goto out; out_shortreply: - trace_xprtrdma_reply_short(rep); + trace_xprtrdma_reply_short_err(rep); out: rpcrdma_recv_buffer_put(rep); From patchwork Mon Nov 9 19:39:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever III X-Patchwork-Id: 11892395 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 242D51746 for ; Mon, 9 Nov 2020 19:39:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF8B9206A1 for ; Mon, 9 Nov 2020 19:39:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ddv5SS0n" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730580AbgKITjv (ORCPT ); Mon, 9 Nov 2020 14:39:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729697AbgKITjv (ORCPT ); Mon, 9 Nov 2020 14:39:51 -0500 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A38C2C0613CF; Mon, 9 Nov 2020 11:39:50 -0800 (PST) Received: by mail-qk1-x742.google.com with SMTP id l2so9129927qkf.0; Mon, 09 Nov 2020 11:39:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=JY/P8KIws5TAga7tUT3/gSDQCvJoPVAqnDHVNoHGMUc=; b=ddv5SS0nrLrvukVPPlIQhneHbzizOnOpBa/l6U5SeOPiBi1wF7R6is9FJJgIt2kFpV K/BhsY/5EX6QW5ZQfNuR8KZenQ3ayEAGsV8zOFPZ9s6Y5JkZzn0LgJWnTPVvp4ZqsiEC KY2jb87ynnicRKpmBjSgmvwG7J8nVa32UifBSoVAByX0MFuSGHkn9NVVdFQKjF5ASLhW 7/MjMmDydrrjl7kzjVZYN/mZxtrdxHuj3j7AnbDXpbNZKgsiCTKkYFbVfwPG0lC6c9aR gC87wVEprIqLiQqmWfvItHp1DBs3kptikfN71hRz/aiuPaxBPagLkBJ+MpcfaYSdA08K JrVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=JY/P8KIws5TAga7tUT3/gSDQCvJoPVAqnDHVNoHGMUc=; b=dc6hhxAHe6azNgKdMXbqAKarny40v9AKe1Q0HrWpVtzd9tEsOm4L8H8O6WgQKJ48/U dkiH2PTQWakkrqV0PHAZ4yObAGGKixi++nWneXbPg2hX+4ZmLyK0nepa4hOHS/6F7RYQ SI6LMzc/bR9f1dkn5DzAGRJmvRe+7S71n267HPx5cWgFDuwY9uCSi/Dbtkf1tfaxCn0f gSV0ZjD+CGeDpdO4g6hKSSFYJqZdIpdouw2CDaLp9ktmncZOMwET0E00WYzZhlyHzAI6 0F005/kovq3ftjZHMW7EsqaoQ3zNVlz+SpFpvHek+gicXtmTwwdit3mYIlzYnggkY/qD 8TJg== X-Gm-Message-State: AOAM533UoQantaumUqZ86iNLI/kRRTzeqYfFIPk4Dk3/8mMfgOlD6vKM XJO87oXUfvE3k76AFFfh+pVg4fzikZo= X-Google-Smtp-Source: ABdhPJzD2x4CcVI8PGOtQ3e9tywamaZnpT6RoskSuiPjwfpxMNOwu8HDFNzPAU9dqRktZ2ainGRJ5A== X-Received: by 2002:a37:6c06:: with SMTP id h6mr15579090qkc.288.1604950789517; Mon, 09 Nov 2020 11:39:49 -0800 (PST) Received: from gateway.1015granger.net (c-68-61-232-219.hsd1.mi.comcast.net. [68.61.232.219]) by smtp.gmail.com with ESMTPSA id f61sm6332687qtb.75.2020.11.09.11.39.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 11:39:48 -0800 (PST) Sender: Chuck Lever Received: from manet.1015granger.net (manet.1015granger.net [192.168.1.51]) by gateway.1015granger.net (8.14.7/8.14.7) with ESMTP id 0A9JdluR021810; Mon, 9 Nov 2020 19:39:47 GMT Subject: [PATCH v1 07/13] xprtrdma: Clean up tracepoints in the reply path From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org Date: Mon, 09 Nov 2020 14:39:47 -0500 Message-ID: <160495078762.2072548.8813363103493808175.stgit@manet.1015granger.net> In-Reply-To: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> References: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> User-Agent: StGit/0.23-29-ga622f1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Replace unnecessary display of kernel memory addresses. Also, there are no longer any trace_xprtrdma_defer_cmp() call sites. And remove the trace_xprtrdma_leaked_rep() tracepoint because there doesn't seem to be an overwhelming need to have a tracepoint for catching a software bug that has long since been fixed. Signed-off-by: Chuck Lever --- include/trace/events/rpcrdma.h | 66 ++-------------------------------------- net/sunrpc/xprtrdma/rpc_rdma.c | 6 +--- 2 files changed, 5 insertions(+), 67 deletions(-) diff --git a/include/trace/events/rpcrdma.h b/include/trace/events/rpcrdma.h index 93d717d8139f..c28bf17e769b 100644 --- a/include/trace/events/rpcrdma.h +++ b/include/trace/events/rpcrdma.h @@ -974,17 +974,14 @@ TRACE_EVENT(xprtrdma_reply, TP_PROTO( const struct rpc_task *task, const struct rpcrdma_rep *rep, - const struct rpcrdma_req *req, unsigned int credits ), - TP_ARGS(task, rep, req, credits), + TP_ARGS(task, rep, credits), TP_STRUCT__entry( __field(unsigned int, task_id) __field(unsigned int, client_id) - __field(const void *, rep) - __field(const void *, req) __field(u32, xid) __field(unsigned int, credits) ), @@ -992,42 +989,13 @@ TRACE_EVENT(xprtrdma_reply, TP_fast_assign( __entry->task_id = task->tk_pid; __entry->client_id = task->tk_client->cl_clid; - __entry->rep = rep; - __entry->req = req; __entry->xid = be32_to_cpu(rep->rr_xid); __entry->credits = credits; ), - TP_printk("task:%u@%u xid=0x%08x, %u credits, rep=%p -> req=%p", - __entry->task_id, __entry->client_id, __entry->xid, - __entry->credits, __entry->rep, __entry->req - ) -); - -TRACE_EVENT(xprtrdma_defer_cmp, - TP_PROTO( - const struct rpcrdma_rep *rep - ), - - TP_ARGS(rep), - - TP_STRUCT__entry( - __field(unsigned int, task_id) - __field(unsigned int, client_id) - __field(const void *, rep) - __field(u32, xid) - ), - - TP_fast_assign( - __entry->task_id = rep->rr_rqst->rq_task->tk_pid; - __entry->client_id = rep->rr_rqst->rq_task->tk_client->cl_clid; - __entry->rep = rep; - __entry->xid = be32_to_cpu(rep->rr_xid); - ), - - TP_printk("task:%u@%u xid=0x%08x rep=%p", + TP_printk("task:%u@%u xid=0x%08x credits=%u", __entry->task_id, __entry->client_id, __entry->xid, - __entry->rep + __entry->credits ) ); @@ -1212,34 +1180,6 @@ TRACE_EVENT(xprtrdma_cb_setup, DEFINE_CB_EVENT(xprtrdma_cb_call); DEFINE_CB_EVENT(xprtrdma_cb_reply); -TRACE_EVENT(xprtrdma_leaked_rep, - TP_PROTO( - const struct rpc_rqst *rqst, - const struct rpcrdma_rep *rep - ), - - TP_ARGS(rqst, rep), - - TP_STRUCT__entry( - __field(unsigned int, task_id) - __field(unsigned int, client_id) - __field(u32, xid) - __field(const void *, rep) - ), - - TP_fast_assign( - __entry->task_id = rqst->rq_task->tk_pid; - __entry->client_id = rqst->rq_task->tk_client->cl_clid; - __entry->xid = be32_to_cpu(rqst->rq_xid); - __entry->rep = rep; - ), - - TP_printk("task:%u@%u xid=0x%08x rep=%p", - __entry->task_id, __entry->client_id, __entry->xid, - __entry->rep - ) -); - /** ** Server-side RPC/RDMA events **/ diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c index 29f847c8f609..8078559bdc31 100644 --- a/net/sunrpc/xprtrdma/rpc_rdma.c +++ b/net/sunrpc/xprtrdma/rpc_rdma.c @@ -1443,14 +1443,12 @@ void rpcrdma_reply_handler(struct rpcrdma_rep *rep) rpcrdma_post_recvs(r_xprt, false); req = rpcr_to_rdmar(rqst); - if (req->rl_reply) { - trace_xprtrdma_leaked_rep(rqst, req->rl_reply); + if (unlikely(req->rl_reply)) rpcrdma_recv_buffer_put(req->rl_reply); - } req->rl_reply = rep; rep->rr_rqst = rqst; - trace_xprtrdma_reply(rqst->rq_task, rep, req, credits); + trace_xprtrdma_reply(rqst->rq_task, rep, credits); if (rep->rr_wc_flags & IB_WC_WITH_INVALIDATE) frwr_reminv(rep, &req->rl_registered); From patchwork Mon Nov 9 19:39:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever III X-Patchwork-Id: 11892399 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1B7D816C1 for ; Mon, 9 Nov 2020 19:39:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E7CFD206A1 for ; Mon, 9 Nov 2020 19:39:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Lhjbj6kd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729984AbgKITj4 (ORCPT ); Mon, 9 Nov 2020 14:39:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729871AbgKITjz (ORCPT ); Mon, 9 Nov 2020 14:39:55 -0500 Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA558C0613CF; Mon, 9 Nov 2020 11:39:55 -0800 (PST) Received: by mail-qk1-x734.google.com with SMTP id 11so9104534qkd.5; Mon, 09 Nov 2020 11:39:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=taDnBlfi+Lo8dxGn8A9RZ4ZuDt+nEI+u+WgtqvzKTu8=; b=Lhjbj6kdeWt1Y5mZvfTzXPEU/4H5guwDm6ALZuh/Inl/1amwxNFMJwoYLwo5fy0Zl1 QTTPLbGATMFub8Lof3LNLgBHMt9KuTyw9JYUg2vsHfMKdEOQBdfT6aAG9RMmpKgsJ0w1 MIxTnJJqs+hMlzWnSuSLcc2twd2Ga8979Sz+O9Paz3xkxapCjbgM91BPVMrs0WWXRzo2 dgi7tze7k9W/6WVbj4XfDCryZV9k2g2zaHRXfCH9LSYGAmvp3TLgZI8i7IGvxC71dHbV 9yKuEUREaT3UxM/Crgk1QiP9uflCYM5FIu0GU5yyx3P18gwhrFJ66ES1n10wmWUkf9SZ xNNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=taDnBlfi+Lo8dxGn8A9RZ4ZuDt+nEI+u+WgtqvzKTu8=; b=OqGJXT5K7rcopiy5x3Cwo97y16gYi0oXigQa8pFna8AExETDiQ7LrywEsmUE5Nm3mF RDyUs/6H2VGO8z7LnnsIKWyytJlGm2zToL6C4FM9UR3ba5/DcKJAQ1Q205dMxXtqSCLA Z4lCZwbK0TcV40Irti3KdElu2IczD1nDPhoKC1nlb/sqjpRW9O1SzoLLSWnSUnTnBo+g IbK6I+KWZdeFi/UmOQlQOp1WPSeJ4zUmBFzyJKfcEVTtdrrHttAE2NJIfdVQLNZ4Oper 6DgNSeEowlSazo4Asn1qqPC36k+MX4I1tTfU5KJrq7+5fPvIC2OXST+r69xbvaKfktFU N36g== X-Gm-Message-State: AOAM53076poht3QuTv1c558+YRoyw0eklHhe1CCkgk/BYl+EoG7qFsQZ aRgc7y9JS1p/y/dr54wvTlN9a+Vm/6g= X-Google-Smtp-Source: ABdhPJycmFG3/10mSVZpUJdJZ7SSoOF7/4jdbs6YvscT98Glin5aMdw1/tmyBa2ujAqAovUH9Q1hCg== X-Received: by 2002:a05:620a:10a3:: with SMTP id h3mr4411164qkk.459.1604950794615; Mon, 09 Nov 2020 11:39:54 -0800 (PST) Received: from gateway.1015granger.net (c-68-61-232-219.hsd1.mi.comcast.net. [68.61.232.219]) by smtp.gmail.com with ESMTPSA id k15sm6641577qke.75.2020.11.09.11.39.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 11:39:54 -0800 (PST) Sender: Chuck Lever Received: from manet.1015granger.net (manet.1015granger.net [192.168.1.51]) by gateway.1015granger.net (8.14.7/8.14.7) with ESMTP id 0A9JdrF3021813; Mon, 9 Nov 2020 19:39:53 GMT Subject: [PATCH v1 08/13] xprtrdma: Clean up xprtrdma callback tracepoints From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org Date: Mon, 09 Nov 2020 14:39:53 -0500 Message-ID: <160495079296.2072548.17967993282277745679.stgit@manet.1015granger.net> In-Reply-To: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> References: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> User-Agent: StGit/0.23-29-ga622f1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org - Replace displayed kernel memory addresses - Tie the XID and event with the peer's IP address Signed-off-by: Chuck Lever --- include/trace/events/rpcrdma.h | 31 ++++++++++++++++--------------- net/sunrpc/xprtrdma/backchannel.c | 6 +++--- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/include/trace/events/rpcrdma.h b/include/trace/events/rpcrdma.h index c28bf17e769b..6bdbe1165270 100644 --- a/include/trace/events/rpcrdma.h +++ b/include/trace/events/rpcrdma.h @@ -313,38 +313,39 @@ DECLARE_EVENT_CLASS(xprtrdma_mr, ), \ TP_ARGS(mr)) -DECLARE_EVENT_CLASS(xprtrdma_cb_event, +DECLARE_EVENT_CLASS(xprtrdma_callback_class, TP_PROTO( + const struct rpcrdma_xprt *r_xprt, const struct rpc_rqst *rqst ), - TP_ARGS(rqst), + TP_ARGS(r_xprt, rqst), TP_STRUCT__entry( - __field(const void *, rqst) - __field(const void *, rep) - __field(const void *, req) __field(u32, xid) + __string(addr, rpcrdma_addrstr(r_xprt)) + __string(port, rpcrdma_portstr(r_xprt)) ), TP_fast_assign( - __entry->rqst = rqst; - __entry->req = rpcr_to_rdmar(rqst); - __entry->rep = rpcr_to_rdmar(rqst)->rl_reply; __entry->xid = be32_to_cpu(rqst->rq_xid); + __assign_str(addr, rpcrdma_addrstr(r_xprt)); + __assign_str(port, rpcrdma_portstr(r_xprt)); ), - TP_printk("xid=0x%08x, rqst=%p req=%p rep=%p", - __entry->xid, __entry->rqst, __entry->req, __entry->rep + TP_printk("peer=[%s]:%s xid=0x%08x", + __get_str(addr), __get_str(port), __entry->xid ) ); -#define DEFINE_CB_EVENT(name) \ - DEFINE_EVENT(xprtrdma_cb_event, name, \ +#define DEFINE_CALLBACK_EVENT(name) \ + DEFINE_EVENT(xprtrdma_callback_class, \ + xprtrdma_cb_##name, \ TP_PROTO( \ + const struct rpcrdma_xprt *r_xprt, \ const struct rpc_rqst *rqst \ ), \ - TP_ARGS(rqst)) + TP_ARGS(r_xprt, rqst)) /** ** Connection events @@ -1177,8 +1178,8 @@ TRACE_EVENT(xprtrdma_cb_setup, ) ); -DEFINE_CB_EVENT(xprtrdma_cb_call); -DEFINE_CB_EVENT(xprtrdma_cb_reply); +DEFINE_CALLBACK_EVENT(call); +DEFINE_CALLBACK_EVENT(reply); /** ** Server-side RPC/RDMA events diff --git a/net/sunrpc/xprtrdma/backchannel.c b/net/sunrpc/xprtrdma/backchannel.c index c92c1aac270a..946edf2db646 100644 --- a/net/sunrpc/xprtrdma/backchannel.c +++ b/net/sunrpc/xprtrdma/backchannel.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (c) 2015 Oracle. All rights reserved. + * Copyright (c) 2015-2020, Oracle and/or its affiliates. * * Support for backward direction RPCs on RPC/RDMA. */ @@ -82,7 +82,7 @@ static int rpcrdma_bc_marshal_reply(struct rpc_rqst *rqst) &rqst->rq_snd_buf, rpcrdma_noch_pullup)) return -EIO; - trace_xprtrdma_cb_reply(rqst); + trace_xprtrdma_cb_reply(r_xprt, rqst); return 0; } @@ -260,7 +260,7 @@ void rpcrdma_bc_receive_call(struct rpcrdma_xprt *r_xprt, */ req = rpcr_to_rdmar(rqst); req->rl_reply = rep; - trace_xprtrdma_cb_call(rqst); + trace_xprtrdma_cb_call(r_xprt, rqst); /* Queue rqst for ULP's callback service */ bc_serv = xprt->bc_serv; From patchwork Mon Nov 9 19:39:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever III X-Patchwork-Id: 11892403 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C2EF516C1 for ; Mon, 9 Nov 2020 19:40:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9B6F7206A1 for ; Mon, 9 Nov 2020 19:40:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eJdb2yeK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730619AbgKITkC (ORCPT ); Mon, 9 Nov 2020 14:40:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729697AbgKITkC (ORCPT ); Mon, 9 Nov 2020 14:40:02 -0500 Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C823C0613CF; Mon, 9 Nov 2020 11:40:01 -0800 (PST) Received: by mail-qk1-x744.google.com with SMTP id b18so9103913qkc.9; Mon, 09 Nov 2020 11:40:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=s7U1FxZ+z7GUy8ieTH2Y2E7zdKp7EwHjHeiJIQb/jhU=; b=eJdb2yeKeclQtKcJY5NcSXhQyxo22YdH0/0uHVlw3xqQPM5PnA1gVW7yjZELF1GKiH lp6GK7K4/gypm5w50L9AXMevJLYPNAAGVi2bMXMzZXZPTM2EzOMmFMiUgrn47h5XTNJt 0z35HYZVT2ldanNuvRCHj7yo08uAI39bEThbyq16zrRM5K6T73U5TMKFt15w9Izizes0 aOhnMKkOC/s8GTOUEp5817+zgBrjTdBDqkUhQ1vo2DUQdybRNSK33rqX0NcRhtZwCVkl DgIqe77fOJnyq7ZpcHa9ePR10pDvuiOI7Sb/puT4n8n/6d5IZF6E2vrb43l2tsZjOmfS 0eyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=s7U1FxZ+z7GUy8ieTH2Y2E7zdKp7EwHjHeiJIQb/jhU=; b=Ui8lirRgvl1MRvISljR5B90BHZVNVN3OC0p58YTasDPGXxmYXRonEXmsi071D+54L3 MURSVfRQsh9AE67vcLkzIhhNBTHiVM1p2mFUVC00ezjR4q8RPmRp1tG8iotmDXfAvKLd 7f1OZFN2Q/Qa6oamyevOJMECGawnJzQbqi+aEBB2NQ9LVs0+6d1ISNHikW4vZlh527WX mz6gDDYFu+QPb08QAFuUPjbi6uSuo8RVtJaczMg0OCl60iM2td240Acd9I6E5LRb+wFd 8dVrAwrEdsosbrfRRVTYF2y95OT1mVMEJak8r9oe+mLjqBOjrtECVhgsr+c1h8k0N6cz wO+A== X-Gm-Message-State: AOAM531sm3hnP+wdbrOBuCqsstt/oskWZC9CVf8OY8/cvTTPzCV0kyqT WbaQQ8ysryDvV1bTvdz/HEj3ahUzgAw= X-Google-Smtp-Source: ABdhPJwSnxSyiukYSMHjvyn2mq2GN46jHZA/vInNsLVQsT1F+/+HOYr0ZVyG08GB8tDzo8uIexS4EQ== X-Received: by 2002:a37:5904:: with SMTP id n4mr15378604qkb.364.1604950800010; Mon, 09 Nov 2020 11:40:00 -0800 (PST) Received: from gateway.1015granger.net (c-68-61-232-219.hsd1.mi.comcast.net. [68.61.232.219]) by smtp.gmail.com with ESMTPSA id j124sm4495647qkf.113.2020.11.09.11.39.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 11:39:59 -0800 (PST) Sender: Chuck Lever Received: from manet.1015granger.net (manet.1015granger.net [192.168.1.51]) by gateway.1015granger.net (8.14.7/8.14.7) with ESMTP id 0A9Jdwjk021816; Mon, 9 Nov 2020 19:39:58 GMT Subject: [PATCH v1 09/13] xprtrdma: Clean up trace_xprtrdma_nomrs() From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org Date: Mon, 09 Nov 2020 14:39:58 -0500 Message-ID: <160495079830.2072548.3366377773172889012.stgit@manet.1015granger.net> In-Reply-To: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> References: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> User-Agent: StGit/0.23-29-ga622f1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org - Rename it following the "_err" suffix convention - Replace display of kernel memory addresses - Tie MR exhaustion to a peer IP address, similar to the createmrs tracepoint Signed-off-by: Chuck Lever --- include/trace/events/rpcrdma.h | 19 ++++++++++--------- net/sunrpc/xprtrdma/rpc_rdma.c | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/include/trace/events/rpcrdma.h b/include/trace/events/rpcrdma.h index 6bdbe1165270..4fcda2a25bb8 100644 --- a/include/trace/events/rpcrdma.h +++ b/include/trace/events/rpcrdma.h @@ -545,32 +545,33 @@ TRACE_EVENT(xprtrdma_mr_get, ) ); -TRACE_EVENT(xprtrdma_nomrs, +TRACE_EVENT(xprtrdma_nomrs_err, TP_PROTO( + const struct rpcrdma_xprt *r_xprt, const struct rpcrdma_req *req ), - TP_ARGS(req), + TP_ARGS(r_xprt, req), TP_STRUCT__entry( - __field(const void *, req) __field(unsigned int, task_id) __field(unsigned int, client_id) - __field(u32, xid) + __string(addr, rpcrdma_addrstr(r_xprt)) + __string(port, rpcrdma_portstr(r_xprt)) ), TP_fast_assign( const struct rpc_rqst *rqst = &req->rl_slot; - __entry->req = req; __entry->task_id = rqst->rq_task->tk_pid; __entry->client_id = rqst->rq_task->tk_client->cl_clid; - __entry->xid = be32_to_cpu(rqst->rq_xid); + __assign_str(addr, rpcrdma_addrstr(r_xprt)); + __assign_str(port, rpcrdma_portstr(r_xprt)); ), - TP_printk("task:%u@%u xid=0x%08x req=%p", - __entry->task_id, __entry->client_id, __entry->xid, - __entry->req + TP_printk("peer=[%s]:%s task:%u@%u", + __get_str(addr), __get_str(port), + __entry->task_id, __entry->client_id ) ); diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c index 8078559bdc31..f27eb2322b38 100644 --- a/net/sunrpc/xprtrdma/rpc_rdma.c +++ b/net/sunrpc/xprtrdma/rpc_rdma.c @@ -323,7 +323,7 @@ static struct rpcrdma_mr_seg *rpcrdma_mr_prepare(struct rpcrdma_xprt *r_xprt, return frwr_map(r_xprt, seg, nsegs, writing, req->rl_slot.rq_xid, *mr); out_getmr_err: - trace_xprtrdma_nomrs(req); + trace_xprtrdma_nomrs_err(r_xprt, req); xprt_wait_for_buffer_space(&r_xprt->rx_xprt); rpcrdma_mrs_refresh(r_xprt); return ERR_PTR(-EAGAIN); From patchwork Mon Nov 9 19:40:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever III X-Patchwork-Id: 11892407 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D6AA716C1 for ; Mon, 9 Nov 2020 19:40:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE5DF206A1 for ; Mon, 9 Nov 2020 19:40:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="O2bONco5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729954AbgKITkG (ORCPT ); Mon, 9 Nov 2020 14:40:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729697AbgKITkG (ORCPT ); Mon, 9 Nov 2020 14:40:06 -0500 Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5226FC0613CF; Mon, 9 Nov 2020 11:40:06 -0800 (PST) Received: by mail-qt1-x842.google.com with SMTP id 7so2492112qtp.1; Mon, 09 Nov 2020 11:40:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=M6OCYaplLhRt+tkj12rTkc6fuXvyButQ/GFIVrJOJn8=; b=O2bONco5+k/3hAIpIIEOb+KJxRwQOH6RVsV9uA19AFiKZW0TRiixR2+XusHHfZlQk4 0dXOvIDznWfJzM0jCZZE4/GVDwr3NovpwFA3IrJcoobGrHNJ08dcVk0zmq1oG50fz/8m 4PzPspixrPaHa9ZzrOsbK0uLZW554f0iijiTSA9NBhMW/3pDCpIeQrIKXe6Hq7htYRyB FatpW/YS7YGv8blzXUWq/GaD4Wgn7j4WqghGW4DM8nTCz4wtiZuKXUKXBRKdIlJfh2FJ lKbJnHBJmzL/D+hDCR+3HFeAHNDpLEH5hS0fKkhr0pIpqedULp3n43EwyPoipUoFUQq6 U9mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=M6OCYaplLhRt+tkj12rTkc6fuXvyButQ/GFIVrJOJn8=; b=Jfo63sb57QvKBfF20n1Es9PV1rsluK73tdq+YZQc+daCLxWUXFXdmTn9jvbHTR6nl2 E1WeU5110OW6XiC8A9GIv+3tq0T9CECCyHr6jiSWW12qpaPsHKE8GHuNAg4bbe58lreC Fbk4m79VQQPufztX+QWk/phvAC+EEmYJVmbijWsyRAu13PG3wQwd9rPDWTGX3n7u+v8a n83OgNIOTc0F9JdFVg0MVJL0tMOlHrPiiuEy9Z11iUCGn6X6K3noiTAidK0zoGm+QhBZ pa/H6ipKI0dAiUi5BmucalqbEhYCZVv02DJZ/EgkDh3NH31lmirjP5Cs5Lj5YFzuR/7J lKCQ== X-Gm-Message-State: AOAM533WhjyKqU4YPgFsnPtFuu7MdE9IqRNP9V0Z95pYd2gmeLs7TbiR obdTYFiIbmIW6WERO2Rv7x0+gqbpwhA= X-Google-Smtp-Source: ABdhPJzelT+4d7krXWXLSsO5wFjhJtZqHmlwJQd7t2x6aLkrIx21PIEoFu80YcO5Pcednv4FyT/X7A== X-Received: by 2002:aed:3b7b:: with SMTP id q56mr15342251qte.377.1604950805210; Mon, 09 Nov 2020 11:40:05 -0800 (PST) Received: from gateway.1015granger.net (c-68-61-232-219.hsd1.mi.comcast.net. [68.61.232.219]) by smtp.gmail.com with ESMTPSA id 8sm7067107qkb.98.2020.11.09.11.40.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 11:40:04 -0800 (PST) Sender: Chuck Lever Received: from manet.1015granger.net (manet.1015granger.net [192.168.1.51]) by gateway.1015granger.net (8.14.7/8.14.7) with ESMTP id 0A9Je3p2021829; Mon, 9 Nov 2020 19:40:03 GMT Subject: [PATCH v1 10/13] xprtrdma: Display the task ID when reporting MR events From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org Date: Mon, 09 Nov 2020 14:40:03 -0500 Message-ID: <160495080365.2072548.15440792549170057984.stgit@manet.1015granger.net> In-Reply-To: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> References: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> User-Agent: StGit/0.23-29-ga622f1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Tie each MR event to the requesting rpc_task to make it easier to follow MR ownership and control flow. MR unmapping and recycling can happen in the background, after an MR's mr_req field is stale, so set up a separate tracepoint class for those events. Signed-off-by: Chuck Lever --- include/trace/events/rpcrdma.h | 96 ++++++++++++++++++++++++---------------- net/sunrpc/xprtrdma/frwr_ops.c | 1 net/sunrpc/xprtrdma/rpc_rdma.c | 1 3 files changed, 58 insertions(+), 40 deletions(-) diff --git a/include/trace/events/rpcrdma.h b/include/trace/events/rpcrdma.h index 4fcda2a25bb8..166bbeef996c 100644 --- a/include/trace/events/rpcrdma.h +++ b/include/trace/events/rpcrdma.h @@ -274,7 +274,55 @@ TRACE_DEFINE_ENUM(DMA_NONE); { DMA_FROM_DEVICE, "FROM_DEVICE" }, \ { DMA_NONE, "NONE" }) -DECLARE_EVENT_CLASS(xprtrdma_mr, +DECLARE_EVENT_CLASS(xprtrdma_mr_class, + TP_PROTO( + const struct rpcrdma_mr *mr + ), + + TP_ARGS(mr), + + TP_STRUCT__entry( + __field(unsigned int, task_id) + __field(unsigned int, client_id) + __field(u32, mr_id) + __field(int, nents) + __field(u32, handle) + __field(u32, length) + __field(u64, offset) + __field(u32, dir) + ), + + TP_fast_assign( + const struct rpcrdma_req *req = mr->mr_req; + const struct rpc_task *task = req->rl_slot.rq_task; + + __entry->task_id = task->tk_pid; + __entry->client_id = task->tk_client->cl_clid; + __entry->mr_id = mr->frwr.fr_mr->res.id; + __entry->nents = mr->mr_nents; + __entry->handle = mr->mr_handle; + __entry->length = mr->mr_length; + __entry->offset = mr->mr_offset; + __entry->dir = mr->mr_dir; + ), + + TP_printk("task:%u@%u mr.id=%u nents=%d %u@0x%016llx:0x%08x (%s)", + __entry->task_id, __entry->client_id, + __entry->mr_id, __entry->nents, __entry->length, + (unsigned long long)__entry->offset, __entry->handle, + xprtrdma_show_direction(__entry->dir) + ) +); + +#define DEFINE_MR_EVENT(name) \ + DEFINE_EVENT(xprtrdma_mr_class, \ + xprtrdma_mr_##name, \ + TP_PROTO( \ + const struct rpcrdma_mr *mr \ + ), \ + TP_ARGS(mr)) + +DECLARE_EVENT_CLASS(xprtrdma_anonymous_mr_class, TP_PROTO( const struct rpcrdma_mr *mr ), @@ -306,11 +354,12 @@ DECLARE_EVENT_CLASS(xprtrdma_mr, ) ); -#define DEFINE_MR_EVENT(name) \ - DEFINE_EVENT(xprtrdma_mr, xprtrdma_mr_##name, \ - TP_PROTO( \ - const struct rpcrdma_mr *mr \ - ), \ +#define DEFINE_ANON_MR_EVENT(name) \ + DEFINE_EVENT(xprtrdma_anonymous_mr_class, \ + xprtrdma_mr_##name, \ + TP_PROTO( \ + const struct rpcrdma_mr *mr \ + ), \ TP_ARGS(mr)) DECLARE_EVENT_CLASS(xprtrdma_callback_class, @@ -516,35 +565,6 @@ TRACE_EVENT(xprtrdma_createmrs, ) ); -TRACE_EVENT(xprtrdma_mr_get, - TP_PROTO( - const struct rpcrdma_req *req - ), - - TP_ARGS(req), - - TP_STRUCT__entry( - __field(const void *, req) - __field(unsigned int, task_id) - __field(unsigned int, client_id) - __field(u32, xid) - ), - - TP_fast_assign( - const struct rpc_rqst *rqst = &req->rl_slot; - - __entry->req = req; - __entry->task_id = rqst->rq_task->tk_pid; - __entry->client_id = rqst->rq_task->tk_client->cl_clid; - __entry->xid = be32_to_cpu(rqst->rq_xid); - ), - - TP_printk("task:%u@%u xid=0x%08x req=%p", - __entry->task_id, __entry->client_id, __entry->xid, - __entry->req - ) -); - TRACE_EVENT(xprtrdma_nomrs_err, TP_PROTO( const struct rpcrdma_xprt *r_xprt, @@ -946,9 +966,9 @@ TRACE_EVENT(xprtrdma_frwr_maperr, DEFINE_MR_EVENT(localinv); DEFINE_MR_EVENT(map); -DEFINE_MR_EVENT(unmap); -DEFINE_MR_EVENT(reminv); -DEFINE_MR_EVENT(recycle); + +DEFINE_ANON_MR_EVENT(unmap); +DEFINE_ANON_MR_EVENT(recycle); TRACE_EVENT(xprtrdma_dma_maperr, TP_PROTO( diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c index 76322b1acf3d..cb2f92409c2f 100644 --- a/net/sunrpc/xprtrdma/frwr_ops.c +++ b/net/sunrpc/xprtrdma/frwr_ops.c @@ -431,7 +431,6 @@ void frwr_reminv(struct rpcrdma_rep *rep, struct list_head *mrs) list_for_each_entry(mr, mrs, mr_list) if (mr->mr_handle == rep->rr_inv_rkey) { list_del_init(&mr->mr_list); - trace_xprtrdma_mr_reminv(mr); rpcrdma_mr_put(mr); break; /* only one invalidated MR per RPC */ } diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c index f27eb2322b38..9ed89872ec75 100644 --- a/net/sunrpc/xprtrdma/rpc_rdma.c +++ b/net/sunrpc/xprtrdma/rpc_rdma.c @@ -315,7 +315,6 @@ static struct rpcrdma_mr_seg *rpcrdma_mr_prepare(struct rpcrdma_xprt *r_xprt, *mr = rpcrdma_mr_get(r_xprt); if (!*mr) goto out_getmr_err; - trace_xprtrdma_mr_get(req); (*mr)->mr_req = req; } From patchwork Mon Nov 9 19:40:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever III X-Patchwork-Id: 11892411 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A6A2D16C1 for ; Mon, 9 Nov 2020 19:40:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 80A00206A1 for ; Mon, 9 Nov 2020 19:40:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tkvpJ78P" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730722AbgKITkN (ORCPT ); Mon, 9 Nov 2020 14:40:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729697AbgKITkN (ORCPT ); Mon, 9 Nov 2020 14:40:13 -0500 Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DBA2C0613CF; Mon, 9 Nov 2020 11:40:12 -0800 (PST) Received: by mail-qt1-x842.google.com with SMTP id 7so2492375qtp.1; Mon, 09 Nov 2020 11:40:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=/1dcw057r2tJOx2Fks3SvWO0kO71vtvTy0GCH8i0dXw=; b=tkvpJ78POSsgDvYAc1NOG2Bi6cqpx0vkQBXU9dmrxsahDFsYvtnSLEojAT1jjQNsBA wfr9amsoifDenjBbxd6K0ullhC4mfGV4q9Rn4s8GkOQHSKtJ4G5kCUm1t+VX2FjsaYkK AdKY+w7lu3Mm36u3sYTFDW0vCA8s4ezjpTCb/mjMg+HvbWAlM08SIYLrwnBnaytizSH0 xNIKDig0Au0ACq8P5z0jARY9dNZQq8yliyYMxQsk0OCDWTIPI0vIXYieH4D/iiwVq6s9 e5gMy2O6AT07ivYUb4cx/PV5oQi2xlg9ax/khbvZDYkHobrM+xYQR26yDgRtQxHl53hH 3Xeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=/1dcw057r2tJOx2Fks3SvWO0kO71vtvTy0GCH8i0dXw=; b=PSiv7FhsUBSFYwUyaSQ2RgOGrA0dfOyq+7cHi3KFVKDwkzVJs0eZO6ac3hFW5Xb5n+ KR3k7elELnJCEIwLGGj2IQXMZ/VuxzjaHYw+ywRqElPG/t1YsAcKdAcMB+AE0ubo/Tbt iLkXFzxJBBdl25GNERVjZE0HWFODEan0ayXOcBqco+KxUu8wAwnorP4TGCp99rM0+zeK Szc3V+wzuqwPhGE+RC3mgOtMj+/CpUl0ZVkFENYoyZzZQFGnAmUoEDYpzow6wvPg5tl/ XS1t555n+W1UJ3gIXbMcck1p7NlIph2/jI6n6nNpI+6pCyMhMI2TM5sIAiwF3WfV5O94 P/Qw== X-Gm-Message-State: AOAM531iofuzceJbktoxT6uuMMLkBxdxTCrizyuprtVPifTQl9Gh8Tgo NqA0Eqn/wIdb6KPLVq0C+7nKCBULFI4= X-Google-Smtp-Source: ABdhPJxJJlpn/yPKSnKaEOOBDahYunN2T24N4GnmpHlkAGUiRXzvPN3/3Yrnaog2O/1s8jDhCYwr8A== X-Received: by 2002:ac8:5c50:: with SMTP id j16mr6457555qtj.306.1604950810984; Mon, 09 Nov 2020 11:40:10 -0800 (PST) Received: from gateway.1015granger.net (c-68-61-232-219.hsd1.mi.comcast.net. [68.61.232.219]) by smtp.gmail.com with ESMTPSA id f61sm6333372qtb.75.2020.11.09.11.40.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 11:40:10 -0800 (PST) Sender: Chuck Lever Received: from manet.1015granger.net (manet.1015granger.net [192.168.1.51]) by gateway.1015granger.net (8.14.7/8.14.7) with ESMTP id 0A9Je8uG021832; Mon, 9 Nov 2020 19:40:08 GMT Subject: [PATCH v1 11/13] xprtrdma: Trace unmap_sync calls From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org Date: Mon, 09 Nov 2020 14:40:08 -0500 Message-ID: <160495080890.2072548.7029643130998432677.stgit@manet.1015granger.net> In-Reply-To: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> References: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> User-Agent: StGit/0.23-29-ga622f1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org ->buf_free is called nearly once per RPC. Only rarely does xprt_rdma_free() have to do anything, thus tracing every one of these calls seems unnecessary. Instead, just throw a trace event when that one occasional RPC still has MRs that need to be released. xprt_rdma_free() is further micro-optimized to reduce the amount of work done in the common case. Signed-off-by: Chuck Lever --- include/trace/events/rpcrdma.h | 22 ++++++++++++++++++++++ net/sunrpc/xprtrdma/transport.c | 7 ++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/include/trace/events/rpcrdma.h b/include/trace/events/rpcrdma.h index 166bbeef996c..69e1caf7e882 100644 --- a/include/trace/events/rpcrdma.h +++ b/include/trace/events/rpcrdma.h @@ -1167,6 +1167,28 @@ TRACE_EVENT(xprtrdma_decode_seg, ) ); +TRACE_EVENT(xprtrdma_mrs_zap, + TP_PROTO( + const struct rpc_task *task + ), + + TP_ARGS(task), + + TP_STRUCT__entry( + __field(unsigned int, task_id) + __field(unsigned int, client_id) + ), + + TP_fast_assign( + __entry->task_id = task->tk_pid; + __entry->client_id = task->tk_client->cl_clid; + ), + + TP_printk("task:%u@%u", + __entry->task_id, __entry->client_id + ) +); + /** ** Callback events **/ diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c index 8915e42240d3..bb3ed3db6c0a 100644 --- a/net/sunrpc/xprtrdma/transport.c +++ b/net/sunrpc/xprtrdma/transport.c @@ -599,11 +599,12 @@ static void xprt_rdma_free(struct rpc_task *task) { struct rpc_rqst *rqst = task->tk_rqstp; - struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(rqst->rq_xprt); struct rpcrdma_req *req = rpcr_to_rdmar(rqst); - if (!list_empty(&req->rl_registered)) - frwr_unmap_sync(r_xprt, req); + if (unlikely(!list_empty(&req->rl_registered))) { + trace_xprtrdma_mrs_zap(task); + frwr_unmap_sync(rpcx_to_rdmax(rqst->rq_xprt), req); + } /* XXX: If the RPC is completing because of a signal and * not because a reply was received, we ought to ensure From patchwork Mon Nov 9 19:40:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever III X-Patchwork-Id: 11892415 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5865816C1 for ; Mon, 9 Nov 2020 19:40:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 315ED206A1 for ; Mon, 9 Nov 2020 19:40:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ux0ivgNP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729697AbgKITkT (ORCPT ); Mon, 9 Nov 2020 14:40:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729499AbgKITkT (ORCPT ); Mon, 9 Nov 2020 14:40:19 -0500 Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78815C0613CF; Mon, 9 Nov 2020 11:40:17 -0800 (PST) Received: by mail-qt1-x842.google.com with SMTP id g15so3149160qtq.13; Mon, 09 Nov 2020 11:40:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=DHosaL+Sb7Y6JLGNhniF+42tH/ap+5Vpv6yh3Hr18Ao=; b=Ux0ivgNPHixR1GTpJcwhYreYuK0wa7mg67fSFDsw41K8xObWukFvjyNWq6PbmY9PmS z8+90T9oD9PM5ClV+QRJcwXz/P37wKgq/4XbFqMJPg5BRhTlDo9y3LYLe9HBHMv6kWV5 UK6+/PS2nXAukYC5KVFlbw9VhJYxwXfBT2Hlo17Ac9JFOmYVGkbbNl6PWIVa92Jduq/C fzh5lKEp0iWziXmLM8H+jc0u0MyzXqPv7ih37Xk845yGSDzqgMlxdzGA5H9SvuNI+Jxu G5xMGMsnuCgBYW3hFFToz9cyiKbILrrh5/+Ynu2nN4VRzmbYjVu8lf03Ale8LUD/aqxR s9oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=DHosaL+Sb7Y6JLGNhniF+42tH/ap+5Vpv6yh3Hr18Ao=; b=RvhQYESTvEfw113SVcuT5wLgGPNw4sRlUI5ufylX7jvSnAq6l4u98cdF1mhdHy76S8 gvYk2z3he4eqVUxAeCUAkltwNn+YjGLo9/y4xsUlLKaHH0rqtXP0rlRCaOYGjdZNmF09 iYrtEr+48qDEkcoEIZLXeswVSm4M0FFAVoVYUFmtA2umj07M89MwshlvAVZ6fcKVcOWI c94xPsLtbpXZ2fngZ+EGzyTKcGc4/j3YvPjWWT6wwhkHpt+M7VoFdxC8Xyoajss7e/Qe Ppnw78Gp8u/fgMVKpv/RC79rdNMZjjiFwCpK8hShpthc4d16umuSti1WrfoT0Vk87dyb k6mA== X-Gm-Message-State: AOAM533/WklBgbsoJlLSfAsAm+NaCui3FE9y/Ks2zd3KVmhtSFRXU4EA CoOSH8a8JnvHCiOGYQ1ye0F7ZYwJTAM= X-Google-Smtp-Source: ABdhPJyPOkq+Mw/Dgx75znVt9HFVVR2ETvhoLFtahLFGWcgswi/yu6PFXqeYJupoPc0KhP+dnv4qTA== X-Received: by 2002:a05:622a:18d:: with SMTP id s13mr14389134qtw.151.1604950816334; Mon, 09 Nov 2020 11:40:16 -0800 (PST) Received: from gateway.1015granger.net (c-68-61-232-219.hsd1.mi.comcast.net. [68.61.232.219]) by smtp.gmail.com with ESMTPSA id y14sm5070643qkj.56.2020.11.09.11.40.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 11:40:15 -0800 (PST) Sender: Chuck Lever Received: from manet.1015granger.net (manet.1015granger.net [192.168.1.51]) by gateway.1015granger.net (8.14.7/8.14.7) with ESMTP id 0A9JeEbW021835; Mon, 9 Nov 2020 19:40:14 GMT Subject: [PATCH v1 12/13] xprtrdma: Move rpcrdma_mr_put() From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org Date: Mon, 09 Nov 2020 14:40:14 -0500 Message-ID: <160495081430.2072548.9094524166781301258.stgit@manet.1015granger.net> In-Reply-To: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> References: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> User-Agent: StGit/0.23-29-ga622f1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Clean up: This function is now invoked only in frwr_ops.c. The move enables deduplication of the trace_xprtrdma_mr_unmap() call site. Signed-off-by: Chuck Lever --- net/sunrpc/xprtrdma/frwr_ops.c | 41 +++++++++++++++++++++++++++------------ net/sunrpc/xprtrdma/verbs.c | 19 ------------------ net/sunrpc/xprtrdma/xprt_rdma.h | 1 - 3 files changed, 28 insertions(+), 33 deletions(-) diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c index cb2f92409c2f..e93b3457b958 100644 --- a/net/sunrpc/xprtrdma/frwr_ops.c +++ b/net/sunrpc/xprtrdma/frwr_ops.c @@ -65,18 +65,23 @@ void frwr_release_mr(struct rpcrdma_mr *mr) kfree(mr); } -static void frwr_mr_recycle(struct rpcrdma_mr *mr) +static void frwr_mr_unmap(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr *mr) { - struct rpcrdma_xprt *r_xprt = mr->mr_xprt; - - trace_xprtrdma_mr_recycle(mr); - if (mr->mr_dir != DMA_NONE) { trace_xprtrdma_mr_unmap(mr); ib_dma_unmap_sg(r_xprt->rx_ep->re_id->device, mr->mr_sg, mr->mr_nents, mr->mr_dir); mr->mr_dir = DMA_NONE; } +} + +static void frwr_mr_recycle(struct rpcrdma_mr *mr) +{ + struct rpcrdma_xprt *r_xprt = mr->mr_xprt; + + trace_xprtrdma_mr_recycle(mr); + + frwr_mr_unmap(r_xprt, mr); spin_lock(&r_xprt->rx_buf.rb_lock); list_del(&mr->mr_all); @@ -86,6 +91,16 @@ static void frwr_mr_recycle(struct rpcrdma_mr *mr) frwr_release_mr(mr); } +static void frwr_mr_put(struct rpcrdma_mr *mr) +{ + frwr_mr_unmap(mr->mr_xprt, mr); + + /* The MR is returned to the req's MR free list instead + * of to the xprt's MR free list. No spinlock is needed. + */ + rpcrdma_mr_push(mr, &mr->mr_req->rl_free_mrs); +} + /* frwr_reset - Place MRs back on the free list * @req: request to reset * @@ -101,7 +116,7 @@ void frwr_reset(struct rpcrdma_req *req) struct rpcrdma_mr *mr; while ((mr = rpcrdma_mr_pop(&req->rl_registered))) - rpcrdma_mr_put(mr); + frwr_mr_put(mr); } /** @@ -431,17 +446,17 @@ void frwr_reminv(struct rpcrdma_rep *rep, struct list_head *mrs) list_for_each_entry(mr, mrs, mr_list) if (mr->mr_handle == rep->rr_inv_rkey) { list_del_init(&mr->mr_list); - rpcrdma_mr_put(mr); + frwr_mr_put(mr); break; /* only one invalidated MR per RPC */ } } -static void __frwr_release_mr(struct ib_wc *wc, struct rpcrdma_mr *mr) +static void frwr_mr_done(struct ib_wc *wc, struct rpcrdma_mr *mr) { if (wc->status != IB_WC_SUCCESS) frwr_mr_recycle(mr); else - rpcrdma_mr_put(mr); + frwr_mr_put(mr); } /** @@ -459,7 +474,7 @@ static void frwr_wc_localinv(struct ib_cq *cq, struct ib_wc *wc) /* WARNING: Only wr_cqe and status are reliable at this point */ trace_xprtrdma_wc_li(wc, &frwr->fr_cid); - __frwr_release_mr(wc, mr); + frwr_mr_done(wc, mr); rpcrdma_flush_disconnect(cq->cq_context, wc); } @@ -480,7 +495,7 @@ static void frwr_wc_localinv_wake(struct ib_cq *cq, struct ib_wc *wc) /* WARNING: Only wr_cqe and status are reliable at this point */ trace_xprtrdma_wc_li_wake(wc, &frwr->fr_cid); - __frwr_release_mr(wc, mr); + frwr_mr_done(wc, mr); complete(&frwr->fr_linv_done); rpcrdma_flush_disconnect(cq->cq_context, wc); @@ -587,9 +602,9 @@ static void frwr_wc_localinv_done(struct ib_cq *cq, struct ib_wc *wc) /* WARNING: Only wr_cqe and status are reliable at this point */ trace_xprtrdma_wc_li_done(wc, &frwr->fr_cid); - __frwr_release_mr(wc, mr); + frwr_mr_done(wc, mr); - /* Ensure @rep is generated before __frwr_release_mr */ + /* Ensure @rep is generated before frwr_mr_done */ smp_rmb(); rpcrdma_complete_rqst(rep); diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index 63837b5d14e5..ec912cf9c618 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -1184,25 +1184,6 @@ rpcrdma_mr_get(struct rpcrdma_xprt *r_xprt) return mr; } -/** - * rpcrdma_mr_put - DMA unmap an MR and release it - * @mr: MR to release - * - */ -void rpcrdma_mr_put(struct rpcrdma_mr *mr) -{ - struct rpcrdma_xprt *r_xprt = mr->mr_xprt; - - if (mr->mr_dir != DMA_NONE) { - trace_xprtrdma_mr_unmap(mr); - ib_dma_unmap_sg(r_xprt->rx_ep->re_id->device, - mr->mr_sg, mr->mr_nents, mr->mr_dir); - mr->mr_dir = DMA_NONE; - } - - rpcrdma_mr_push(mr, &mr->mr_req->rl_free_mrs); -} - /** * rpcrdma_buffer_get - Get a request buffer * @buffers: Buffer pool from which to obtain a buffer diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h index cef9d0f2e2c8..6a45bf241ec0 100644 --- a/net/sunrpc/xprtrdma/xprt_rdma.h +++ b/net/sunrpc/xprtrdma/xprt_rdma.h @@ -473,7 +473,6 @@ void rpcrdma_buffer_destroy(struct rpcrdma_buffer *); struct rpcrdma_sendctx *rpcrdma_sendctx_get_locked(struct rpcrdma_xprt *r_xprt); struct rpcrdma_mr *rpcrdma_mr_get(struct rpcrdma_xprt *r_xprt); -void rpcrdma_mr_put(struct rpcrdma_mr *mr); void rpcrdma_mrs_refresh(struct rpcrdma_xprt *r_xprt); struct rpcrdma_req *rpcrdma_buffer_get(struct rpcrdma_buffer *); From patchwork Mon Nov 9 19:40:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever III X-Patchwork-Id: 11892419 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7AE4B921 for ; Mon, 9 Nov 2020 19:40:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 55921206E3 for ; Mon, 9 Nov 2020 19:40:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HCB66DsW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729499AbgKITkY (ORCPT ); Mon, 9 Nov 2020 14:40:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729987AbgKITkY (ORCPT ); Mon, 9 Nov 2020 14:40:24 -0500 Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BD3DC0613CF; Mon, 9 Nov 2020 11:40:23 -0800 (PST) Received: by mail-qt1-x842.google.com with SMTP id 7so2492910qtp.1; Mon, 09 Nov 2020 11:40:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=tZiyGwrA/U2qRY5Er4ZTvmCWX7cI7UkuFpiSNzAINWs=; b=HCB66DsW7QG7+z3rJgYiLrtMAjfEcptRTiMvhodOL5oUMXar/2XjN7kWsCADp1TW1H +riTEeI1ZHIg8NLTV1GIir/pG/G/WBNINaFlQOYv5FYYmCBrmbMzsOEHs7ipPy24WDUA qkBa0jJvKW0cjRbK/rv5YEn9YxLWfxTKVxXD3MDBO3/6ceEWjDW3Ayfj9KuJmFCadZnq yc2pzMpuAfWZ7YrjUKrmSpVoeStkb2wAI8O7VYk+iSf61Ta/UAgcn8xlLvLFOpdD05fy Bq56Rajl+mqMsQSsX8UYU/SCjXTgvoYUpu/3tzpWLixP6344FEzXU5Mlsan+laXb15kP ofVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=tZiyGwrA/U2qRY5Er4ZTvmCWX7cI7UkuFpiSNzAINWs=; b=IqN8lYI9sd3dSe1itpucK3Lde2+zNeaxySFJN3TZhg7YNINJR8Nfjn9XjRrzEJ3zz1 QQAbnqoyC5It3VmdirJQp6mR6ltra+hwtODFhyYx6c4a4lPZU4WaTx8Zj0HUE/CxtNa5 L3cKyoHcAIcXM8sFe+cJuog3GSmaIevv1R+sLFNyqowR5zWsnS+lRGu9nkTQGcHp7bC3 7bep5kDnpT0Tn/NgqaJFk1Vx/ZUs3c7wJ2D0yFmhFKSOD/ysaw0VqR0DFAEqCtoYb2RX pFdOheMg4OhdwAwyXhukZYWqomc5ZgynJVqX7o0GPTWUS09rZIKxdfzYoZM5a2zOk/B6 3Eww== X-Gm-Message-State: AOAM532xZULUJE7TAWSZ27biRusk/m6vWhutlRUS3Q2AP6NBrUf5f6jZ TTt9mF+f5r9Lc8EBB4syx1A/1N0jTaA= X-Google-Smtp-Source: ABdhPJxXeZdqAvdy03EdymlXrELK7hS8X/M6jknNHsQHsi9xhv8I8VexFtyWMJvxwl5s6aVYm4itRQ== X-Received: by 2002:ac8:5c50:: with SMTP id j16mr6458333qtj.306.1604950822069; Mon, 09 Nov 2020 11:40:22 -0800 (PST) Received: from gateway.1015granger.net (c-68-61-232-219.hsd1.mi.comcast.net. [68.61.232.219]) by smtp.gmail.com with ESMTPSA id y14sm5070796qkj.56.2020.11.09.11.40.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 11:40:20 -0800 (PST) Sender: Chuck Lever Received: from manet.1015granger.net (manet.1015granger.net [192.168.1.51]) by gateway.1015granger.net (8.14.7/8.14.7) with ESMTP id 0A9JeJfm021838; Mon, 9 Nov 2020 19:40:19 GMT Subject: [PATCH v1 13/13] xprtrdma: Micro-optimize MR DMA-unmapping From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org Date: Mon, 09 Nov 2020 14:40:19 -0500 Message-ID: <160495081970.2072548.8942608240215406369.stgit@manet.1015granger.net> In-Reply-To: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> References: <160495073877.2072548.16070760241273615384.stgit@manet.1015granger.net> User-Agent: StGit/0.23-29-ga622f1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Now that rpcrdma_ep is no longer part of rpcrdma_xprt, there are four or five serial address dereferences needed to get to the IB device needed for DMA unmapping. Instead, let's use the same pattern that regbufs use: cache a pointer to the device in the MR, and use that as the indication that unmapping is necessary. This also guarantees that the exact same device is used for DMA mapping and unmapping, even if the r_xprt's ep has been replaced. I don't think this can happen today, but future changes might break this assumption. Signed-off-by: Chuck Lever --- net/sunrpc/xprtrdma/frwr_ops.c | 12 ++++++------ net/sunrpc/xprtrdma/xprt_rdma.h | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c index e93b3457b958..baca49fe83af 100644 --- a/net/sunrpc/xprtrdma/frwr_ops.c +++ b/net/sunrpc/xprtrdma/frwr_ops.c @@ -67,11 +67,11 @@ void frwr_release_mr(struct rpcrdma_mr *mr) static void frwr_mr_unmap(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr *mr) { - if (mr->mr_dir != DMA_NONE) { + if (mr->mr_device) { trace_xprtrdma_mr_unmap(mr); - ib_dma_unmap_sg(r_xprt->rx_ep->re_id->device, - mr->mr_sg, mr->mr_nents, mr->mr_dir); - mr->mr_dir = DMA_NONE; + ib_dma_unmap_sg(mr->mr_device, mr->mr_sg, mr->mr_nents, + mr->mr_dir); + mr->mr_device = NULL; } } @@ -145,7 +145,7 @@ int frwr_mr_init(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr *mr) mr->mr_xprt = r_xprt; mr->frwr.fr_mr = frmr; - mr->mr_dir = DMA_NONE; + mr->mr_device = NULL; INIT_LIST_HEAD(&mr->mr_list); init_completion(&mr->frwr.fr_linv_done); @@ -330,6 +330,7 @@ struct rpcrdma_mr_seg *frwr_map(struct rpcrdma_xprt *r_xprt, mr->mr_dir); if (!dma_nents) goto out_dmamap_err; + mr->mr_device = ep->re_id->device; ibmr = mr->frwr.fr_mr; n = ib_map_mr_sg(ibmr, mr->mr_sg, dma_nents, NULL, PAGE_SIZE); @@ -356,7 +357,6 @@ struct rpcrdma_mr_seg *frwr_map(struct rpcrdma_xprt *r_xprt, return seg; out_dmamap_err: - mr->mr_dir = DMA_NONE; trace_xprtrdma_frwr_sgerr(mr, i); return ERR_PTR(-EIO); diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h index 6a45bf241ec0..94b28657aeeb 100644 --- a/net/sunrpc/xprtrdma/xprt_rdma.h +++ b/net/sunrpc/xprtrdma/xprt_rdma.h @@ -243,6 +243,7 @@ struct rpcrdma_req; struct rpcrdma_mr { struct list_head mr_list; struct rpcrdma_req *mr_req; + struct ib_device *mr_device; struct scatterlist *mr_sg; int mr_nents; enum dma_data_direction mr_dir;