Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2386436imm; Tue, 4 Sep 2018 03:40:34 -0700 (PDT) X-Google-Smtp-Source: ANB0VdajkJjG9DOvl6InAmQWt4bvcOXRlpvZM5MC7Ac57gOGCnKWHkVB80df77DeXUMxk8k/ffgH X-Received: by 2002:a17:902:e281:: with SMTP id cf1-v6mr33003858plb.86.1536057634586; Tue, 04 Sep 2018 03:40:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536057634; cv=none; d=google.com; s=arc-20160816; b=K0h6esw+ad0L8Mlbv8iS3XVtnGa6ys5aJha3yLvmvuqnTCFWMn5Ly8CKzianr1M5+z 0mH8MIOvM1l1shMsmpKZzc7hqsNJsBWo6o9L9fn1/M5xfhIcLCoVrCqXrxrOZPU3OrEl nkbdskSVuxab2kZwaEo9PJQK7pWbFQznz4hpvK/48bf025cVjlXno4d/q3RwAtn+gU7T sZiNLjfhAxSDBTFCQFn7uy8U3VpdVvP1egXsObKt8Z+IpnE77sK6hZDd4m8jyQiBH/zZ avhmAgMEQa0vt3T4zCqlPtag4FIcfrrZaN5yx0uSMgRtR0evfjtvv2IEWOXZJyNjEi+9 tY2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=nkPWbB/x39SeFKAOOwNX9ozIb3TYZsz2f/YKTTP2pnQ=; b=jeCI6FpMeDPuocEpWCU+2u/FWxCN5qn9hm3DGYFXakjAxXzKTz0YrBLCATwK0mSbLm Rr/i07UxBciRwP2aq2F25gm95OYPhZYNq0q0fpD3sxxgxp9ZxYLpBNIjwT4PIbvOpbUH mqBM2BIO1L8UtgQ4K5kZym5PROt/TUXblv2FnokHWeeJCtW6Gtj7kgwYOPrcTvGfSJeM I/7qKjGPQTDU+4b1Nk70R9bInVpnteBBoTL6Cxp5J3XIfJGu5d2qlGN5vc4/mM4/4y94 MJgH3Udkb0Q9Hv/TevQ4gqTBSJiO9xb8yWuPFO+RNOyt21I1fZhPEpBh/fbddAYNluVL TU4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@owltronix-com.20150623.gappssmtp.com header.s=20150623 header.b=NHZV9x4H; 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 v6-v6si21202811pgj.463.2018.09.04.03.40.18; Tue, 04 Sep 2018 03:40:34 -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=NHZV9x4H; 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 S1727235AbeIDPCt (ORCPT + 99 others); Tue, 4 Sep 2018 11:02:49 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:43811 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726066AbeIDPCt (ORCPT ); Tue, 4 Sep 2018 11:02:49 -0400 Received: by mail-ed1-f66.google.com with SMTP id z27-v6so2830786edb.10 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=AxMojQRaEjMNAhhaAuzgG9GSCfCDEHGXmdVlQYygI304vhiV51SZF7N/x2qY+l54n2 vRIpOo01d2P/G+pf32XBPT494bF+G6Y4A9r1vphrPCb+qhw7XjGYCdX1KKJVRzJ74rMx IBiulCOFVqUe3f0XHVIGFsUZLjzzpvpcJr1yIx5KOL7pAdpDPwTJZKVsl4VUC+J8GRaE 75emlbMrLMj5B99VKgOQgknc0FvOzpcOzObSpYcHKhvx7nWWFJY/KSfvmqLqWiD8EHVS b9+puNo2XoOuFLWED1njwcupzB8scLyKMQ+Fx0EArFJ3X6yWRtgJiXu0SD/UdfvNrzQx ot8w== X-Gm-Message-State: APzg51B7bJAFQDGpBOZQVZGnaBbL8Px4+R4YGz7qsQZ5g+akdCQACgXu 7UaAOOs2gaEFunf52/L9ZPNvxrH0zjwAXQ== 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.7.4