Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp504638imm; Wed, 29 Aug 2018 05:33:09 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbJMs3AwLvfpd68p82+bTJcQcU+bMOwWgsPFae8ZWBHUo7tLblo7Gu46aIFDhT8c2l68Hs2 X-Received: by 2002:a62:7d8d:: with SMTP id y135-v6mr5708730pfc.259.1535545989877; Wed, 29 Aug 2018 05:33:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535545989; cv=none; d=google.com; s=arc-20160816; b=b9NbW1zXehuixKGPJPuj8v/IaIdnXf5GqddJMATUF4KfGuP+PecDnHb0h6DEFrIig1 OUFwBfVO05UocttTeIXEjrLJO3HxhGc+r8qI1DHxABd7bk+AazaOnHXg5rmx+dFEkK+g yl2l7glHCb6YsumF2PTvzhcVrNxqVPpMxNz0i5GFAHDcMVJIC4yfrfuyH5zSECepkvtr reOKH+RxdGCQmy6GWKDSasUcoQLEJIAlzBJk+tEp6V1Ia+WZYuHEOBqa3LwsjQ3PRmJS bkiy6g4R+xHA2pXMkRfnU/u7mvU/ivQ3ExgLEIShPQOClXs7BRRE1hcXGduGqt95vWaa QHYg== 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:dkim-signature:arc-authentication-results; bh=NeDTjzJOqfY5rZWytS4mgF4YyZi+wjNgQMmbZ7e/6y4=; b=ChWV5DcCUX4TzQv4UOEIF+IUocEVWd6DzHsfIO2vj644QdwAnnFQzPZ/PeV3lGRue9 PCuqd5/xLH9f5e/3Z3qnhd2scB+V2deGZon8oJez6EUeeEj8tbcOZgzcP7Ri/wJcxKUR G32lYjZnGUG5KYLJ4JkdPNFRkAEy3OuaM+dzUaRR7MLS4n6ewNoNmjZVpEW9AyyqEKy6 +T3hfyJ4EhIfuJiW+ppiTUo6nfik/r+9jKy7AYHktMGvgOGrkoXJgkzgIF8NUzNKj3XL 3xmpzoEQ4Mgg6QfhK1lp1KEWhGcF8Ed3OdPXqgQmOxTsq9PdGnImlXu3/OrDIDBh420l eH9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@owltronix-com.20150623.gappssmtp.com header.s=20150623 header.b=BOxBLl1T; 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 184-v6si3656834pgj.421.2018.08.29.05.32.55; Wed, 29 Aug 2018 05:33:09 -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; dkim=pass header.i=@owltronix-com.20150623.gappssmtp.com header.s=20150623 header.b=BOxBLl1T; 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 S1728361AbeH2Q2Q (ORCPT + 99 others); Wed, 29 Aug 2018 12:28:16 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:40022 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728144AbeH2Q2P (ORCPT ); Wed, 29 Aug 2018 12:28:15 -0400 Received: by mail-ed1-f68.google.com with SMTP id e19-v6so3784387edq.7 for ; Wed, 29 Aug 2018 05:31:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=owltronix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NeDTjzJOqfY5rZWytS4mgF4YyZi+wjNgQMmbZ7e/6y4=; b=BOxBLl1TkOuLvCuxPjhOrIJOZXuHu5Bkrg87rdyXrQqFkZ49O/6AsbNF2e10GqvBe4 t0Lf1wQ6Ykl9hQwT6RJhJzho+j1PoUyJl09iaRUn29g+hu3cpWv5UWka58uGsyQ5Wqr0 TNyBMYm0aGq5CunsskJ7Lk/5ZdQGkdlpENzvNL9Ol5cuT+BhDszGnO2J2GXf9IONBD8e 441e7Kfuep5en4/NuB3LV6HCZDNY/dKPDzzE1C5C8iyTQp5hxaA1J9XLbp9TGxKuKlGL hksRmGJKS8Uz+P86irXio7vavDF1Yy/Nth/8A6H2suzU3BOqSsiEC+3Bj7GCqDmURv4m fOVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NeDTjzJOqfY5rZWytS4mgF4YyZi+wjNgQMmbZ7e/6y4=; b=OcnBC9VKpoqL71SgD3BeoJNFKrxGXzWzc6UMcNub/4cMuywcuf8WKQeGvrE152aNgs gc4mAurLm90MdxAEmHmkIjHCJLHNS3DwhfFZKfDRznYOgX27v9XTPuj8AEwZlBhIm+X4 H/XTXCX/JhVbiAiCUPN7pG1IdorpPkjFEFi6s8baQYiSScipphsqZalLNmPk4TLu9dGi ByyomNn2rS3pldUA5uedEllZXC/pE0BtrdTZKZZ1wGtznTIffCceAgl56b4iBDYN7X6K sobRxIrqx8hVG3MTGem+Nd8E5HpPSa0OW/4TlTLdMSaqpJ9wtymVi15NCuJuc0XDq0xV 4Yhg== X-Gm-Message-State: APzg51CnW8rZwHuso6kXD39CWzBJyrVBDIeGW2xNTlngSlaeZLy/kr7q uo6GJw+qSu6SE/S6L3jFCu5nyA== X-Received: by 2002:a50:92ce:: with SMTP id l14-v6mr7529921eda.43.1535545892535; Wed, 29 Aug 2018 05:31:32 -0700 (PDT) Received: from titan.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id r44-v6sm2765454edd.87.2018.08.29.05.31.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Aug 2018 05:31:32 -0700 (PDT) From: Hans Holmberg To: Matias Bjorling Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Gonzales , Hans Holmberg Subject: [PATCH 3/4] lightnvm: pblk: add trace events for pblk state changes Date: Wed, 29 Aug 2018 14:31:16 +0200 Message-Id: <1535545877-770-4-git-send-email-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535545877-770-1-git-send-email-hans.ml.holmberg@owltronix.com> References: <1535545877-770-1-git-send-email-hans.ml.holmberg@owltronix.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans Holmberg Add trace events for tracking pblk state changes. Signed-off-by: Hans Holmberg --- drivers/lightnvm/pblk-core.c | 3 +++ drivers/lightnvm/pblk-init.c | 1 + drivers/lightnvm/pblk-trace.h | 28 ++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c index 05775a279b20..566a5d3165ee 100644 --- a/drivers/lightnvm/pblk-core.c +++ b/drivers/lightnvm/pblk-core.c @@ -1503,6 +1503,7 @@ static void pblk_stop_writes(struct pblk *pblk, struct pblk_line *line) pblk_set_space_limit(pblk); pblk->state = PBLK_STATE_STOPPING; + trace_pblk_state(pblk_disk_name(pblk), pblk->state); } static void pblk_line_close_meta_sync(struct pblk *pblk) @@ -1552,6 +1553,7 @@ void __pblk_pipeline_flush(struct pblk *pblk) return; } pblk->state = PBLK_STATE_RECOVERING; + trace_pblk_state(pblk_disk_name(pblk), pblk->state); spin_unlock(&l_mg->free_lock); pblk_flush_writer(pblk); @@ -1573,6 +1575,7 @@ void __pblk_pipeline_stop(struct pblk *pblk) spin_lock(&l_mg->free_lock); pblk->state = PBLK_STATE_STOPPED; + trace_pblk_state(pblk_disk_name(pblk), pblk->state); l_mg->data_line = NULL; l_mg->data_next = NULL; spin_unlock(&l_mg->free_lock); diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index ddbd91d80119..d0546213c64f 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -1093,6 +1093,7 @@ static void *pblk_init(struct nvm_tgt_dev *dev, struct gendisk *tdisk, pblk->dev = dev; pblk->disk = tdisk; pblk->state = PBLK_STATE_RUNNING; + trace_pblk_state(pblk_disk_name(pblk), pblk->state); pblk->gc.gc_enabled = 0; if (!(geo->version == NVM_OCSSD_SPEC_12 || diff --git a/drivers/lightnvm/pblk-trace.h b/drivers/lightnvm/pblk-trace.h index f9aa9e25e428..c171d0450c07 100644 --- a/drivers/lightnvm/pblk-trace.h +++ b/drivers/lightnvm/pblk-trace.h @@ -25,6 +25,13 @@ struct ppa_addr; { PBLK_LINESTATE_CORRUPT, "CORRUPT" }) +#define show_pblk_state(state) __print_symbolic(state, \ + { PBLK_STATE_RUNNING, "RUNNING", }, \ + { PBLK_STATE_STOPPING, "STOPPING", }, \ + { PBLK_STATE_RECOVERING, "RECOVERING", }, \ + { PBLK_STATE_STOPPED, "STOPPED" }) + + TRACE_EVENT(pblk_chunk_state, TP_PROTO(const char *name, struct ppa_addr *ppa, int state), @@ -75,6 +82,27 @@ TRACE_EVENT(pblk_line_state, ); +TRACE_EVENT(pblk_state, + + TP_PROTO(const char *name, int state), + + TP_ARGS(name, state), + + TP_STRUCT__entry( + __string(name, name) + __field(int, state); + ), + + TP_fast_assign( + __assign_str(name, name); + __entry->state = state; + ), + + TP_printk("dev=%s state=%s", __get_str(name), + show_pblk_state((int)__entry->state)) + +); + #endif /* !defined(_TRACE_PBLK_H) || defined(TRACE_HEADER_MULTI_READ) */ /* This part must be outside protection */ -- 2.7.4