Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp413307imm; Thu, 28 Jun 2018 23:23:48 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIRSR+p5ZoeJmOqCBp54jlA4hZHGVndM3N7GfKEnC/fPkuaVUFFTsApbg0MojAO1lrhNnLd X-Received: by 2002:a65:64d7:: with SMTP id t23-v6mr11777508pgv.207.1530253428198; Thu, 28 Jun 2018 23:23:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530253428; cv=none; d=google.com; s=arc-20160816; b=Xx4ts6b00AHCYkDKW1aO7/uhLOmsbSXSL72T0l31pJ69rO7Ym8LUvIe+eh4z+jJ6xE Yyw97wlM1nm+MMv5yIOOzxCAdhoFpKM4O5CXQ2xk3lugfl2tneOgGIvjc2YXrXWRgyRR m+GOaUmo9aCnyoa9RVanKUX8BV+aMpFYHIfFi/dr39rsL7GM8qO20lAykxnklaCGTqL1 qKs4tmZFl5jdp+TKbfxKD2WaJPxX1d7pxPeyTWBfQK1Sn7LB9BS400VugmAUUiXgxfGc yqLOBZrr4URuPSxZQv7wqFPguqvqJx/amehKXh3TwwfxHWMi7hTCEnZQWibAq/Ivjd5h bbvg== 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=skFrAjmxDMsm04wJsTZWEaMlc6wkzFu236sjPFMVp5g=; b=EV5YI98xHNpxgwZgqjoMLAtHxS5yfUg7F7C/bTTIlUsdyGusqIYEdqQDuB7v8v4Kfd b4nQp6Gh2Rg6d+yIl3PLMS24R5BpztkmTWgJLX0p0wlyAhXpHEq3vXkvKdUAOkzJjAr5 2SvFxy5yHfv80h8k6LPJtZU1kFVN9IBZBxhmTw7E9xWm0NXjN4jm8peLNKjprZCj1jYB +CLzxQl6hyu/Old8zaD4yTcnNjkEcuVA0aVU8tWTz6dCh8PdLJ2c/yDBzjpWvYEhWn1F PEposXqN+jlrTa8yTeXP1ywJAmnA6CAy7FvRp4Sph+jUmIZV2hM2ugfuo23YEDE/5HJv 5NDw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q23-v6si8254491pls.101.2018.06.28.23.23.34; Thu, 28 Jun 2018 23:23:48 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966974AbeF1VvR (ORCPT + 99 others); Thu, 28 Jun 2018 17:51:17 -0400 Received: from mga05.intel.com ([192.55.52.43]:16534 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966673AbeF1VvB (ORCPT ); Thu, 28 Jun 2018 17:51:01 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jun 2018 14:51:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,285,1526367600"; d="scan'208";a="67214457" Received: from unknown (HELO localhost.lm.intel.com) ([10.232.112.44]) by fmsmga004.fm.intel.com with ESMTP; 28 Jun 2018 14:50:49 -0700 From: Keith Busch To: Johannes Thumshirn , Christoph Hellwig , Sagi Grimberg , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Keith Busch Subject: [PATCHv2 4/4] nvme: add disk name to tracepoints Date: Thu, 28 Jun 2018 15:49:56 -0600 Message-Id: <20180628214956.13877-5-keith.busch@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180628214956.13877-1-keith.busch@intel.com> References: <20180628214956.13877-1-keith.busch@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This will print the disk name to the nvme trace for disk based requests so a user can better distinguish traffic to different disks. This allows disk based filters. For example, to see only nvme0n2 traffic: echo "disk == nvme0n2" > /sys/kernel/debug/tracing/events/nvme/filter Signed-off-by: Keith Busch --- drivers/nvme/host/trace.c | 11 +++++++++++ drivers/nvme/host/trace.h | 27 ++++++++++++++++++++------- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/drivers/nvme/host/trace.c b/drivers/nvme/host/trace.c index 41944bbef835..796a5bcf67b8 100644 --- a/drivers/nvme/host/trace.c +++ b/drivers/nvme/host/trace.c @@ -128,3 +128,14 @@ const char *nvme_trace_parse_nvm_cmd(struct trace_seq *p, return nvme_trace_common(p, cdw10); } } + +const char *nvme_trace_disk_name(struct trace_seq *p, char *name) +{ + const char *ret = trace_seq_buffer_ptr(p); + + if (name[0] != 0) + trace_seq_printf(p, "disk=%-.*s, ", DISK_NAME_LEN, name); + trace_seq_putc(p, 0); + + return ret; +} diff --git a/drivers/nvme/host/trace.h b/drivers/nvme/host/trace.h index a99b2929794a..d3522c373e5e 100644 --- a/drivers/nvme/host/trace.h +++ b/drivers/nvme/host/trace.h @@ -75,10 +75,15 @@ const char *nvme_trace_parse_nvm_cmd(struct trace_seq *p, u8 opcode, #define __parse_nvme_cmd(opcode, cdw10) \ nvme_trace_parse_nvm_cmd(p, opcode, cdw10) +const char *nvme_trace_disk_name(struct trace_seq *p, char *name); +#define __print_nvme_disk_name(name) \ + nvme_trace_disk_name(p, name) + TRACE_EVENT(nvme_setup_nvm_cmd, TP_PROTO(struct request *req, struct nvme_command *cmd), TP_ARGS(req, cmd), TP_STRUCT__entry( + __array(char, disk, DISK_NAME_LEN) __field(int, ctrl_id) __field(int, qid) __field(u8, opcode) @@ -98,10 +103,14 @@ TRACE_EVENT(nvme_setup_nvm_cmd, __entry->metadata = le64_to_cpu(cmd->common.metadata); memcpy(__entry->cdw10, cmd->common.cdw10, sizeof(__entry->cdw10)); + req->rq_disk ? + memcpy(__entry->disk, req->rq_disk->disk_name, DISK_NAME_LEN) : + memset(__entry->disk, 0, DISK_NAME_LEN); ), - TP_printk("nvme%d: qid=%d, cmdid=%u, nsid=%u, flags=0x%x, meta=0x%llx, cmd=(%s %s)", - __entry->ctrl_id, __entry->qid, __entry->nsid, - __entry->cid, __entry->flags, __entry->metadata, + TP_printk("nvme%d: %sqid=%d, cmdid=%u, nsid=%u, flags=0x%x, meta=0x%llx, cmd=(%s %s)", + __entry->ctrl_id, __print_nvme_disk_name(__entry->disk), + __entry->qid, __entry->nsid, __entry->cid, + __entry->flags, __entry->metadata, __entry->qid ? show_opcode_name(__entry->opcode) : show_admin_opcode_name(__entry->opcode), @@ -114,6 +123,7 @@ TRACE_EVENT(nvme_complete_rq, TP_PROTO(struct request *req), TP_ARGS(req), TP_STRUCT__entry( + __array(char, disk, DISK_NAME_LEN) __field(int, ctrl_id) __field(int, qid) __field(int, cid) @@ -130,11 +140,14 @@ TRACE_EVENT(nvme_complete_rq, __entry->retries = nvme_req(req)->retries; __entry->flags = nvme_req(req)->flags; __entry->status = nvme_req(req)->status; + req->rq_disk ? + memcpy(__entry->disk, req->rq_disk->disk_name, DISK_NAME_LEN) : + memset(__entry->disk, 0, DISK_NAME_LEN); ), - 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) + TP_printk("nvme%d: %sqid=%d, cmdid=%u, res=%llu, retries=%u, flags=0x%x, status=%u", + __entry->ctrl_id, __print_nvme_disk_name(__entry->disk), + __entry->qid, __entry->cid, __entry->result, + __entry->retries, __entry->flags, __entry->status) ); -- 2.14.3