Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp412480imm; Thu, 28 Jun 2018 23:22:35 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKLKPRda9QFMJDd7i079tKk25R8uSP/2aavQfTlvHkvazhLa9dpd/Vr+MZ8mWNCW6tg6oAm X-Received: by 2002:a63:2b15:: with SMTP id r21-v6mr11582147pgr.262.1530253355376; Thu, 28 Jun 2018 23:22:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530253355; cv=none; d=google.com; s=arc-20160816; b=W+7Uhp/NBrheZ0HdiHSkYaeua+EnUvRjlj9kNUkxAJhDNmeez24ub4W0abgjg2k752 6wtH3BvE/shirYj3WZ1dyQDwb4D1VJPjgz/gMocLAemUf+GPB68QxW+JsRPSYy4KRp9d LU8SbeGOEIRPg77RF85bkcLXL81sJd6UuirnTmUkwKU9S2MGTDN5Qn/rh0PsdcXNkCJG XuhrbojYLCSr3EB247FNjWzwcqlqY/+ssiuyHatvQ8YhOYmnSSe7HhO0jX831jvABjKE WEaSrk0ZxLqs0PN5Utca0bILCNRE5Bh6qeLroY3adWqo19P+qRT1X9RrQx6xLYDkO3Bh ITAg== 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=y7fsbWHoHK1MavOxChKgLWo3K0pV5VBxp/Dt2COPk0g=; b=qfmirJ1ea8x78hUlStbwLoynHAqWL7ztVDW8dnRuG3NnxelbgHmTnLV/emPsGPPyT9 CZt2f9ciBwnMIZgExucGd4mKOAsF/0BUxYb3OgSbOtfypuVpxapRhRLOUusbm59Dxosr 26pD2EmCRmcnlfxRCSuufONMxgNeHRHy08St+ReDxCthFnclrKDs3nqNUR01A3oRJq11 g8yfLLY041FV2RgBAMrsUpc05CzUGPPsTfthuv4vYRs6r+R+oVD6KM0cWTm/aF86d4Cs N6ikYZwpMG9s9LUU81Ewby/kSofUpMX9IWTJ6eDGKmkZGVK/YV2aJBelIULMwoyl41fT u1Yg== 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 t186-v6si7827409pgd.3.2018.06.28.23.22.21; Thu, 28 Jun 2018 23:22:35 -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 S966659AbeF1VvB (ORCPT + 99 others); Thu, 28 Jun 2018 17:51:01 -0400 Received: from mga05.intel.com ([192.55.52.43]:16533 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966094AbeF1VvA (ORCPT ); Thu, 28 Jun 2018 17:51:00 -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="67214448" Received: from unknown (HELO localhost.lm.intel.com) ([10.232.112.44]) by fmsmga004.fm.intel.com with ESMTP; 28 Jun 2018 14:50:48 -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 1/4] nvme: trace nvme queue identifiers Date: Thu, 28 Jun 2018 15:49:53 -0600 Message-Id: <20180628214956.13877-2-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 We can not match a command to its completion based on the command id alone. We need the submitting queue identifier to pair the completion, so this patch adds that to the trace buffer. This patch is also collapsing the admin and io submission traces into a single one since we don't need to duplicate this and creating unnecessary code branches. Signed-off-by: Keith Busch --- drivers/nvme/host/core.c | 7 +++---- drivers/nvme/host/trace.h | 41 ++++++++++------------------------------- 2 files changed, 13 insertions(+), 35 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 46df030b2c3f..398a5fb26603 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -97,6 +97,8 @@ static dev_t nvme_chr_devt; static struct class *nvme_class; static struct class *nvme_subsys_class; +static void nvme_remove_invalid_namespaces(struct nvme_ctrl *ctrl, + unsigned nsid); static void nvme_ns_remove(struct nvme_ns *ns); static int nvme_revalidate_disk(struct gendisk *disk); static void nvme_put_subsystem(struct nvme_subsystem *subsys); @@ -652,10 +654,7 @@ blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct request *req, } cmd->common.command_id = req->tag; - if (ns) - trace_nvme_setup_nvm_cmd(req->q->id, cmd); - else - trace_nvme_setup_admin_cmd(cmd); + trace_nvme_setup_nvm_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..42c99445dd96 100644 --- a/drivers/nvme/host/trace.h +++ b/drivers/nvme/host/trace.h @@ -75,34 +75,9 @@ 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) -TRACE_EVENT(nvme_setup_admin_cmd, - TP_PROTO(struct nvme_command *cmd), - TP_ARGS(cmd), - TP_STRUCT__entry( - __field(u8, opcode) - __field(u8, flags) - __field(u16, cid) - __field(u64, metadata) - __array(u8, cdw10, 24) - ), - TP_fast_assign( - __entry->opcode = cmd->common.opcode; - __entry->flags = cmd->common.flags; - __entry->cid = cmd->common.command_id; - __entry->metadata = le64_to_cpu(cmd->common.metadata); - 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, - 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), + TP_ARGS(req, cmd), TP_STRUCT__entry( __field(int, qid) __field(u8, opcode) @@ -113,7 +88,7 @@ TRACE_EVENT(nvme_setup_nvm_cmd, __array(u8, cdw10, 24) ), TP_fast_assign( - __entry->qid = qid; + __entry->qid = blk_mq_unique_tag_to_hwq(blk_mq_unique_tag(req)) + !!req->rq_disk; __entry->opcode = cmd->common.opcode; __entry->flags = cmd->common.flags; __entry->cid = cmd->common.command_id; @@ -125,8 +100,12 @@ TRACE_EVENT(nvme_setup_nvm_cmd, 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), - __parse_nvme_cmd(__entry->opcode, __entry->cdw10)) + __entry->qid ? + show_opcode_name(__entry->opcode) : + show_admin_opcode_name(__entry->opcode), + __entry->qid ? + __parse_nvme_cmd(__entry->opcode, __entry->cdw10) : + __parse_nvme_admin_cmd(__entry->opcode, __entry->cdw10)) ); TRACE_EVENT(nvme_complete_rq, @@ -141,7 +120,7 @@ TRACE_EVENT(nvme_complete_rq, __field(u16, status) ), TP_fast_assign( - __entry->qid = req->q->id; + __entry->qid = blk_mq_unique_tag_to_hwq(blk_mq_unique_tag(req)) + !!req->rq_disk; __entry->cid = req->tag; __entry->result = le64_to_cpu(nvme_req(req)->result.u64); __entry->retries = nvme_req(req)->retries; -- 2.14.3