Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp576307pxf; Wed, 31 Mar 2021 10:25:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlzRgP1eodK5O3fBqhb4MchQ86RQIRsYeiGerVk4ppadNcXbOoWNR+6mVdurG9tqZVTSmb X-Received: by 2002:a17:906:2cd1:: with SMTP id r17mr4669581ejr.429.1617211508434; Wed, 31 Mar 2021 10:25:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617211508; cv=none; d=google.com; s=arc-20160816; b=fxRcGvkIpH5hxN4vt5dSdROKIFgDX9FjahIEVrCpS08igGwgYb9oAQDtnLqve/5e4I 4jZnGbtUO5ZJl3xqAKPE0lUByIOd0PkOurLn+z0DoeusOgonY8mmtU+2fVNyc20e//fA 0LVlejngWZpBzTag5JZWa3p68JzTgKFJK+80bcCU1rusxXorvJk4Ijw/6O0m0Arojbs2 Bq9XPXRLaYTU56Lf0+ooKQc0D+9T8lnm8Y9GIz5ceRv5cseBlZ2gCixhAg5n9GaXjfXI ZTb6Y9o5jo+Z4q5NBp62ppEr7XCX48KzfrOSG9h5/PG/9ekbPdx0VjS8bWms5Gfs1s+g pDVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject; bh=t1UFVkRlEUzjXJ0KzWeUFNc5ul6OITufYqc9wgOGtRE=; b=nJqPa8E8aWceAnGrWA9UD4XeR4jD1Wn+kL2UNCa9qxKv5bOcjF3uPk90hMRfncZeEk Qw4jbzejJbc+kUQTY8Qx6UU0iACiKeUrNm457v+zt/bmmn6ae9msNqSHmrx2XRbZFTRY +M2Fe0lQecj0VjR8+D/LWTjKVxhPCoJIdT4mz0EE27gyKg0qvILB4Mk1j5iX8rkb7e2u a5BxFzc+Eo00HZtEORf8HE7QBKfm2HremPGRzEWPeR7k2QfHBfVprDADbuibrmXf7Jkw NaQcz5o0aN9vlKbe2hFaik9DVxAL0z5uTnA+kKqYzrw+mUoZmBBfW8WEFqYZj0g69+NM RjVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r5si2187310ejr.410.2021.03.31.10.24.44; Wed, 31 Mar 2021 10:25:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233706AbhCaRW4 (ORCPT + 99 others); Wed, 31 Mar 2021 13:22:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:36414 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233900AbhCaRW2 (ORCPT ); Wed, 31 Mar 2021 13:22:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2739661006; Wed, 31 Mar 2021 17:22:28 +0000 (UTC) Subject: [PATCH 3/3] SUNRPC: Add tracepoint that fires when an RPC is retransmitted From: Chuck Lever To: trondmy@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Date: Wed, 31 Mar 2021 13:22:27 -0400 Message-ID: <161721134727.515091.17484770488909461673.stgit@manet.1015granger.net> In-Reply-To: <161721133412.515091.3634995666026759187.stgit@manet.1015granger.net> References: <161721133412.515091.3634995666026759187.stgit@manet.1015granger.net> User-Agent: StGit/0.23-29-ga622f1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org A separate tracepoint can be left enabled all the time to capture rare but important retransmission events. So for example: kworker/u26:3-568 [009] 156.967933: xprt_retransmit: task:44093@5 xid=0xa25dbc79 nfsv3 WRITE ntrans=2 Or, for example, enable all nfs and nfs4 tracepoints, and set up a trigger to disable tracing when xprt_retransmit fires to capture everything that leads up to it. Signed-off-by: Chuck Lever --- include/trace/events/sunrpc.h | 40 ++++++++++++++++++++++++++++++++++++++++ net/sunrpc/xprt.c | 4 +++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h index 690988530d60..8e68268e2a98 100644 --- a/include/trace/events/sunrpc.h +++ b/include/trace/events/sunrpc.h @@ -1079,6 +1079,46 @@ TRACE_EVENT(xprt_transmit, __entry->seqno, __entry->status) ); +TRACE_EVENT(xprt_retransmit, + 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) + __field(int, ntrans) + __field(int, version) + __string(progname, + rqst->rq_task->tk_client->cl_program->name) + __string(procedure, + rqst->rq_task->tk_msg.rpc_proc->p_name) + ), + + TP_fast_assign( + struct rpc_task *task = rqst->rq_task; + + __entry->task_id = task->tk_pid; + __entry->client_id = task->tk_client ? + task->tk_client->cl_clid : -1; + __entry->xid = be32_to_cpu(rqst->rq_xid); + __entry->ntrans = rqst->rq_ntrans; + __assign_str(progname, + task->tk_client->cl_program->name) + __entry->version = task->tk_client->cl_vers; + __assign_str(procedure, task->tk_msg.rpc_proc->p_name) + ), + + TP_printk( + "task:%u@%u xid=0x%08x %sv%d %s ntrans=%d", + __entry->task_id, __entry->client_id, __entry->xid, + __get_str(progname), __entry->version, __get_str(procedure), + __entry->ntrans) +); + TRACE_EVENT(xprt_ping, TP_PROTO(const struct rpc_xprt *xprt, int status), diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index b694af4504c4..fcdb17666d2d 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -1540,8 +1540,10 @@ xprt_request_transmit(struct rpc_rqst *req, struct rpc_task *snd_task) return status; } - if (is_retrans) + if (is_retrans) { task->tk_client->cl_stats->rpcretrans++; + trace_xprt_retransmit(req); + } xprt_inject_disconnect(xprt);