From patchwork Fri Mar 31 23:23:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9657341 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 22CF560350 for ; Fri, 31 Mar 2017 23:23:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13A5A286AE for ; Fri, 31 Mar 2017 23:23:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 07F4F286B4; Fri, 31 Mar 2017 23:23:28 +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 0BB7E286AE for ; Fri, 31 Mar 2017 23:23:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753986AbdCaXXY (ORCPT ); Fri, 31 Mar 2017 19:23:24 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:17559 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753724AbdCaXXX (ORCPT ); Fri, 31 Mar 2017 19:23:23 -0400 X-IronPort-AV: E=Sophos;i="5.35,258,1483977600"; d="scan'208";a="109696248" Received: from mail-sn1nam01lp0120.outbound.protection.outlook.com (HELO NAM01-SN1-obe.outbound.protection.outlook.com) ([207.46.163.120]) by ob1.hgst.iphmx.com with ESMTP; 01 Apr 2017 07:23:21 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=LsSfAOEaMSZp52X7zsvHBUXUjxaorovF9u6VL+ZU6dA=; b=VnudwM6QlJC+Va8lxgm4Ykee8YQtVkXVT1w10TqfjpL0gESyGB46gQJgpYTn4bzCtrhcwBVr6SGuAZR+21kBRLfP0/O5QSb5rpRwKpFWXpPk9uqav250oByG29ELrusBc0kRropD3K4ASe7mR8NMFfvxgyB02hiC1KwI0Odm1Gc= Received: from DM5PR04CA0040.namprd04.prod.outlook.com (10.171.152.154) by BY2PR04MB109.namprd04.prod.outlook.com (10.242.37.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1005.10; Fri, 31 Mar 2017 23:23:19 +0000 Received: from BN3NAM04FT018.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4e::207) by DM5PR04CA0040.outlook.office365.com (2603:10b6:3:12b::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1005.10 via Frontend Transport; Fri, 31 Mar 2017 23:23:18 +0000 Authentication-Results: spf=pass (sender IP is 74.221.232.54) smtp.mailfrom=sandisk.com; kernel.dk; dkim=none (message not signed) header.d=none;kernel.dk; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 74.221.232.54 as permitted sender) receiver=protection.outlook.com; client-ip=74.221.232.54; helo=sacsmgep14.sandisk.com; Received: from sacsmgep14.sandisk.com (74.221.232.54) by BN3NAM04FT018.mail.protection.outlook.com (10.152.92.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1005.5 via Frontend Transport; Fri, 31 Mar 2017 23:23:18 +0000 X-AuditID: ac1c2133-99bff7000000c960-f7-58dee4e2c096 Received: from SACHUBIP02.sdcorp.global.sandisk.com (Unknown_Domain [172.28.1.254]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id 3F.4B.51552.2E4EED85; Fri, 31 Mar 2017 16:23:17 -0700 (PDT) Received: from ULS-OP-MBXIP03.sdcorp.global.sandisk.com ([fe80::f9ec:1e1b:1439:62d8]) by SACHUBIP02.sdcorp.global.sandisk.com ([10.181.10.104]) with mapi id 14.03.0319.002; Fri, 31 Mar 2017 16:23:14 -0700 From: Bart Van Assche To: Bart Van Assche , Jens Axboe CC: "linux-block@vger.kernel.org" , Omar Sandoval , Hannes Reinecke Subject: [PATCH v4 1/2] blk-mq: Export queue state through /sys/kernel/debug/block/*/state Thread-Topic: [PATCH v4 1/2] blk-mq: Export queue state through /sys/kernel/debug/block/*/state Thread-Index: AdKqdcRUrEJRMJE9Tk22ViUSxJptpQ== Date: Fri, 31 Mar 2017 23:23:13 +0000 Message-ID: <1D08B61A9CF0974AA09887BE32D889DA1310F4@ULS-OP-MBXIP03.sdcorp.global.sandisk.com> References: <20170330182127.24288-1-bart.vanassche@sandisk.com> <20170330182127.24288-2-bart.vanassche@sandisk.com> Accept-Language: en-US, nl-NL Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.181.8.64] MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkkeLIzCtJLcpLzFFi42JZI8P4T/fpk3sRBvOe81usvtvPZrHgzV42 i723tC0O37vK4sDiMbH5HbvH5bOlHuu3XGXx+LxJLoAlissmJTUnsyy1SN8ugSuj9+lpxoLJ WhWt/VUNjHOVuxg5OSQETCR2LfjM2sXIxSEksIRJ4ti0bcwQziVGiVVvjzCBVLEJGEnMnrCH BcQWEfCTuP/iAVgHs0ATo8SfW+vZQBLCAjESSyf2MnYxcgAVJUq83+wDUa8nMWniYXYQm0VA VaJ1/RQwm1cgVuL6muNgtpBAqcTx9csYQWxGAVmJxdNbwPYyC4hL3HoynwniUgGJJXvOM0PY ohIvH/9jBVklISAvcf20HUS5jsSC3Z/YIGxtiWULXzNDrBKUODnzCcsERpFZSKbOQtIyC0nL LCQtCxhZVjGKFScmF+empxYYmugVJ+alZBZn6yXn525iBEeMovEOxn8b3A8xCnAwKvHwKvjd ixBiTSwrrsw9xCjBwawkwnvrHFCINyWxsiq1KD++qDQntfgQozQHi5I4b8zsqRFCAumJJanZ qakFqUUwWSYOTqkGxp7FIlHx7SxFXab2E/ZsM8tZ2lKb9nevt0/Ht0T5Cwpm20SeLrnCEh5u qcf76qs8Y81m7aP+0Svz1izaOvWgX0P2E/vYedlf2KZPOF6RlaudcnvK2koGqW0Hw37O9lQR U97w82Sj7aqwflEdB5YsPh6xry9rL329Zy/QM/lBSWpV9dwtCQnrlViKMxINtZiLihMBB+fl UpQCAAA= X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:74.221.232.54; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(39410400002)(39400400002)(39450400003)(39850400002)(39860400002)(39840400002)(2980300002)(438002)(189002)(199003)(9170700003)(6116002)(7696004)(47776003)(55016002)(23726003)(2920100001)(8746002)(8936002)(2900100001)(2906002)(54906002)(38730400002)(50466002)(8676002)(106466001)(102836003)(33656002)(4326008)(50986999)(86362001)(46406003)(356003)(7736002)(305945005)(55846006)(5660300001)(3846002)(76176999)(189998001)(81166006)(53936002)(97756001)(54356999); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR04MB109; H:sacsmgep14.sandisk.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN3NAM04FT018; 1:L+M7Sid4HSDrbfat9qsDU0uNqZjMaL8qTg7lJUhkd5hfPSxOGqmjotQWgwOhub9sTSokoFFGtc+PS77rJVxQjYjPiinjpsW55bOyWna7qWdZNGg7iZ4v1Av7P1dTYSgKype3DhQZoiew/QsrfcqNEJFEDL/Qn4N40zVYNZcMnHwh5mmy2F3rVpOdPQxsMAiJ4eDOUtAAUZL343SZrc9Y0k9YIEJWnilMuYrPRd7Z10WqA/yeav7kRdq+TJJc2dgWCbrNVguKb4fMLD0Dh0jpJmsy9MQ9vySTWp+Xu7hx4W2Kst+PqndVzdnMnFD9kJtGJUgqqeTqZ0cDvYVl0knPGdib00fbYtYz4AhmELwKtrbbPA6w8Itl6YJAa0x8RUAK3/VOKK1CA9ty+Zxs+WU/R45FfWj6LmpY2XNMRi+OI+unjHqNBJw+3KuoTEI6Qg6N1RnpfCGgbN3U2aiaTuaIKPkiXhmMe63kV1VwOAC37KPn1pRSRwyK2niWJdziTSDPMx0swl9jAvFRVUGsyQmMgyP8GUaEEkM3nOL0WcWhrnYRd4IMBYTLhvchNs8caZ/UFTF+pBinp+mahs8ib6hfAg== X-MS-Office365-Filtering-Correlation-Id: 720e29ec-8506-491c-e08d-08d4788cea20 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081)(201702281549075); SRVR:BY2PR04MB109; X-Microsoft-Exchange-Diagnostics: 1; BY2PR04MB109; 3:bLAFM6pLuLf+aINVqbpCypVkuxUfhXGi36WnhV4qxYK/J9skdGcnwiPI2Ah4+X++NLyjPF9N7H1RDIHDL7Ay5nn5Aq/DYMrSTMeCFSa72LcGDrpYNqz0oNnT1A26/SrGE9f49Q152pYWyYhhswH+N1qQrq5NpN2lLrgSEmTahUXglrt9EK4JZ/jLv79SechNNHocOO5NQGwSg4wN8tlxJqGPC6YkmONuV9Sjd2Vmx6GpFm0cMUKM0kkGw4wx4//ao+ExlwSUBT4B7JT9jGuJPhAKGLVY85lSOBctVYk+mJremc4Ov4JpO4Y389NQGLg7wGkQHcxmhzp6xa697gocOly0EwQgBvI8nkqulO3A7XYxXyA0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LtXHX57EFxBqPfLgexqX9UUouWkgzI1NvJ26TEc0oWoE/sg2U+35FXbrib3anRkMVQYIgpa36zHW/JLMhNrQNNnwSmT+t4ri2LJCxeU0FJgJvLf8LBBILhlLmP381AH34+j4Pa3lqDdGqiFTZXEMbFQ7mPVh4gxSdQEMUmnKTiOhtaiZpT8FEUN+jA0zoeraujvFYt0qXtKjSb7y0TIlXyxRy/5yJ0vrxnlEjLkE9+SKxXc2C3aAUiBHEmas1DXodSltgMHLSUTDbkD6/2HZ2WxQXEF7xfTKkO/nqfifo+vQab3zozEPxSXdjqx01dyp/E1oaMzk8vgowaduk1YxSg0k1bbS3+58TYBq8JdnhV7LUz/EKX/2EAHSlGNR7ccRQnPtiyQ0SE9usTMa1l0pLN+w+c12i2Rdjh6OmMeGkKUuR5lJiaxLM0CKKWcxsC2Fx82rm7OEsOVkChaL/uVwD X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(13018025)(13023025)(5005006)(13024025)(8121501046)(13016025)(93006095)(93004095)(10201501046)(3002001)(6055026)(6041248)(20161123560025)(20161123562025)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(6072148); SRVR:BY2PR04MB109; BCL:0; PCL:0; RULEID:; SRVR:BY2PR04MB109; X-Microsoft-Exchange-Diagnostics: 1; BY2PR04MB109; 4:RMxyjnmMlXGFRGn7DgCfyxkQUdfF5sDi+AnUhesuAoudYXD2ybIKd2lrNbw1+gqZOS3+q7CXYD7RNZJnQN2SuO8XfENTbDRi0Xl9w3LNx60tn8eK4W4se7sEL7LQgepvhkn0+/FUEUMXMYR3v4XNQOEFWsys34BmBSZCoj9t2JevkkzB9mz0ssT9Ilux+7hH30BKJNm9scKRjHvmsaNr9wSZlh/k9/07xrYWA1Mj5dqefL36efnGh2BOukUzHDd9PZPplmz1FNZzXeL9QzPURj/vkTB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WslUoGUwrX0ZcPmUtKSkvp0++iaYA==; 20:v6dQk3gJ2e94NOCazKmNtHyUYj9/M7OxZyZJW/+rffO5mm7TNmWtJOxMmhv0lrbix2Me+vx8gwJBVmmt3vVzcQ3GrqqlRpP5AxJb/lmGDqdRfodSIiJzL3XtRcxWUyvZksfzR+9daeFePpqBHtbqs6VlShEDLlW+fzAA2ZMTCNw= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2017 23:23:18.0328 (UTC) X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=b61c8803-16f3-4c35-9b17-6f65f441df86; Ip=[74.221.232.54]; Helo=[sacsmgep14.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR04MB109 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 Make it possible to check whether or not a block layer queue has been stopped. Make it possible to start and to run a blk-mq queue from user space. Signed-off-by: Bart Van Assche Cc: Omar Sandoval Cc: Hannes Reinecke Reviewed-by: Hannes Reinecke --- Changes compared to v3: - Return -ENOENT for attempts to run or start a queue after it has reached the state "dead". This is needed to avoid a use-after-free and potentially a kernel crash. --- block/blk-mq-debugfs.c | 114 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index 4b3f962a9c7a..bd3afa4e1602 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -43,6 +43,117 @@ static int blk_mq_debugfs_seq_open(struct inode *inode, struct file *file, return ret; } +static int blk_flags_show(struct seq_file *m, const unsigned long flags, + const char *const *flag_name, int flag_name_count) +{ + bool sep = false; + int i; + + for (i = 0; i < sizeof(flags) * BITS_PER_BYTE; i++) { + if (!(flags & BIT(i))) + continue; + if (sep) + seq_puts(m, " "); + sep = true; + if (i < flag_name_count && flag_name[i]) + seq_puts(m, flag_name[i]); + else + seq_printf(m, "%d", i); + } + seq_puts(m, "\n"); + return 0; +} + +static const char *const blk_queue_flag_name[] = { + [QUEUE_FLAG_QUEUED] = "QUEUED", + [QUEUE_FLAG_STOPPED] = "STOPPED", + [QUEUE_FLAG_SYNCFULL] = "SYNCFULL", + [QUEUE_FLAG_ASYNCFULL] = "ASYNCFULL", + [QUEUE_FLAG_DYING] = "DYING", + [QUEUE_FLAG_BYPASS] = "BYPASS", + [QUEUE_FLAG_BIDI] = "BIDI", + [QUEUE_FLAG_NOMERGES] = "NOMERGES", + [QUEUE_FLAG_SAME_COMP] = "SAME_COMP", + [QUEUE_FLAG_FAIL_IO] = "FAIL_IO", + [QUEUE_FLAG_STACKABLE] = "STACKABLE", + [QUEUE_FLAG_NONROT] = "NONROT", + [QUEUE_FLAG_IO_STAT] = "IO_STAT", + [QUEUE_FLAG_DISCARD] = "DISCARD", + [QUEUE_FLAG_NOXMERGES] = "NOXMERGES", + [QUEUE_FLAG_ADD_RANDOM] = "ADD_RANDOM", + [QUEUE_FLAG_SECERASE] = "SECERASE", + [QUEUE_FLAG_SAME_FORCE] = "SAME_FORCE", + [QUEUE_FLAG_DEAD] = "DEAD", + [QUEUE_FLAG_INIT_DONE] = "INIT_DONE", + [QUEUE_FLAG_NO_SG_MERGE] = "NO_SG_MERGE", + [QUEUE_FLAG_POLL] = "POLL", + [QUEUE_FLAG_WC] = "WC", + [QUEUE_FLAG_FUA] = "FUA", + [QUEUE_FLAG_FLUSH_NQ] = "FLUSH_NQ", + [QUEUE_FLAG_DAX] = "DAX", + [QUEUE_FLAG_STATS] = "STATS", + [QUEUE_FLAG_POLL_STATS] = "POLL_STATS", + [QUEUE_FLAG_REGISTERED] = "REGISTERED", +}; + +static int blk_queue_flags_show(struct seq_file *m, void *v) +{ + struct request_queue *q = m->private; + + blk_flags_show(m, q->queue_flags, blk_queue_flag_name, + ARRAY_SIZE(blk_queue_flag_name)); + return 0; +} + +static ssize_t blk_queue_flags_store(struct file *file, const char __user *ubuf, + size_t len, loff_t *offp) +{ + struct request_queue *q = file_inode(file)->i_private; + char op[16] = { }, *s; + + /* + * The debugfs attributes are removed after blk_cleanup_queue() has + * called blk_mq_free_queue(). Return if QUEUE_FLAG_DEAD has been set + * to avoid triggering a use-after-free. + */ + if (blk_queue_dead(q)) + return -ENOENT; + + len = min(len, sizeof(op) - 1); + if (copy_from_user(op, ubuf, len)) + return -EFAULT; + s = op; + strsep(&s, " \t\n"); /* strip trailing whitespace */ + if (strcmp(op, "run") == 0) { + blk_mq_run_hw_queues(q, true); + } else if (strcmp(op, "start") == 0) { + blk_mq_start_stopped_hw_queues(q, true); + } else { + pr_err("%s: unsupported operation %s. Use either 'run' or 'start'\n", + __func__, op); + return -EINVAL; + } + return len; +} + +static int blk_queue_flags_open(struct inode *inode, struct file *file) +{ + return single_open(file, blk_queue_flags_show, inode->i_private); +} + +static const struct file_operations blk_queue_flags_fops = { + .open = blk_queue_flags_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, + .write = blk_queue_flags_store, +}; + +static const struct blk_mq_debugfs_attr blk_queue_attrs[] = { + {"state", 0600, &blk_queue_flags_fops}, + {}, +}; + static void print_stat(struct seq_file *m, struct blk_rq_stat *stat) { if (stat->nr_samples) { @@ -735,6 +846,9 @@ int blk_mq_debugfs_register_hctxs(struct request_queue *q) if (!q->debugfs_dir) return -ENOENT; + if (!debugfs_create_files(q->debugfs_dir, q, blk_queue_attrs)) + goto err; + q->mq_debugfs_dir = debugfs_create_dir("mq", q->debugfs_dir); if (!q->mq_debugfs_dir) goto err;