From patchwork Tue Oct 9 11:11:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10632267 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 6CD3115E8 for ; Tue, 9 Oct 2018 11:14:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C71B28A69 for ; Tue, 9 Oct 2018 11:14:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 40C2D28A6E; Tue, 9 Oct 2018 11:14:38 +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 87B7928A6F for ; Tue, 9 Oct 2018 11:14:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727672AbeJISbB (ORCPT ); Tue, 9 Oct 2018 14:31:01 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:35828 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeJISbB (ORCPT ); Tue, 9 Oct 2018 14:31:01 -0400 Received: by mail-pl1-f194.google.com with SMTP id f8-v6so680932plb.2 for ; Tue, 09 Oct 2018 04:14:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xw/0bX6g1bphl4qCLi3oqhSdmZqGRZB0w26ZEqBFFwM=; b=whV01Jh603VBEE5sBace/+p7wXP/keQz0wD8YVjlSTPYAheayGJSSc8L+afGqPZxOA lQ5p7Ebxk/HyB8OokYUkC5hpMD+l9QxYINNTbThQre3U7fyp3Q/7XhGs8oS4blM9TqyD jc9nkiknQP5C865yMyyMS2lMhIWpcv0Z6IKI9U/YkW8H3+PmgIbhD4lQ9BrRa1qzzy6f v60do2LmUxqqqhEExKbOAWgXFFvnpT6YiLzvylJDsTtAc8BT5o25N+0ZGfgl7uNhnqqf WgNzGJKEpP/xPW5vNLtUuf0aWTO7CKVUj+qJhkTM/OerspCbQNl9b2y6ftnCjjlhgMon U8lQ== 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:mime-version:content-transfer-encoding; bh=xw/0bX6g1bphl4qCLi3oqhSdmZqGRZB0w26ZEqBFFwM=; b=Lff2GpkI0ixz0m1QQ4w36TVtkmOU0qcp7GOzvvbjCmTBzdpgUcm31FHra4mz8lTiDa cfiYM10HkdPsGtisb2mgPiO4zoCoClOTLOoAmNlDhFB59UF9H6IzU4pSyjiw214j3baJ Hg3v7IGoaqARvC0rB52CLCF8+F/PTYDSWYxgJWlHoAhLQputVtrJhfHeEydKPGY6QeB3 ijSyu0BZPwSGG6cdBddvWT3pPXndnw3GhceaxnBnzKCZy1PW7MKJR+RytaZzyVVMqOhg 0XvF1woZ2my37dCNhxKLDZcyI9Mr58wQuZwJHhSz52ODdeZgzKyzXpf+YvSLFl/GA3y2 solw== X-Gm-Message-State: ABuFfoioi7ZusPNlDYVC1gWbFNLzVvKksbeEMcvLCd46kiSvtUrZNikQ acGE/LxLb771wspvkQ5dBeJK1Q== X-Google-Smtp-Source: ACcGV61yCGKy+3yAb37r9V8Oy1LYL/9OuSQthqrggLMcknxwuSozXT50jOOaFvOu3az0517fp8nw3g== X-Received: by 2002:a17:902:7c96:: with SMTP id y22-v6mr28170872pll.321.1539083674443; Tue, 09 Oct 2018 04:14:34 -0700 (PDT) Received: from skyninja.hgst.com (rap-us.hgst.com. [199.255.44.250]) by smtp.gmail.com with ESMTPSA id p1-v6sm25342380pff.128.2018.10.09.04.14.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Oct 2018 04:14:33 -0700 (PDT) From: =?utf-8?q?Matias_Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg , =?utf-8?q?Matias_Bj=C3=B8rling?= Subject: [GIT PULL 24/45] lightnvm: pblk: add trace events for pblk state changes Date: Tue, 9 Oct 2018 13:11:54 +0200 Message-Id: <20181009111215.7653-25-mb@lightnvm.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181009111215.7653-1-mb@lightnvm.io> References: <20181009111215.7653-1-mb@lightnvm.io> MIME-Version: 1.0 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 Signed-off-by: Matias Bjørling --- 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 ef52c1647f88..c482ef7dd4b5 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 fca37da16266..9aebdee8e4c9 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -1109,6 +1109,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 */