Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2495092imm; Mon, 24 Sep 2018 05:27:25 -0700 (PDT) X-Google-Smtp-Source: ACcGV63axwhUQ63M/QuFPlYBxACAhqS3bxxTzxMOeW9LAmZCq6jCGvEGmwqhZsUWPXP2sXSyRgiZ X-Received: by 2002:a65:6102:: with SMTP id z2-v6mr9388388pgu.46.1537792045558; Mon, 24 Sep 2018 05:27:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537792045; cv=none; d=google.com; s=arc-20160816; b=D/a99ZO7DkJxh4cQgBRRbFLBbIULKqpG2C5kVXwJyYc/QPmxZkLa9igwnwDk+G+HG3 HRr1MRiJ6uRaAMSLyGZ//KzEu96YkKKKhrIuzJ6JpAISdvNHgKsW9l65xxms3kSyDet0 VYoojtQfcqwfFfRqSxcScA1NVpbm3V0lDmkxxOQwDFVSF64JK3J9gm+AtUdb6uY+3QQC LWOeHDKoasj7f2OAg4qVc76bMvbJZujKnOQpMG/fpN3gTcsvU3nQfWKuzb14ub133QOq dfcWyRG9GtQQjH8fKprxrybgaw3ETP2ChogcQYxoR26uRRhWicANsvkKHCEOfRJYGiH1 F3Yw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=hGa4GrZCBs7lNLYiHyM9GB28pFXSpXWBjBgHPe7iA1c=; b=ZXxyV0MPEPVBO4NY1X2iWrnSb8HpgeYUPweSbfQIi+P8iRF++wNJ3NQa4N7LRmQoA/ 94+ZjQWwZpcf4S2OxznfoHTsVadwI0l8E6vR1Df2slYIGnaCQHd866aYGOhg5NrT8HT6 6N61SGbmFQaIKW2gCwV13WfdFmkbFMMMsXni/lFRb4+agx91bQ98ty9le/ORsVcNuhya 58LsddtcSzzm/fSiR4sRq4It6BJsUv1g9wEnob6daUPjD//TJs9/JjRSY3RHvlXDXbX+ eguDJvHJzuEcIEoOgD8qoxDe+FPkEB4omRkpJRsIV57bRkvrzMHAnTrH1OPk08q2Pnes re3g== ARC-Authentication-Results: i=1; mx.google.com; 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 s25-v6si34928580pgd.539.2018.09.24.05.27.10; Mon, 24 Sep 2018 05:27:25 -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; 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 S1732865AbeIXS0t (ORCPT + 99 others); Mon, 24 Sep 2018 14:26:49 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56894 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732326AbeIXS0t (ORCPT ); Mon, 24 Sep 2018 14:26:49 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id AFC031094; Mon, 24 Sep 2018 12:24:55 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Jones , Omar Sandoval , Bart Van Assche , linux-scsi@vger.kernel.org, "Martin K. Petersen" , Christoph Hellwig , Ming Lei , Jens Axboe , Sasha Levin Subject: [PATCH 4.14 155/173] blk-mq: avoid to synchronize rcu inside blk_cleanup_queue() Date: Mon, 24 Sep 2018 13:53:09 +0200 Message-Id: <20180924113126.670088676@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113114.334025954@linuxfoundation.org> References: <20180924113114.334025954@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ming Lei [ Upstream commit 1311326cf4755c7ffefd20f576144ecf46d9906b ] SCSI probing may synchronously create and destroy a lot of request_queues for non-existent devices. Any synchronize_rcu() in queue creation or destroy path may introduce long latency during booting, see detailed description in comment of blk_register_queue(). This patch removes one synchronize_rcu() inside blk_cleanup_queue() for this case, commit c2856ae2f315d75(blk-mq: quiesce queue before freeing queue) needs synchronize_rcu() for implementing blk_mq_quiesce_queue(), but when queue isn't initialized, it isn't necessary to do that since only pass-through requests are involved, no original issue in scsi_execute() at all. Without this patch and previous one, it may take more 20+ seconds for virtio-scsi to complete disk probe. With the two patches, the time becomes less than 100ms. Fixes: c2856ae2f315d75 ("blk-mq: quiesce queue before freeing queue") Reported-by: Andrew Jones Cc: Omar Sandoval Cc: Bart Van Assche Cc: linux-scsi@vger.kernel.org Cc: "Martin K. Petersen" Cc: Christoph Hellwig Tested-by: Andrew Jones Signed-off-by: Ming Lei Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- block/blk-core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/block/blk-core.c +++ b/block/blk-core.c @@ -669,9 +669,13 @@ void blk_cleanup_queue(struct request_qu * make sure all in-progress dispatch are completed because * blk_freeze_queue() can only complete all requests, and * dispatch may still be in-progress since we dispatch requests - * from more than one contexts + * from more than one contexts. + * + * No need to quiesce queue if it isn't initialized yet since + * blk_freeze_queue() should be enough for cases of passthrough + * request. */ - if (q->mq_ops) + if (q->mq_ops && blk_queue_init_done(q)) blk_mq_quiesce_queue(q); /* for synchronous bio-based driver finish in-flight integrity i/o */