Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp5301040imm; Tue, 26 Jun 2018 09:00:56 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKUgkws+LbcsUjnTvbevawZ0RB9K2Ggxb8pnILudSNcSA2NNTStAcVSQB6yWnc+mjCYfDq4 X-Received: by 2002:a63:2a45:: with SMTP id q66-v6mr1953210pgq.210.1530028856672; Tue, 26 Jun 2018 09:00:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530028856; cv=none; d=google.com; s=arc-20160816; b=lfMqGZPBO2d6HlbUS+PrDDxVp1vo/1EUIuYp5FzclOWn4Mwq6ELEzc+sAkbeQ3QpgH aouHDnAFYnyElkFOJksUtZY3LCw3hrWT2w0JSRRL3MBw5rxW8WNYz3O+YSwztkMaGFJd 5teiXhzH7PWs3FQJzrDdyeBU0L6O7kDBHk/4gSUivRR1jNLtJszBx5g1NN83wjuBbdfv AIWMOqK5/ESW8eqmIxyEKmKmiK5vZJwJ4ROXpes8lrCp8rknwlFyMMhGPOhlfTwGkNzL d1YWkB3M/2ox7/4rYbMbYPfNDOa6Pcbz1wmq7MLLjmUHOeOBAE74M4+yf8tCyzdhWZ4m KdsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=aNFt1uq0m2py8rN8Md0K9EPawkK6DVQvAXBJyenWUI0=; b=FW2aTkFRc+6z8YR3/yQT2JjBhaRvGlu4CNrlGFUa9KmVoQtFjuezRZIxHB+9AuFVGg mouK3epB6oaRCLGStgsfGQcSP4aXJFrewThrAKBGeNQmNVJvys294B+24T2o0GavEaBe 2lfIx4cyIJbcOGo2scNSJN2URsYxEMsph2GIHeZi0ZbduNy+5/cai57VHYz2cBK+Ntgf ZPSrVjULaDvan6ZTkishxoRxI71Wgu9dL7eWbPcDGVJDHUYuEGLF0RC6qHSVmYM5Uzkn BmHoDDzF7FrVTwr55svnimqvX91VzEp6sMJ4m58V0j8h+vDX+2c/nM6NNI8zWP8s1p0I Lpww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l68-v6si1653834pgl.84.2018.06.26.09.00.41; Tue, 26 Jun 2018 09:00:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935849AbeFZNwM (ORCPT + 99 others); Tue, 26 Jun 2018 09:52:12 -0400 Received: from mx2.suse.de ([195.135.220.15]:44393 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935502AbeFZNvs (ORCPT ); Tue, 26 Jun 2018 09:51:48 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id F0B1CAF13; Tue, 26 Jun 2018 13:51:46 +0000 (UTC) From: Johannes Thumshirn To: Christoph Hellwig , Sagi Grimberg , Keith Busch Cc: Linux NVMe Mailinglist , Linux Kernel Mailinglist , Johannes Thumshirn Subject: [PATCH] nvme: trace: add disk name to tracepoints Date: Tue, 26 Jun 2018 15:51:41 +0200 Message-Id: <20180626135141.14088-3-jthumshirn@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180626135141.14088-1-jthumshirn@suse.de> References: <20180626135141.14088-1-jthumshirn@suse.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add disk name to tracepoints so we can better distinguish between individual disks in the trace output and admin commands which are represented without a disk name. Signed-off-by: Johannes Thumshirn --- drivers/nvme/host/core.c | 4 ++-- drivers/nvme/host/trace.h | 39 +++++++++++++++++++++++++-------------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 62602af9eb77..cc1340948245 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -655,9 +655,9 @@ blk_status_t nvme_setup_cmd(struct nvme_ctrl *ctrl, struct nvme_ns *ns, cmd->common.command_id = req->tag; nvme_req(req)->ctrl = ctrl; if (ns) - trace_nvme_setup_nvm_cmd(req->q->id, cmd); + trace_nvme_setup_nvm_cmd(req, cmd, ns->disk->disk_name); else - trace_nvme_setup_admin_cmd(cmd); + trace_nvme_setup_admin_cmd(req, cmd); return ret; } EXPORT_SYMBOL_GPL(nvme_setup_cmd); diff --git a/drivers/nvme/host/trace.h b/drivers/nvme/host/trace.h index 01390f0e1671..371a816cd225 100644 --- a/drivers/nvme/host/trace.h +++ b/drivers/nvme/host/trace.h @@ -76,9 +76,10 @@ const char *nvme_trace_parse_nvm_cmd(struct trace_seq *p, u8 opcode, nvme_trace_parse_nvm_cmd(p, opcode, cdw10) TRACE_EVENT(nvme_setup_admin_cmd, - TP_PROTO(struct nvme_command *cmd), - TP_ARGS(cmd), + TP_PROTO(struct request *req, struct nvme_command *cmd), + TP_ARGS(req, cmd), TP_STRUCT__entry( + __field(int, ctrl_id) __field(u8, opcode) __field(u8, flags) __field(u16, cid) @@ -86,6 +87,7 @@ TRACE_EVENT(nvme_setup_admin_cmd, __array(u8, cdw10, 24) ), TP_fast_assign( + __entry->ctrl_id = nvme_req(req)->ctrl->cntlid; __entry->opcode = cmd->common.opcode; __entry->flags = cmd->common.flags; __entry->cid = cmd->common.command_id; @@ -93,17 +95,21 @@ TRACE_EVENT(nvme_setup_admin_cmd, memcpy(__entry->cdw10, cmd->common.cdw10, sizeof(__entry->cdw10)); ), - TP_printk(" cmdid=%u, flags=0x%x, meta=0x%llx, cmd=(%s %s)", - __entry->cid, __entry->flags, __entry->metadata, + TP_printk("nvme%d: cmdid=%u, flags=0x%x, meta=0x%llx, cmd=(%s %s)", + __entry->ctrl_id, __entry->cid, __entry->flags, + __entry->metadata, show_admin_opcode_name(__entry->opcode), __parse_nvme_admin_cmd(__entry->opcode, __entry->cdw10)) ); TRACE_EVENT(nvme_setup_nvm_cmd, - TP_PROTO(int qid, struct nvme_command *cmd), - TP_ARGS(qid, cmd), + TP_PROTO(struct request *req, struct nvme_command *cmd, + char *disk_name), + TP_ARGS(req, cmd, disk_name), TP_STRUCT__entry( + __string(name, disk_name) + __field(int, ctrl_id) __field(int, qid) __field(u8, opcode) __field(u8, flags) @@ -113,7 +119,9 @@ TRACE_EVENT(nvme_setup_nvm_cmd, __array(u8, cdw10, 24) ), TP_fast_assign( - __entry->qid = qid; + __assign_str(name, disk_name); + __entry->ctrl_id = nvme_req(req)->ctrl->cntlid; + __entry->qid = req->q->id; __entry->opcode = cmd->common.opcode; __entry->flags = cmd->common.flags; __entry->cid = cmd->common.command_id; @@ -122,10 +130,10 @@ TRACE_EVENT(nvme_setup_nvm_cmd, memcpy(__entry->cdw10, cmd->common.cdw10, sizeof(__entry->cdw10)); ), - TP_printk("qid=%d, nsid=%u, cmdid=%u, flags=0x%x, meta=0x%llx, cmd=(%s %s)", - __entry->qid, __entry->nsid, __entry->cid, - __entry->flags, __entry->metadata, - show_opcode_name(__entry->opcode), + TP_printk("nvme%d: disk=%s, qid=%d, nsid=%u, cmdid=%u, flags=0x%x, meta=0x%llx, cmd=(%s %s)", + __entry->ctrl_id, __get_str(name), __entry->qid, + __entry->nsid, __entry->cid, __entry->flags, + __entry->metadata, show_opcode_name(__entry->opcode), __parse_nvme_cmd(__entry->opcode, __entry->cdw10)) ); @@ -133,6 +141,7 @@ TRACE_EVENT(nvme_complete_rq, TP_PROTO(struct request *req), TP_ARGS(req), TP_STRUCT__entry( + __field(int, ctrl_id) __field(int, qid) __field(int, cid) __field(u64, result) @@ -141,6 +150,7 @@ TRACE_EVENT(nvme_complete_rq, __field(u16, status) ), TP_fast_assign( + __entry->ctrl_id = nvme_req(req)->ctrl->cntlid; __entry->qid = req->q->id; __entry->cid = req->tag; __entry->result = le64_to_cpu(nvme_req(req)->result.u64); @@ -148,9 +158,10 @@ TRACE_EVENT(nvme_complete_rq, __entry->flags = nvme_req(req)->flags; __entry->status = nvme_req(req)->status; ), - TP_printk("qid=%d, cmdid=%u, res=%llu, retries=%u, flags=0x%x, status=%u", - __entry->qid, __entry->cid, __entry->result, - __entry->retries, __entry->flags, __entry->status) + TP_printk("nvme%d: qid=%d, cmdid=%u, res=%llu, retries=%u, flags=0x%x, status=%u", + __entry->ctrl_id, __entry->qid, __entry->cid, + __entry->result, __entry->retries, __entry->flags, + __entry->status) ); -- 2.16.4