From patchwork Tue Jan 24 15:54:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 9535463 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 3D75F60434 for ; Tue, 24 Jan 2017 15:54:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3015A28111 for ; Tue, 24 Jan 2017 15:54:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 24A5728210; Tue, 24 Jan 2017 15:54:54 +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, RCVD_IN_DNSWL_HI, T_TVD_MIME_EPI 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 00C3C28111 for ; Tue, 24 Jan 2017 15:54:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750975AbdAXPyv (ORCPT ); Tue, 24 Jan 2017 10:54:51 -0500 Received: from mx2.suse.de ([195.135.220.15]:33497 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750986AbdAXPyt (ORCPT ); Tue, 24 Jan 2017 10:54:49 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3F346AC57; Tue, 24 Jan 2017 15:54:47 +0000 (UTC) To: Jens Axboe Cc: "linux-block@vger.kernel.org" , Omar Sandoval From: Hannes Reinecke Subject: [PATCH] queue stall with blk-mq-sched Message-ID: Date: Tue, 24 Jan 2017 16:54:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 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 Hi Jens, I'm trying to debug a queue stall with your blk-mq-sched branch; with my latest mpt3sas patches fio stops basically directly after starting a sequential read :-( I've debugged things and came up with the attached patch; we need to restart waiters with blk_mq_tag_idle() after completing a tag. We're already calling blk_mq_tag_busy() when fetching a tag, so I think calling blk_mq_tag_idle() is required when retiring a tag. However, even with the attached patch I'm seeing some queue stalls; looks like they're related to the 'stonewall' statement in fio. Debugging continues. Cheers, Hannes From 82b15ff40d71aed318f9946881825f9f03ef8f48 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Tue, 24 Jan 2017 14:43:09 +0100 Subject: [PATCH] block-mq: fixup queue stall __blk_mq_alloc_request() calls blk_mq_tag_busy(), which might result in the queue to become blocked. So we need to call blk_mq_tag_idle() once the tag is finished to wakeup all waiters on the queue. Patch is relative to the blk-mq-sched branch Signed-off-by: Hannes Reinecke --- block/blk-mq.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 739a292..d52bcb1 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -333,10 +333,12 @@ void __blk_mq_finish_request(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx, { const int sched_tag = rq->internal_tag; struct request_queue *q = rq->q; + bool unbusy = false; - if (rq->rq_flags & RQF_MQ_INFLIGHT) + if (rq->rq_flags & RQF_MQ_INFLIGHT) { atomic_dec(&hctx->nr_active); - + unbusy = true; + } wbt_done(q->rq_wb, &rq->issue_stat); rq->rq_flags = 0; @@ -346,6 +348,9 @@ void __blk_mq_finish_request(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx, blk_mq_put_tag(hctx, hctx->tags, ctx, rq->tag); if (sched_tag != -1) blk_mq_sched_completed_request(hctx, rq); + if (unbusy) + blk_mq_tag_idle(hctx); + blk_queue_exit(q); } -- 1.8.5.6