Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751671AbdG0Q0f (ORCPT ); Thu, 27 Jul 2017 12:26:35 -0400 Received: from mail-it0-f51.google.com ([209.85.214.51]:36794 "EHLO mail-it0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751638AbdG0Q0c (ORCPT ); Thu, 27 Jul 2017 12:26:32 -0400 Subject: Re: blk_mq_sched_insert_request: inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage To: Bart Van Assche , "mpe@ellerman.id.au" Cc: "linuxppc-dev@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" References: <87a83qfosu.fsf@concordia.ellerman.id.au> <073ed79c-11ce-e86c-a905-91fd28675d47@kernel.dk> <1501166846.2516.1.camel@wdc.com> From: Jens Axboe Message-ID: <5b85a365-faa1-3987-9b6b-270399c30686@kernel.dk> Date: Thu, 27 Jul 2017 10:26:29 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1501166846.2516.1.camel@wdc.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1588 Lines: 43 On 07/27/2017 08:47 AM, Bart Van Assche wrote: > On Thu, 2017-07-27 at 08:02 -0600, Jens Axboe wrote: >> The bug looks like SCSI running the queue inline from IRQ >> context, that's not a good idea. Can you confirm the below works for >> you? >> >> >> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c >> index f6097b89d5d3..78740ebf966c 100644 >> --- a/drivers/scsi/scsi_lib.c >> +++ b/drivers/scsi/scsi_lib.c >> @@ -497,7 +497,7 @@ static void scsi_run_queue(struct request_queue *q) >> scsi_starved_list_run(sdev->host); >> >> if (q->mq_ops) >> - blk_mq_run_hw_queues(q, false); >> + blk_mq_run_hw_queues(q, true); >> else >> blk_run_queue(q); >> } > > Hello Jens, > > scsi_run_queue() works fine if no scheduler is configured. Additionally, that > code predates the introduction of blk-mq I/O schedulers. I think it is > nontrivial for block driver authors to figure out that a queue has to be run > from process context if a scheduler has been configured that does not support > to be run from interrupt context. No it doesn't, you could never run the queue from interrupt context with async == false. So I don't think that's confusing at all, you should always be aware of the context. > How about adding WARN_ON_ONCE(in_interrupt()) to > blk_mq_start_hw_queue() or replacing the above patch by the following: No, I hate having dependencies like that, because they always just catch one of them. Looks like the IPR path that hits this should just offload to a workqueue or similar, you don't have to make any scsi_run_queue() async. -- Jens Axboe