Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp154466pxb; Tue, 9 Mar 2021 19:18:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJzivMLfpq0k6FDr95jCj0DKsotS/l2Y+j6NMwSXlkSnx9rcNUeo48izl8gPgBtgp+75QVfd X-Received: by 2002:a17:906:40c7:: with SMTP id a7mr1251527ejk.109.1615346329169; Tue, 09 Mar 2021 19:18:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615346329; cv=none; d=google.com; s=arc-20160816; b=V3h+lOLLkp8VRO3SbT74umvroOFpkNhXjP14CV7SpR45IToIy+JZPzFHumHjlM1jLO L4VuAOELrurFT9lZnRq21MUo5ATGt5aXOwZRLBTwaIiMh+0eUVrpJElE7L3MBFur9RVa k5+HtFpAl+aI4WMrkagsGbJq/TSJiFYhGPyeVyK9TlENc3TrEWGAY6Pz152sLoeFWuLw BPFhdA2HPJbawvq3oPbWRr68yv7Qo/Y8MYcRP4Xf5GYfRtey3b+KFyTq0rto+l67b7Tg 15msX40AzMsXQir9O8Pl1BQ7418IHn5XGmutB2ALErQ77X4fmdSDQTrmTzF+zmVF/M+b XQ7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=1zH3xcfvBMldc0mPF93RJ30P0T3sZ34L115W5fPgASQ=; b=O8940parh3qDGf0ElHQ8Gde8pXGVqfiF8OZGPJINTWCI+Lv1V0j3gKAd8XciP7vBUX CE/FiPmsvjcT3ibgojnln7UP7eikKwl9QGmtPtqw2OeGWkyIwP4lV7hQU+YZ+wxatyN/ PVm+oog52UTgDSihzv2DmcuvNhzOyO1fmKqusX+BNTiJ05GAnonWR7+AHj9DEoLg1tmi DiZGJA9QTkgc4bvFO2WSmUlIUzrgS9kDY/kM8g99uovPOdglAYECYusyTTmU63M6eTsW Nn1mZzeX3pEjZrhBM20/uq/Mw/cT4WlhOjRf4pbTwqwqI3DXhaJ88mtYae4WUmoFpWQ3 UHPw== 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 rl3si10902425ejb.86.2021.03.09.19.18.27; Tue, 09 Mar 2021 19:18:49 -0800 (PST) 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 S231378AbhCJDOn (ORCPT + 99 others); Tue, 9 Mar 2021 22:14:43 -0500 Received: from netrider.rowland.org ([192.131.102.5]:35491 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S231571AbhCJDOl (ORCPT ); Tue, 9 Mar 2021 22:14:41 -0500 Received: (qmail 203946 invoked by uid 1000); 9 Mar 2021 22:14:38 -0500 Date: Tue, 9 Mar 2021 22:14:38 -0500 From: Alan Stern To: "Asutosh Das \(asd\)" Cc: Bart Van Assche , Adrian Hunter , "Rafael J. Wysocki" , cang@codeaurora.org, "Martin K. Petersen" , "open list:TARGET SUBSYSTEM" , linux-arm-msm , Alim Akhtar , Avri Altman , "James E.J. Bottomley" , Krzysztof Kozlowski , Stanley Chu , Andy Gross , Bjorn Andersson , Steven Rostedt , Ingo Molnar , Matthias Brugger , Kiwoong Kim , Bean Huo , Lee Jones , Wei Yongjun , Dinghao Liu , "Gustavo A. R. Silva" , Tomas Winkler , Jaegeuk Kim , Satya Tangirala , open list , "moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES" , "open list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES" , "moderated list:UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER..." , Linux-PM mailing list Subject: Re: [PATCH v10 1/2] scsi: ufs: Enable power management for wlun Message-ID: <20210310031438.GB203516@rowland.harvard.edu> References: <0576d6eae15486740c25767e2d8805f7e94eb79d.1614725302.git.asutoshd@codeaurora.org> <85086647-7292-b0a2-d842-290818bd2858@intel.com> <6e98724d-2e75-d1fe-188f-a7010f86c509@codeaurora.org> <20210306161616.GC74411@rowland.harvard.edu> <2bd90336-18a9-9acd-5abb-5b52b27fc535@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2bd90336-18a9-9acd-5abb-5b52b27fc535@codeaurora.org> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 09, 2021 at 07:04:34PM -0800, Asutosh Das (asd) wrote: > Hello > I & Can (thanks CanG) debugged this further: > > Looks like this issue can occur if the sd probe is asynchronous. > > Essentially, the sd_probe() is done asynchronously and driver_probe_device() > invokes pm_runtime_get_suppliers() before invoking sd_probe(). > > But scsi_probe_and_add_lun() runs in a separate context. > So the scsi_autopm_put_device() invoked from scsi_scan_host() context > reduces the link->rpm_active to 1. And sd_probe() invokes > scsi_autopm_put_device() and starts a timer. And then driver_probe_device() > invoked from __device_attach_async_helper context reduces the > link->rpm_active to 1 thus enabling the supplier to suspend before the > consumer suspends. > I don't see a way around this. Please let me know if you > (@Alan/@Bart/@Adrian) have any thoughts on this. How about changing the SCSI core so that it does a runtime_get before starting an async probe, and the async probe routine does a runtime_put when it is finished? In other words, don't allow a device to go into runtime suspend while it is waiting to be probed. I don't think that would be too intrusive. Alan Stern