Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp505202imm; Wed, 29 Aug 2018 05:33:55 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ+we4x8KU1A9qLPDM+LBoWxUvZ8dp138vWjUytWEMRtHdnvPVZAwYbVFckG3w9aNwB0eDV X-Received: by 2002:a63:b812:: with SMTP id p18-v6mr5541680pge.156.1535546035856; Wed, 29 Aug 2018 05:33:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535546035; cv=none; d=google.com; s=arc-20160816; b=sy+2hVgyFLwgPoZnHskg9DFLk+ISsf4WFMJ8ehjyV+0t2TJ/pKliRBj5++zNSStsK7 bFpHag8Pbh5bI3hDqlKoXZSvRXHlqUTvHHwC8Tp3hB8NLtX7sxeDSZ8yo3nZS+28EGCH bt1D6uh2Bm31jPHUGCGT8nwmNKNKmCIGqV7oYjuQsC7T5OOCXDonDoX5nGWBkC1Kb3jQ 8H/tWmGbfhPwZIswWx8tjJkVvrHstoqW15R5lkxUVzvzou4DdrDIKgDEF2fHRQkMebt9 vHXTvr3g9Dsc5hENVconGxQZVWUquTscubkYm1fZhXCmxvyDb1/i69G6GhQCq7MTGNWv zGBw== 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=E96ewGW/cxvzA3sms7PEeeZvOEBkXvNuxE2VAuhUXsE=; b=o2It+Lm402jfF7gUtjG4RuIuPpf1++MY/sv7gCYcs3e9ljmbkdEcsbTqwBpa8nFpTu 6SaWgXtT6sHENeshdT8uJJjLWtUXnaQqSRYN7yfT8qLuTNe3+Mfq0i4WrRGTpFkwo+V/ rLFF/mzDe0Di/x9rtNokndxDakTXvzSH1Q88R6cRLblSkYiygWsNHMWesWo/NSxqoQxF AWA+jhY0m/bhg0U0/rNkuEvkrk8NpWgOmQjdaM3RuA8ZB2vSz6pMzp+ZM1uKLFohbc0g qHO74aoM+YZMffCPtKHpa/aAj5L3zscbWZKx2/o8n+r15/4wXMvvNP9ZxVPsW4JyQVYI 6djg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@owltronix-com.20150623.gappssmtp.com header.s=20150623 header.b=wAArCvAu; 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 o69-v6si3673995pfi.279.2018.08.29.05.33.40; Wed, 29 Aug 2018 05:33:55 -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=wAArCvAu; 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 S1728457AbeH2Q2c (ORCPT + 99 others); Wed, 29 Aug 2018 12:28:32 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:39166 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727941AbeH2Q2P (ORCPT ); Wed, 29 Aug 2018 12:28:15 -0400 Received: by mail-ed1-f67.google.com with SMTP id h4-v6so3795500edi.6 for ; Wed, 29 Aug 2018 05:31:32 -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=E96ewGW/cxvzA3sms7PEeeZvOEBkXvNuxE2VAuhUXsE=; b=wAArCvAuIlKlUh21/E0/3dwAzjgLjLSH1CYm4/eXdr1IEUzalYsPElmMFDBxPiSFg6 ccvz/8/a6VMDEefEhbf0Vja47mfJkR3I1QkT5fSGBNVEe5YrI1iGvd4UAhJOJfOdAPOa 9/lbBpNaLG0D5Ydxk1Py3/mDiqBn5pHPP/nZwIp+HhUrzMXqNYMWAaY+6DnNRwPCfYlr L7FABlcbd5N7iqGPB6EIFHeWs1AbMnHR5+57Xv68ADnlFfr9vWnVhzzAsrpayEjQLagT 79LueqK+y9Q5t1S5BVsCNSW7YQRhMc4PVpcirI9xY9gkwriktL17tCDB3/rb8+P0UTV0 QvQg== 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=E96ewGW/cxvzA3sms7PEeeZvOEBkXvNuxE2VAuhUXsE=; b=JW0zDgO764Dfcpyo3jMENwRVmco2fSgL0dkDetqqc+pcbD8kbuldFQ6IRqzmgVeFg9 NmWhLjw4TXE6UKitIYt7Je/deWCK/ScPL53eqCcIUHYIoaKToFmMbZBUTbn+avMkjg7Q XUlkpEFy4naLx7qqZS9+UmABimVu+ZN130QOiJ3LYm5a21tZdt4actLmudzqLWLhI0E8 PieyI9pa0qhNIRc8S5FeXyLw1lpJBegytwa++RwAOBokkVSTm3UaJB54XzP+BMehkvhE ztn4akwaxmZM6tjwtQ8n/uOFidBAtcwUB0aL52RUHE0cANT4zCJDBVyvoA32xUUnqAo4 nhDA== X-Gm-Message-State: APzg51DmfISUMhyfxn1ckpagLc/xS4UEVZmRVP25O1EKKrlQ6HkpMQvB UwafTldXXPBJiWq3sGdJIR4omw== X-Received: by 2002:a50:d4d5:: with SMTP id e21-v6mr7695667edj.127.1535545891846; Wed, 29 Aug 2018 05:31:31 -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:31 -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 2/4] lightnvm: pblk: add trace events for line state changes Date: Wed, 29 Aug 2018 14:31:15 +0200 Message-Id: <1535545877-770-3-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 logging for line state changes. Signed-off-by: Hans Holmberg --- drivers/lightnvm/pblk-core.c | 19 ++++++++++++++++++- drivers/lightnvm/pblk-gc.c | 8 ++++++++ drivers/lightnvm/pblk-init.c | 3 +++ drivers/lightnvm/pblk-recovery.c | 6 ++++++ drivers/lightnvm/pblk-trace.h | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 68 insertions(+), 1 deletion(-) diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c index 4da37e29bb06..05775a279b20 100644 --- a/drivers/lightnvm/pblk-core.c +++ b/drivers/lightnvm/pblk-core.c @@ -413,6 +413,9 @@ struct list_head *pblk_line_gc_list(struct pblk *pblk, struct pblk_line *line) } } else { line->state = PBLK_LINESTATE_CORRUPT; + trace_pblk_line_state(pblk_disk_name(pblk), line->id, + line->state); + line->gc_group = PBLK_LINEGC_NONE; move_list = &l_mg->corrupt_list; pblk_err(pblk, "corrupted vsc for line %d, vsc:%d (%d/%d/%d)\n", @@ -1019,6 +1022,8 @@ static int pblk_line_init_metadata(struct pblk *pblk, struct pblk_line *line, spin_lock(&l_mg->free_lock); spin_lock(&line->lock); line->state = PBLK_LINESTATE_BAD; + trace_pblk_line_state(pblk_disk_name(pblk), line->id, + line->state); spin_unlock(&line->lock); list_add_tail(&line->list, &l_mg->bad_list); @@ -1166,6 +1171,8 @@ static int pblk_line_init_bb(struct pblk *pblk, struct pblk_line *line, bitmap_weight(line->invalid_bitmap, lm->sec_per_line)) { spin_lock(&line->lock); line->state = PBLK_LINESTATE_BAD; + trace_pblk_line_state(pblk_disk_name(pblk), line->id, + line->state); spin_unlock(&line->lock); list_add_tail(&line->list, &l_mg->bad_list); @@ -1218,6 +1225,8 @@ static int pblk_line_prepare(struct pblk *pblk, struct pblk_line *line) if (line->state == PBLK_LINESTATE_NEW) { blk_to_erase = pblk_prepare_new_line(pblk, line); line->state = PBLK_LINESTATE_FREE; + trace_pblk_line_state(pblk_disk_name(pblk), line->id, + line->state); } else { blk_to_erase = blk_in_line; } @@ -1235,6 +1244,8 @@ static int pblk_line_prepare(struct pblk *pblk, struct pblk_line *line) } line->state = PBLK_LINESTATE_OPEN; + trace_pblk_line_state(pblk_disk_name(pblk), line->id, + line->state); atomic_set(&line->left_eblks, blk_to_erase); atomic_set(&line->left_seblks, blk_to_erase); @@ -1331,6 +1342,8 @@ struct pblk_line *pblk_line_get(struct pblk *pblk) if (unlikely(bit >= lm->blk_per_line)) { spin_lock(&line->lock); line->state = PBLK_LINESTATE_BAD; + trace_pblk_line_state(pblk_disk_name(pblk), line->id, + line->state); spin_unlock(&line->lock); list_add_tail(&line->list, &l_mg->bad_list); @@ -1650,6 +1663,8 @@ static void __pblk_line_put(struct pblk *pblk, struct pblk_line *line) spin_lock(&line->lock); WARN_ON(line->state != PBLK_LINESTATE_GC); line->state = PBLK_LINESTATE_FREE; + trace_pblk_line_state(pblk_disk_name(pblk), line->id, + line->state); line->gc_group = PBLK_LINEGC_NONE; pblk_line_free(line); @@ -1779,7 +1794,6 @@ void pblk_line_close(struct pblk *pblk, struct pblk_line *line) WARN_ON(line->state != PBLK_LINESTATE_OPEN); line->state = PBLK_LINESTATE_CLOSED; move_list = pblk_line_gc_list(pblk, line); - list_add_tail(&line->list, move_list); mempool_free(line->map_bitmap, l_mg->bitmap_pool); @@ -1798,6 +1812,9 @@ void pblk_line_close(struct pblk *pblk, struct pblk_line *line) spin_unlock(&line->lock); spin_unlock(&l_mg->gc_lock); + + trace_pblk_line_state(pblk_disk_name(pblk), line->id, + line->state); } void pblk_line_close_meta(struct pblk *pblk, struct pblk_line *line) diff --git a/drivers/lightnvm/pblk-gc.c b/drivers/lightnvm/pblk-gc.c index 157c2567c9e8..b841d84c4342 100644 --- a/drivers/lightnvm/pblk-gc.c +++ b/drivers/lightnvm/pblk-gc.c @@ -16,8 +16,10 @@ */ #include "pblk.h" +#include "pblk-trace.h" #include + static void pblk_gc_free_gc_rq(struct pblk_gc_rq *gc_rq) { if (gc_rq->data) @@ -64,6 +66,8 @@ static void pblk_put_line_back(struct pblk *pblk, struct pblk_line *line) spin_lock(&line->lock); WARN_ON(line->state != PBLK_LINESTATE_GC); line->state = PBLK_LINESTATE_CLOSED; + trace_pblk_line_state(pblk_disk_name(pblk), line->id, + line->state); move_list = pblk_line_gc_list(pblk, line); spin_unlock(&line->lock); @@ -405,6 +409,8 @@ void pblk_gc_free_full_lines(struct pblk *pblk) spin_lock(&line->lock); WARN_ON(line->state != PBLK_LINESTATE_CLOSED); line->state = PBLK_LINESTATE_GC; + trace_pblk_line_state(pblk_disk_name(pblk), line->id, + line->state); spin_unlock(&line->lock); list_del(&line->list); @@ -451,6 +457,8 @@ static void pblk_gc_run(struct pblk *pblk) spin_lock(&line->lock); WARN_ON(line->state != PBLK_LINESTATE_CLOSED); line->state = PBLK_LINESTATE_GC; + trace_pblk_line_state(pblk_disk_name(pblk), line->id, + line->state); spin_unlock(&line->lock); list_del(&line->list); diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index 3f8bae9be852..ddbd91d80119 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -971,6 +971,9 @@ static int pblk_lines_init(struct pblk *pblk) goto fail_free_lines; nr_free_chks += pblk_setup_line_meta(pblk, line, chunk_meta, i); + + trace_pblk_line_state(pblk_disk_name(pblk), line->id, + line->state); } if (!nr_free_chks) { diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c index eea901d7cebc..f4c5318e99d7 100644 --- a/drivers/lightnvm/pblk-recovery.c +++ b/drivers/lightnvm/pblk-recovery.c @@ -15,6 +15,7 @@ */ #include "pblk.h" +#include "pblk-trace.h" int pblk_recov_check_emeta(struct pblk *pblk, struct line_emeta *emeta_buf) { @@ -932,6 +933,8 @@ struct pblk_line *pblk_recov_l2p(struct pblk *pblk) spin_lock(&line->lock); line->state = PBLK_LINESTATE_CLOSED; + trace_pblk_line_state(pblk_disk_name(pblk), line->id, + line->state); move_list = pblk_line_gc_list(pblk, line); spin_unlock(&line->lock); @@ -947,6 +950,9 @@ struct pblk_line *pblk_recov_l2p(struct pblk *pblk) if (open_lines > 1) pblk_err(pblk, "failed to recover L2P\n"); + trace_pblk_line_state(pblk_disk_name(pblk), line->id, + line->state); + open_lines++; line->meta_line = meta_line; data_line = line; diff --git a/drivers/lightnvm/pblk-trace.h b/drivers/lightnvm/pblk-trace.h index d985b729428f..f9aa9e25e428 100644 --- a/drivers/lightnvm/pblk-trace.h +++ b/drivers/lightnvm/pblk-trace.h @@ -15,6 +15,16 @@ struct ppa_addr; { NVM_CHK_ST_OPEN, "OPEN", }, \ { NVM_CHK_ST_OFFLINE, "OFFLINE", }) +#define show_line_state(state) __print_symbolic(state, \ + { PBLK_LINESTATE_NEW, "NEW", }, \ + { PBLK_LINESTATE_FREE, "FREE", }, \ + { PBLK_LINESTATE_OPEN, "OPEN", }, \ + { PBLK_LINESTATE_CLOSED, "CLOSED", }, \ + { PBLK_LINESTATE_GC, "GC", }, \ + { PBLK_LINESTATE_BAD, "BAD", }, \ + { PBLK_LINESTATE_CORRUPT, "CORRUPT" }) + + TRACE_EVENT(pblk_chunk_state, TP_PROTO(const char *name, struct ppa_addr *ppa, int state), @@ -41,6 +51,29 @@ TRACE_EVENT(pblk_chunk_state, ); +TRACE_EVENT(pblk_line_state, + + TP_PROTO(const char *name, int line, int state), + + TP_ARGS(name, line, state), + + TP_STRUCT__entry( + __string(name, name) + __field(int, line) + __field(int, state); + ), + + TP_fast_assign( + __assign_str(name, name); + __entry->line = line; + __entry->state = state; + ), + + TP_printk("dev=%s line=%d state=%s", __get_str(name), + (int)__entry->line, + show_line_state((int)__entry->state)) + +); #endif /* !defined(_TRACE_PBLK_H) || defined(TRACE_HEADER_MULTI_READ) */ -- 2.7.4