From patchwork Tue Sep 4 10:38:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10587043 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 2195214BD for ; Tue, 4 Sep 2018 10:38:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DCC429141 for ; Tue, 4 Sep 2018 10:38:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00B1F29175; Tue, 4 Sep 2018 10:38:34 +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 7D07A29141 for ; Tue, 4 Sep 2018 10:38:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727196AbeIDPCt (ORCPT ); Tue, 4 Sep 2018 11:02:49 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:33079 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727104AbeIDPCt (ORCPT ); Tue, 4 Sep 2018 11:02:49 -0400 Received: by mail-ed1-f67.google.com with SMTP id d8-v6so2871009edv.0 for ; Tue, 04 Sep 2018 03:38:17 -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:mime-version :content-transfer-encoding; bh=nkPWbB/x39SeFKAOOwNX9ozIb3TYZsz2f/YKTTP2pnQ=; b=NHZV9x4HYh4ZF53rpOdDBQAtFepPYQwLmWSbBOFM4vxX2gs5GlQoJzlTwVL9/0+QH0 5LUEOH0YcmPJ6kqmdLhEkaA2vYi6NaJIYvjcsnKZGaeR80TlYgZF76z3MgRtkG1GDDvE A8eQcXgOahLpYDB0Ar5kjWZ1FAZNDcAjFUkNU2wnVwjIPOLJmF8Ckj90MkrMw9gUrRD+ EaoylFwHoOcULITWJxthuZgxO0AFE6jW7o9As/GOxOenMECc98WWhUeYzEWpkj4Lbldi CVP3IoGX5g+YP4q1FkpNUJdkyS4V7yEJ0xUtXzC4qW2j15/Wvpcuw0neVzu7GxySC3qS MC1A== 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:mime-version :content-transfer-encoding; bh=nkPWbB/x39SeFKAOOwNX9ozIb3TYZsz2f/YKTTP2pnQ=; b=QyzYkYLHdhxjiehmUc3qxvDSGkuzIv1zmZG2ZpmSUnWlBohNi0vgaySx+SDYyG6kOM WQlLFSqanqrz3ogxbxsa0nL6vSvuHVtxuuxd1XYwokpkIsKZOJ1HCRtnPx6ZUHOY5C9s HlX3ol8aga07kwm+Zp2DkbJoOaMEy1Y9XCucqM0o5p9idU4isEpr64acB9z0lKaFPaIi ytHW+yFT1x9gXXBkiez6ZwawW+BbpQUlsQiRntiya8dSXxKTWwHgdEzYVupVoTgINLUR dbhPR86p5FIOQtw74QJtiZqmZq8zzlU7uwg1ULQg9YASszcQux2Hf9pmPWdgvUOJsygp 2wFQ== X-Gm-Message-State: APzg51Bpds9JA3LUULcJG7pdJYOW7ZFMMwmfJMsxyfi17hpMa9/lPhiB 42ob52XStYCxfOrxP8HhZis9ZA== X-Google-Smtp-Source: ANB0VdaL9FOYj9TJyGUqMEp9KT/jdzh1IcOOneVJFcR/YdojLlMZxEwEqzIDXCpSj0S4i8DGw/mUgw== X-Received: by 2002:a50:fa8b:: with SMTP id w11-v6mr13257908edr.59.1536057497063; Tue, 04 Sep 2018 03:38:17 -0700 (PDT) Received: from titan.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id b44-v6sm11803477edd.93.2018.09.04.03.38.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Sep 2018 03:38:16 -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 V2] lightnvm: pblk: add tracing for chunk resets Date: Tue, 4 Sep 2018 12:38:05 +0200 Message-Id: <1536057487-17267-1-git-send-email-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.7.4 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 Trace state of chunk resets. Signed-off-by: Hans Holmberg Signed-off-by: Matias Bjørling --- You already picked up the first version of this patch Matias, but here's a V2 adressing the review comment from Javier that came after that. Changes in V2: Moved the synchronous PBLK_CHUNK_RESET_START trace to pblk_blk_erase_sync (as Javier suggested) 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 73f117bc99a9..951f81a1b273 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; } @@ -923,6 +929,9 @@ static int pblk_blk_erase_sync(struct pblk *pblk, struct ppa_addr ppa) struct nvm_rq rqd = {NULL}; int ret; + trace_pblk_chunk_reset(pblk_disk_name(pblk), &ppa, + PBLK_CHUNK_RESET_START); + pblk_setup_e_rq(pblk, &rqd, ppa); /* The write thread schedules erases so that it minimizes disturbances @@ -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 ae705fb52cf7..f0fcd963ab3a 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;