From patchwork Wed Aug 29 12:31:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10580141 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1E202920 for ; Wed, 29 Aug 2018 12:31:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BDBC2AEE7 for ; Wed, 29 Aug 2018 12:31:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 000BE2AF7B; Wed, 29 Aug 2018 12:31:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90A642AFD2 for ; Wed, 29 Aug 2018 12:31:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728144AbeH2Q2Q (ORCPT ); Wed, 29 Aug 2018 12:28:16 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:38769 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728145AbeH2Q2P (ORCPT ); Wed, 29 Aug 2018 12:28:15 -0400 Received: by mail-ed1-f65.google.com with SMTP id h33-v6so3795262edb.5 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=GuWSxBTUT9gYFPK6e9ztB8khsIiuzhXS9OLp4b1IQn081AvL0MJ9mWOkTd1aRMpjoD DVRMOMeWSHMhbvFYIRvLeRhZlNZp92Fhl/W/GhpVybkG6x6fXbtOiPxg4cpjDxTHDwoI bZI8H7LwcAcEWBgyhZEhbrWotPn42M07nZEHuAXAFx3q0qIz1iDCOSD65vxrBi8ndjbJ AF1bp/lgmAPn5Aag5eBwpnYojGCrM5x2yRsNEMHnk+eAWzXgY3XZ4b++JOqjWAYafAoO mo3qwbCwsbV+g5gzH/5SmO7t0H/LyxgcBK7nskcKvsYTWzxGTOiMNgrvvnUNZlyeWME3 HtIA== X-Gm-Message-State: APzg51CfdMBcvpbdlS0LbSHUYpGBcvQ4SxbnvYZ21g+9WvmMFN1sHFia JExs2C0y510KVcUjT5gGN1Q85Q== X-Google-Smtp-Source: ANB0VdaNFsOl0HXmoyXeXOV0rMVImNgZH0YHQu1X+n5nzBxcpX2AQHvYdQIBoz035nMm57AmlrkBtg== 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-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 */