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;