From patchwork Wed Mar 1 18:42:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 9599101 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4443C600CB for ; Wed, 1 Mar 2017 20:24:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D5EC283C9 for ; Wed, 1 Mar 2017 20:24:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E77928541; Wed, 1 Mar 2017 20:24:44 +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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 9B49F283C9 for ; Wed, 1 Mar 2017 20:24:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751154AbdCAUYn (ORCPT ); Wed, 1 Mar 2017 15:24:43 -0500 Received: from mail-pg0-f44.google.com ([74.125.83.44]:33981 "EHLO mail-pg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751106AbdCAUYm (ORCPT ); Wed, 1 Mar 2017 15:24:42 -0500 Received: by mail-pg0-f44.google.com with SMTP id p5so23736115pga.1 for ; Wed, 01 Mar 2017 12:24:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=15noq3MDeZsKalbUgc9gGGgcBkEXBZM7FsEp9IRcXNk=; b=u64UuJ4DrM6QgENMqKNPTP5jcLNokANuGOjkZb7D/tVRDLuuF4MZy+2Q06Q2zrWcyc im/G38xhAWu3TUm4fyPwv8Nwo+kXFIbT3zHHdCDnsS2ZD1WIVZJkBchfZiFdHJ5uPdNJ kWk09FvB4oaYc3ogEviEYGk4rQJQDxt8xZoFw64xgjQXUDZes4mKMPdCX06dOY4mwhn4 3w4lVEzmrpUelPVVw6Nc6yh6mWnyRvPQhFPutLqEl+UfX8a3yTie8XPLB5tYzwk0Bhw5 UOAB2Cd5i+o8Me3koWU/ep3Nj6XApLPsZlMaeoM0BHw8uUfmFR8QwwiFMu8lJ3jXZmc2 uX0g== 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:in-reply-to:references; bh=15noq3MDeZsKalbUgc9gGGgcBkEXBZM7FsEp9IRcXNk=; b=UjckcFdOfqaoEN/lra5zW/rkYV0nSxTRH7LJ7oha30LQIg6f33/hhkB6m+UPvnpcIO +jL77fEVTL22JSjJ5k0/VVgC1q9Hh5MUYg83Qddnb/tXMrd0fS9GSU9et2t3Qf2yZ1G7 ArhiPWkMiMfazhan12EaUZfF168sCuH/J2xqzVlDyY7UnmxyvRqZEUL8FQJzAhaAMIhC 5E2iiY7fCzGI5qMeMwUQRH5LLXYHIISX9eUdtTCXGpJtGTjp/8BJBvs5H1N6BFphFAFj hbWGglUm0vFJcQQ/TPvLwkhOBc3N/3K8BIvhIXHOKseb9MEPNyJ8PI+Q1dsAomIzUafU g70g== X-Gm-Message-State: AMke39nr4XCVFDD7jY3apTkEgQ233LbZJYZLbRkketVnvc1DGMjKeVpKRU5GhHF14yL9AYPY X-Received: by 10.84.212.8 with SMTP id d8mr12289640pli.152.1488393816256; Wed, 01 Mar 2017 10:43:36 -0800 (PST) Received: from vader.thefacebook.com ([2620:10d:c090:200::e:9abf]) by smtp.gmail.com with ESMTPSA id y6sm12128242pgc.1.2017.03.01.10.43.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Mar 2017 10:43:35 -0800 (PST) From: Omar Sandoval To: Jens Axboe , linux-block@vger.kernel.org Cc: kernel-team@fb.com Subject: [PATCH 2/2] blk-mq-debugfs: add q->mq_freeze_depth output Date: Wed, 1 Mar 2017 10:42:39 -0800 Message-Id: X-Mailer: git-send-email 2.12.0 In-Reply-To: <7e888cad9e6c35835559281d3ab9e05ea48836d0.1488393750.git.osandov@fb.com> References: <7e888cad9e6c35835559281d3ab9e05ea48836d0.1488393750.git.osandov@fb.com> In-Reply-To: <7e888cad9e6c35835559281d3ab9e05ea48836d0.1488393750.git.osandov@fb.com> References: <7e888cad9e6c35835559281d3ab9e05ea48836d0.1488393750.git.osandov@fb.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: Omar Sandoval This can be used to diagnose freeze-related hangs. Signed-off-by: Omar Sandoval --- block/blk-mq-debugfs.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index f6d917977b33..1459546788da 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -29,6 +29,26 @@ struct blk_mq_debugfs_attr { const struct file_operations *fops; }; +static int queue_freeze_depth_show(struct seq_file *m, void *v) +{ + struct request_queue *q = m->private; + + seq_printf(m, "%d\n", atomic_read(&q->mq_freeze_depth)); + return 0; +} + +static int queue_freeze_depth_open(struct inode *inode, struct file *file) +{ + return single_open(file, queue_freeze_depth_show, inode->i_private); +} + +static const struct file_operations queue_freeze_depth_fops = { + .open = queue_freeze_depth_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + static int blk_mq_debugfs_seq_open(struct inode *inode, struct file *file, const struct seq_operations *ops) { @@ -636,6 +656,11 @@ static const struct file_operations ctx_completed_fops = { .release = single_release, }; +static const struct blk_mq_debugfs_attr blk_mq_debugfs_queue_attrs[] = { + {"freeze_depth", 0400, &queue_freeze_depth_fops}, + {}, +}; + static const struct blk_mq_debugfs_attr blk_mq_debugfs_hctx_attrs[] = { {"state", 0400, &hctx_state_fops}, {"flags", 0400, &hctx_flags_fops}, @@ -753,6 +778,9 @@ int blk_mq_debugfs_register_hctxs(struct request_queue *q) if (!q->mq_debugfs_dir) goto err; + if (!debugfs_create_files(q->mq_debugfs_dir, q, blk_mq_debugfs_queue_attrs)) + return -ENOMEM; + queue_for_each_hw_ctx(q, hctx, i) { if (blk_mq_debugfs_register_hctx(q, hctx)) goto err;