Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3857225ybt; Tue, 30 Jun 2020 12:27:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyku4Vc0d5dq6DN5m+QQ8WDBTuUAhZspB2vKmPT5G0ZQ4OVeOCIsVtYWLt7JMCaV+da9rcf X-Received: by 2002:a17:906:fcc7:: with SMTP id qx7mr20051192ejb.182.1593544804526; Tue, 30 Jun 2020 12:20:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593544804; cv=none; d=google.com; s=arc-20160816; b=R1qLsq8Q0BOwOyO4z4oJh6KhY2Ja+/fcw7ZYeugIiwbF1LRuULREkfwNcDCeHtARzT rgkr+gScRt64vITfGhQuzXB4miz57oCWMXB+qIww/AYMn2lf6jJghK0IFtlHxaZaF2F0 R6ZYTNf6P49WqmyBo8WVbJ9BiNF8WqesipApPlRCduzLswCczms+N1MkSxrv5P7pUSfO g1KXL0iT+PqdYU+IJztgYG4GhYI/3Z9mDa8M4cmrC6HxFD7o4uf5TW4pcUrf/tAp3yJl BHZHzAle+0miP+BGa/WCnNzY6/dbZsO2BQaUSYhtRizUvOfyDvUJEwKcDQ7JlZ9h0OVc JuBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=SrwXkm531bs+CMfOae984L9Z82+2GUZBoi4gMmV617w=; b=VS8Zl74wpEFbY34GSusBQ/Zv7GP+Nol1nnOPaCFo0UPx1UyM2PgT5PalwTAUKombUT 3iUjaZ5heO2lTsY/NA/kchExAQFtRHXAKm7h0i16IwaXbEpojFY52tNy2G18lrTVBmVt NGx9zSYs9FKRNEskc4oGBYMRfTvmXIrpHewII42en62kCA4fRlVxyF1w7RuPyNCn/TZM Elhf+lqYJNxVLeD+ArJxWa4xozHbinJ01RmbPMatCIWDP3N6kaEYstcnifDCb/HSmusA puvKivZEpY5+whs3QL1ofMEJgeQRDy53hrPrfn79N+KpVVngktLZWedhXbjwYEbGjACY nBzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c11si2316789edv.140.2020.06.30.12.19.41; Tue, 30 Jun 2020 12:20:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390609AbgF3SC5 (ORCPT + 99 others); Tue, 30 Jun 2020 14:02:57 -0400 Received: from netrider.rowland.org ([192.131.102.5]:51905 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1733028AbgF3SC4 (ORCPT ); Tue, 30 Jun 2020 14:02:56 -0400 Received: (qmail 460459 invoked by uid 1000); 30 Jun 2020 14:02:55 -0400 Date: Tue, 30 Jun 2020 14:02:55 -0400 From: Alan Stern To: Bart Van Assche Cc: Martin Kepplinger , jejb@linux.ibm.com, Can Guo , martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@puri.sm Subject: Re: [PATCH] scsi: sd: add runtime pm to open / release Message-ID: <20200630180255.GA459638@rowland.harvard.edu> References: <20200623111018.31954-1-martin.kepplinger@puri.sm> <1379e21d-c51a-3710-e185-c2d7a9681fb7@acm.org> <20200626154441.GA296771@rowland.harvard.edu> <20200629161536.GA405175@rowland.harvard.edu> <5231c57d-3f4e-1853-d4d5-cf7f04a32246@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5231c57d-3f4e-1853-d4d5-cf7f04a32246@acm.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 30, 2020 at 08:59:00AM -0700, Bart Van Assche wrote: > On 2020-06-29 09:15, Alan Stern wrote: > > Aha. Looking at this more closely, it's apparent that the code in > > blk-core.c contains a logic bug: It assumes that if the BLK_MQ_REQ_PREEMPT > > flag is set then the request can be issued regardless of the queue's > > runtime status. That is not correct when the queue is suspended. > > Are you sure of this? In the past (legacy block layer) no requests were > processed for queues in state RPM_SUSPENDED. However, that function and > its successor blk_pm_allow_request() are gone. The following code was > removed by commit 7cedffec8e75 ("block: Make blk_get_request() block for > non-PM requests while suspended"). > > static struct request *blk_pm_peek_request(struct request_queue *q, > struct request *rq) > { > if (q->dev && (q->rpm_status == RPM_SUSPENDED || > (q->rpm_status != RPM_ACTIVE && !(rq->cmd_flags & REQ_PM)))) > return NULL; > else > return rq; > } No, it wasn't. Another routine, blk_pm_allow_request(), was removed by that commit, but almost no other code was deleted. Maybe you're thinking of a different commit? In any case, I don't understand the point you're trying to make. Here's what I _do_ understand: While the queue is in the RPM_SUSPENDED state, it can't carry out any requests at all. If a request is added to the queue, the queue must be resumed before the request can be issued to the lower-layer drivers -- no matter what flags are set in the request. Right now there doesn't seem to be any mechanism for resuming the queue if an REQ_PREEMPT request is added while the queue is suspended. Alan Stern