From patchwork Tue Oct 9 11:11:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10632309 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 A188215E8 for ; Tue, 9 Oct 2018 11:16:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8192A28A45 for ; Tue, 9 Oct 2018 11:16:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73F9F28A6F; Tue, 9 Oct 2018 11:16:45 +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 08E7728A45 for ; Tue, 9 Oct 2018 11:16:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726600AbeJISbE (ORCPT ); Tue, 9 Oct 2018 14:31:04 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:46451 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727715AbeJISbE (ORCPT ); Tue, 9 Oct 2018 14:31:04 -0400 Received: by mail-pl1-f193.google.com with SMTP id v5-v6so655914plz.13 for ; Tue, 09 Oct 2018 04:14:38 -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=J6AOKCcdZpaPo0z9TI+wgv9/xXbJhuIRYvEcLNzLWcQ=; b=S0x1skEkmPmRvQQ46ETuDp5tREJkyqNP1wceS99o8XPS8Y+Ndb+I8pFU4r5QstcKz3 oXpaFzbz2DGIYb2MTm+EzhJ5g47MpoWuEMWii59ilnC0csGe2GpyRoIxM1cj0dD6n17s XgL//4hR8qvwLn/3bW08Jo8YuxhpVQaGY8OMFLor8flYUcVALA2ZPjLlzBLqJ9bLs0RM pUQ19rPSdL2anRSdjo6yxhZp87Bp82G/mMmW8Mz2JOQOns6KgaeQkVKs+PKSuP90Scxq 5mwcsDgmrofep5S+sk4rZikIUkHe7t/u9BNrMx6hTkEsIqoSfHDg6rUd1jTLBmqf6Twa eZ5A== 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=J6AOKCcdZpaPo0z9TI+wgv9/xXbJhuIRYvEcLNzLWcQ=; b=IHmrtV0wVEIduR4GD+kgdms9TsgggX6b+ZnQQII+LM0TE2Draz1XfvVVZhSWs1eL9z TVVT0c+wIRdvrn7JD+yN7HXGfDbnUtNNXg4pO5mPcxDI6ch06x3kuNWJNln26ffkIJFb 92TKMvdfteV1AUFjslXWQHMnjNjehihIAmTMeb/17Fs3EE7HiShqlnRmWIKNth4mIaLO HLFkCbtGs4hAk/o83Xz29Ju35QD0h/ZoeZKaUTm1edKE7929GZOaW+YSP6qJdQcGQLFz r1ix6zv7XLfNLt0zLuv00N2gHq//L6wcaYNEX6/qB2IAgxyGRirNlN3UZDFBVeoBkKlP 5v4Q== X-Gm-Message-State: ABuFfojyXnHVwrsBD2pvtlSt/hfNJRoCgoyYtxUovDpRZmDNhyigoKmi 8psg1eTaHTPuyk3N2GxZDzgsHQ== X-Google-Smtp-Source: ACcGV63umZj/88hh5yFJ8sWkRKVHpVwcg65cD8yJJL+qTg5rlGBSNkOCp3u2uqUDRreXdR8u1Ws+9w== X-Received: by 2002:a17:902:6bc2:: with SMTP id m2-v6mr28211735plt.133.1539083677680; Tue, 09 Oct 2018 04:14:37 -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.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Oct 2018 04:14:36 -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 25/45] lightnvm: pblk: add tracing for chunk resets Date: Tue, 9 Oct 2018 13:11:55 +0200 Message-Id: <20181009111215.7653-26-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 Trace state of chunk resets. Signed-off-by: Hans Holmberg Signed-off-by: Matias Bjørling --- 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 c482ef7dd4b5..84f3b4912b92 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 b2746099ca1d..7f4e46dfb0d7 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;