From patchwork Wed Aug 29 12:31:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10580147 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 780A3920 for ; Wed, 29 Aug 2018 12:31:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 679182AEE7 for ; Wed, 29 Aug 2018 12:31:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 59BAE2AF5A; Wed, 29 Aug 2018 12:31:51 +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 B2CCF2AEE7 for ; Wed, 29 Aug 2018 12:31:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728151AbeH2Q2P (ORCPT ); Wed, 29 Aug 2018 12:28:15 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:39163 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727999AbeH2Q2O (ORCPT ); Wed, 29 Aug 2018 12:28:14 -0400 Received: by mail-ed1-f65.google.com with SMTP id h4-v6so3795471edi.6 for ; Wed, 29 Aug 2018 05:31:31 -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=yeZZLzA1YTu4IH96mPn/+cY051Qc7LrdN4n4y3ravr8=; b=H77cJHjBPwHN4pdBpyMTWIOcXY/lQUnsziD1Oo1Pa08I2LXRrQp+nd6IPWzC+diREG I2OMVuyE7he68gWBj6jgezCwFm1NN7XsVBcIVZcDo7F8JjyQpxlB5EPCjvD803vQivbl Lg6yE49FPArYAupZu6DdpP/8/MlzgmA3AHu/uo7YlYHZPH+AY0ZqSwzEMRXJOq2WQH8U m72L2rTf0jcwYHgqLGrEAmX5Bb8uhSuGevdPg2f4nNksGnSjP98Fp8bLFWQp/oHHRYYy N6eLe3iDZvChCSweIcZ8I8r0TRKy0akdDqlIgTYs1HePoYtNzU4kRNyz1JmebZhyK5A/ derg== 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=yeZZLzA1YTu4IH96mPn/+cY051Qc7LrdN4n4y3ravr8=; b=nesWn3WfNv/quKOkSWKLD96rOtznxeSbsrxVziNj++hcjFP37qyvZp/edXi6LnW+NP dnJVL4QVaHoouitrhSgo2j9qx0mtOXYjLJsdxpTe9dzOTYf44B+LZQlDNxJaZOMySBUa cZHVdCt9DAUpTvTvLFuELdB+Re+dNZdnCdJotY2ir6O0rTY14A/CyXkCe0ajUMxreT2G UP2gria9A/cdhi3pbSIIJX9PNPFA1sgZbx+O1REaJ+2tFmVctLvdODVGiGcYNS3cHKtT aaqueuV4vqQC0tCvXF5NghN0mrvoDhn2tMe/W+uPQUv2nmrWigamUvFVzGlsJt6Lg0Vj eaVQ== X-Gm-Message-State: APzg51Dvy4p/F7t1ysYmgz0LC1ab6Dl7kHqTYdEbQJ4PUPjmCc1D+o4i fbDUY4Akp4KMxMnjdCfuVGL3KrbKiNP/7A== X-Google-Smtp-Source: ANB0VdZfjwGsS1us+sDkhYcd4xQAfKTJQ18fGcm87Jd2KTi0pwzaSyQKgInh2Aw5zTYeTIeIXWC6rg== X-Received: by 2002:a50:d512:: with SMTP id u18-v6mr2235757edi.291.1535545891004; 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.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Aug 2018 05:31:30 -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 1/4] lightnvm: pblk: add trace events for chunk states Date: Wed, 29 Aug 2018 14:31:14 +0200 Message-Id: <1535545877-770-2-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 Introduce trace points for tracking chunk states in pblk - this is useful for inspection of the entire state of the drive, and real handy for both fw and pblk debugging. Signed-off-by: Hans Holmberg --- drivers/lightnvm/pblk-core.c | 35 +++++++++++++++++++++++++++- drivers/lightnvm/pblk-init.c | 4 ++++ drivers/lightnvm/pblk-trace.h | 53 +++++++++++++++++++++++++++++++++++++++++++ drivers/lightnvm/pblk-write.c | 10 ++++++-- drivers/lightnvm/pblk.h | 8 +++++++ 5 files changed, 107 insertions(+), 3 deletions(-) create mode 100644 drivers/lightnvm/pblk-trace.h diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c index f7bff3ae52ac..4da37e29bb06 100644 --- a/drivers/lightnvm/pblk-core.c +++ b/drivers/lightnvm/pblk-core.c @@ -16,7 +16,10 @@ * */ +#define CREATE_TRACE_POINTS + #include "pblk.h" +#include "pblk-trace.h" static void pblk_line_mark_bb(struct work_struct *work) { @@ -93,6 +96,9 @@ static void __pblk_end_io_erase(struct pblk *pblk, struct nvm_rq *rqd) chunk->state = NVM_CHK_ST_FREE; } + trace_pblk_chunk_state(pblk_disk_name(pblk), &rqd->ppa_addr, + chunk->state); + atomic_dec(&pblk->inflight_io); } @@ -477,9 +483,30 @@ int pblk_submit_io(struct pblk *pblk, struct nvm_rq *rqd) return nvm_submit_io(dev, rqd); } +void pblk_check_chunk_state_update(struct pblk *pblk, struct nvm_rq *rqd) +{ + struct ppa_addr *ppa_list = nvm_rq_to_ppa_list(rqd); + + int i; + + for (i = 0; i < rqd->nr_ppas; i++) { + struct ppa_addr *ppa = &ppa_list[i]; + struct nvm_chk_meta *chunk = pblk_dev_ppa_to_chunk(pblk, *ppa); + u64 caddr = pblk_dev_ppa_to_chunk_addr(pblk, *ppa); + + if (caddr == 0) + trace_pblk_chunk_state(pblk_disk_name(pblk), + ppa, NVM_CHK_ST_OPEN); + else if (caddr == chunk->cnlb) + trace_pblk_chunk_state(pblk_disk_name(pblk), + ppa, NVM_CHK_ST_CLOSED); + } +} + int pblk_submit_io_sync(struct pblk *pblk, struct nvm_rq *rqd) { struct nvm_tgt_dev *dev = pblk->dev; + int ret; atomic_inc(&pblk->inflight_io); @@ -488,7 +515,13 @@ int pblk_submit_io_sync(struct pblk *pblk, struct nvm_rq *rqd) return NVM_IO_ERR; #endif - return nvm_submit_io_sync(dev, rqd); + ret = nvm_submit_io_sync(dev, rqd); + + if (trace_pblk_chunk_state_enabled() && !ret && + rqd->opcode == NVM_OP_PWRITE) + pblk_check_chunk_state_update(pblk, rqd); + + return ret; } static void pblk_bio_map_addr_endio(struct bio *bio) diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index 0be64220b5d8..3f8bae9be852 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -19,6 +19,7 @@ */ #include "pblk.h" +#include "pblk-trace.h" static unsigned int write_buffer_size; @@ -650,6 +651,9 @@ static int pblk_setup_line_meta_chk(struct pblk *pblk, struct pblk_line *line, chunk->cnlb = chunk_meta->cnlb; chunk->wp = chunk_meta->wp; + trace_pblk_chunk_state(pblk_disk_name(pblk), &ppa, + chunk->state); + if (chunk->type & NVM_CHK_TP_SZ_SPEC) { WARN_ONCE(1, "pblk: custom-sized chunks unsupported\n"); continue; diff --git a/drivers/lightnvm/pblk-trace.h b/drivers/lightnvm/pblk-trace.h new file mode 100644 index 000000000000..d985b729428f --- /dev/null +++ b/drivers/lightnvm/pblk-trace.h @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM pblk + +#if !defined(_TRACE_PBLK_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_PBLK_H + +#include + +struct ppa_addr; + +#define show_chunk_flags(state) __print_flags(state, "", \ + { NVM_CHK_ST_FREE, "FREE", }, \ + { NVM_CHK_ST_CLOSED, "CLOSED", }, \ + { NVM_CHK_ST_OPEN, "OPEN", }, \ + { NVM_CHK_ST_OFFLINE, "OFFLINE", }) + +TRACE_EVENT(pblk_chunk_state, + + TP_PROTO(const char *name, struct ppa_addr *ppa, int state), + + TP_ARGS(name, ppa, state), + + TP_STRUCT__entry( + __string(name, name) + __field(u64, ppa) + __field(int, state); + ), + + TP_fast_assign( + __assign_str(name, name); + __entry->ppa = ppa->ppa; + __entry->state = state; + ), + + TP_printk("dev=%s grp=%llu pu=%llu chk=%llu state=%s", __get_str(name), + (u64)(((struct ppa_addr *)(&__entry->ppa))->m.grp), + (u64)(((struct ppa_addr *)(&__entry->ppa))->m.pu), + (u64)(((struct ppa_addr *)(&__entry->ppa))->m.chk), + show_chunk_flags((int)__entry->state)) + +); + + +#endif /* !defined(_TRACE_PBLK_H) || defined(TRACE_HEADER_MULTI_READ) */ + +/* This part must be outside protection */ + +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH ../../../drivers/lightnvm +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_FILE pblk-trace +#include diff --git a/drivers/lightnvm/pblk-write.c b/drivers/lightnvm/pblk-write.c index 8aa4b9ee5092..bb656cbd5d3e 100644 --- a/drivers/lightnvm/pblk-write.c +++ b/drivers/lightnvm/pblk-write.c @@ -16,6 +16,7 @@ */ #include "pblk.h" +#include "pblk-trace.h" static unsigned long pblk_end_w_bio(struct pblk *pblk, struct nvm_rq *rqd, struct pblk_c_ctx *c_ctx) @@ -278,11 +279,13 @@ static void pblk_end_io_write(struct nvm_rq *rqd) if (rqd->error) { pblk_end_w_fail(pblk, rqd); return; - } + } else { + if (trace_pblk_chunk_state_enabled()) + pblk_check_chunk_state_update(pblk, rqd); #ifdef CONFIG_NVM_PBLK_DEBUG - else WARN_ONCE(rqd->bio->bi_status, "pblk: corrupted write error\n"); #endif + } pblk_complete_write(pblk, rqd, c_ctx); atomic_dec(&pblk->inflight_io); @@ -303,6 +306,9 @@ static void pblk_end_io_write_meta(struct nvm_rq *rqd) pblk_log_write_err(pblk, rqd); pblk_err(pblk, "metadata I/O failed. Line %d\n", line->id); line->w_err_gc->has_write_err = 1; + } else { + if (trace_pblk_chunk_state_enabled()) + pblk_check_chunk_state_update(pblk, rqd); } sync = atomic_add_return(rqd->nr_ppas, &emeta->sync); diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h index 1bdac22e7897..ed17db2cae2c 100644 --- a/drivers/lightnvm/pblk.h +++ b/drivers/lightnvm/pblk.h @@ -785,6 +785,7 @@ void pblk_log_read_err(struct pblk *pblk, struct nvm_rq *rqd); int pblk_submit_io(struct pblk *pblk, struct nvm_rq *rqd); int pblk_submit_io_sync(struct pblk *pblk, struct nvm_rq *rqd); int pblk_submit_meta_io(struct pblk *pblk, struct pblk_line *meta_line); +void pblk_check_chunk_state_update(struct pblk *pblk, struct nvm_rq *rqd); struct bio *pblk_bio_map_addr(struct pblk *pblk, void *data, unsigned int nr_secs, unsigned int len, int alloc_type, gfp_t gfp_mask); @@ -1440,4 +1441,11 @@ static inline void pblk_setup_uuid(struct pblk *pblk) uuid_le_gen(&uuid); memcpy(pblk->instance_uuid, uuid.b, 16); } + +static inline char *pblk_disk_name(struct pblk *pblk) +{ + struct gendisk *disk = pblk->disk; + + return disk->disk_name; +} #endif /* PBLK_H_ */ From patchwork Wed Aug 29 12:31:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10580145 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 5A8D8920 for ; Wed, 29 Aug 2018 12:31:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 498E92AF04 for ; Wed, 29 Aug 2018 12:31:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3CAC72AF7B; Wed, 29 Aug 2018 12:31:40 +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 7FBC72AF04 for ; Wed, 29 Aug 2018 12:31:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728401AbeH2Q2R (ORCPT ); Wed, 29 Aug 2018 12:28:17 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:46437 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728132AbeH2Q2Q (ORCPT ); Wed, 29 Aug 2018 12:28:16 -0400 Received: by mail-ed1-f67.google.com with SMTP id k14-v6so3767826edr.13 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=ASd45K1JjVGzYkgtCwLIKgq2wRURtrzEy7l2xqvW4mDI3/+LZaVp54ORx9+h2G7mdl xANYSSsCCOwBLRVt1A2EfSgaJe6qZUCSc5oTFp1NnKYEk8C1kwxGaIicpAf/xHwpCfFY uPs02YoWzcrlYOrb3PjHAeTtNsJPkse+e9bDUvdG3lqdKWT9ZOwZjy0qJL+hB3J3Ob/8 8sY88H4ZdsiB+y4bL5TmMTw1b4Ggk5I74NxfOquF+ZFMbE1rzOZGkawx/YLBlWaxgDWH ung3VHAvHgzVhkOsZuEO3Fd5bwEmf1RW06l1zemW1ZTEH8nLjYKWy1/842xXcB/DJl0Q Gg+Q== X-Gm-Message-State: APzg51AGZr1rYX1NF43XfDQmXj6uSQ/3CbOFKlbKjE6s3cZw3c5l0XIR RPD0+bS+I9q/m0KGmJrH0TuLvbWtjmso7A== X-Google-Smtp-Source: ANB0VdagHrVEV1MWIKB2zyU/+KucFh+dsQX2iPlJ0/WEOCqBlxT6wdwZFcHXv8Z7cbryyxiMJhqDAQ== 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-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 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) */ 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 */ From patchwork Wed Aug 29 12:31:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10580143 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 6FFAA1709 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 611A72AF5A for ; Wed, 29 Aug 2018 12:31:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F4522AFC0; Wed, 29 Aug 2018 12:31:37 +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 B1E662B00C for ; Wed, 29 Aug 2018 12:31:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728145AbeH2Q2R (ORCPT ); Wed, 29 Aug 2018 12:28:17 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:40021 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728198AbeH2Q2Q (ORCPT ); Wed, 29 Aug 2018 12:28:16 -0400 Received: by mail-ed1-f65.google.com with SMTP id e19-v6so3784413edq.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=VNdJHFbN8KWM8+bNJqvSnzQsqXjKe+ArKerxXIjrkNo=; b=jnUTiIzL+0XmPYjd2iNtzXN9BNpdyvmD27midBzj4MWqXaUJ3oryowCPGMO76ZyGW0 A/cdREBjdubKacHCSDrbYFV+zU1Q4sEMiXIFoElcazCS3QuxOyWGb1sGYquCoaQ4RhJ4 Kxe+rvFC/z+u/ZDBtJK/NJAWXzGFHpNFJG2FuQ6U6kfqEbaOCD0o4afWH+G51qxsAx1X BldkytSFUb/BwQJqUOzJ/pTyAjUQcjLO1IpKYO9caqdmBzA9Gc4ETDkypOk+dcu4oU/W ttQy4C2RWekvsYR5am3gK3yYh9Ct9DupqKRWw/aButmMQHLqviIXDXIddtv6iqdqa2UF sU+Q== 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=VNdJHFbN8KWM8+bNJqvSnzQsqXjKe+ArKerxXIjrkNo=; b=GLC+LeiM1/8yHYk/R00+dVclrodqN3+JcN2T3n20aFU5T0ILcgLxUi4do+Uc9pUBD9 ch0VwC3tO8OZQ+smaaDvfdkxNEzl4qN1kGbO5SO9PeB7D692SVx/ZdNmTOEUPQrDct78 bddow0TRy1zqB3FITzNFHSubPgLERaNTNFKJyHtMRUeumBH28xVbInbGd+R7aw8CUszc eJlbmgdZHiqhYo1DNkjFwNs5lq9nuNmX8WA/xnGwnqHHWIwXQ35V38alPjUgqnHtHnoI nyr7UuXB1Np96NZRV0WbWYZLnRLjQXwiOWwVSWZZ2sXlWxoab5Az/5LqwPXnIy0nMAWc fNKw== X-Gm-Message-State: APzg51Cu6h0Tu8RD+O3bIZuAhGozxTe4arQiSB5LZ+/6G3zVgnijCZNQ E3DFNtCWhX2jJruwUBkioyYEDA== X-Google-Smtp-Source: ANB0VdYqwrrT9kfcdikgF6RReusNrdHB1Ddr3qTz4Zrrnrl14gD+obX9CpTt+LFLQHBfTmrb1rv0lA== X-Received: by 2002:a50:b53a:: with SMTP id y55-v6mr7539785edd.191.1535545893243; Wed, 29 Aug 2018 05:31:33 -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.32 (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 4/4] lightnvm: pblk: add tracing for chunk resets Date: Wed, 29 Aug 2018 14:31:17 +0200 Message-Id: <1535545877-770-5-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 Trace state of chunk resets. Signed-off-by: Hans Holmberg --- drivers/lightnvm/pblk-core.c | 12 ++++++++++++ drivers/lightnvm/pblk-trace.h | 31 +++++++++++++++++++++++++++++++ drivers/lightnvm/pblk.h | 6 ++++++ 3 files changed, 49 insertions(+) diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c index 566a5d3165ee..b874001d1175 100644 --- a/drivers/lightnvm/pblk-core.c +++ b/drivers/lightnvm/pblk-core.c @@ -90,9 +90,15 @@ static void __pblk_end_io_erase(struct pblk *pblk, struct nvm_rq *rqd) atomic_dec(&line->left_seblks); if (rqd->error) { + trace_pblk_chunk_reset(pblk_disk_name(pblk), + &rqd->ppa_addr, PBLK_CHUNK_RESET_FAILED); + chunk->state = NVM_CHK_ST_OFFLINE; pblk_mark_bb(pblk, line, rqd->ppa_addr); } else { + trace_pblk_chunk_reset(pblk_disk_name(pblk), + &rqd->ppa_addr, PBLK_CHUNK_RESET_DONE); + chunk->state = NVM_CHK_ST_FREE; } @@ -958,6 +964,9 @@ int pblk_line_erase(struct pblk *pblk, struct pblk_line *line) WARN_ON(test_and_set_bit(bit, line->erase_bitmap)); spin_unlock(&line->lock); + trace_pblk_chunk_reset(pblk_disk_name(pblk), + &ppa, PBLK_CHUNK_RESET_START); + ret = pblk_blk_erase_sync(pblk, ppa); if (ret) { pblk_err(pblk, "failed to erase line %d\n", line->id); @@ -1736,6 +1745,9 @@ int pblk_blk_erase_async(struct pblk *pblk, struct ppa_addr ppa) rqd->end_io = pblk_end_io_erase; rqd->private = pblk; + trace_pblk_chunk_reset(pblk_disk_name(pblk), + &ppa, PBLK_CHUNK_RESET_START); + /* The write thread schedules erases so that it minimizes disturbances * with writes. Thus, there is no need to take the LUN semaphore. */ diff --git a/drivers/lightnvm/pblk-trace.h b/drivers/lightnvm/pblk-trace.h index c171d0450c07..679e5c458ca6 100644 --- a/drivers/lightnvm/pblk-trace.h +++ b/drivers/lightnvm/pblk-trace.h @@ -31,6 +31,37 @@ struct ppa_addr; { PBLK_STATE_RECOVERING, "RECOVERING", }, \ { PBLK_STATE_STOPPED, "STOPPED" }) +#define show_chunk_erase_state(state) __print_symbolic(state, \ + { PBLK_CHUNK_RESET_START, "START", }, \ + { PBLK_CHUNK_RESET_DONE, "OK", }, \ + { PBLK_CHUNK_RESET_FAILED, "FAILED" }) + + +TRACE_EVENT(pblk_chunk_reset, + + TP_PROTO(const char *name, struct ppa_addr *ppa, int state), + + TP_ARGS(name, ppa, state), + + TP_STRUCT__entry( + __string(name, name) + __field(u64, ppa) + __field(int, state); + ), + + TP_fast_assign( + __assign_str(name, name); + __entry->ppa = ppa->ppa; + __entry->state = state; + ), + + TP_printk("dev=%s grp=%llu pu=%llu chk=%llu state=%s", __get_str(name), + (u64)(((struct ppa_addr *)(&__entry->ppa))->m.grp), + (u64)(((struct ppa_addr *)(&__entry->ppa))->m.pu), + (u64)(((struct ppa_addr *)(&__entry->ppa))->m.chk), + show_chunk_erase_state((int)__entry->state)) + +); TRACE_EVENT(pblk_chunk_state, diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h index ed17db2cae2c..6195e3f5d2e6 100644 --- a/drivers/lightnvm/pblk.h +++ b/drivers/lightnvm/pblk.h @@ -79,6 +79,12 @@ enum { PBLK_BLK_ST_CLOSED = 0x2, }; +enum { + PBLK_CHUNK_RESET_START, + PBLK_CHUNK_RESET_DONE, + PBLK_CHUNK_RESET_FAILED, +}; + struct pblk_sec_meta { u64 reserved; __le64 lba;