Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1162868rwb; Tue, 29 Nov 2022 09:43:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf4T46nTUtf8ZWTJ0Fn/ah4LdNGWExgXC6t/HBOcYe3PyuJPqMJmKtQSYnwiEzAwuq0KDn9t X-Received: by 2002:aa7:815a:0:b0:562:d99c:2f66 with SMTP id d26-20020aa7815a000000b00562d99c2f66mr44955295pfn.42.1669743796339; Tue, 29 Nov 2022 09:43:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669743796; cv=none; d=google.com; s=arc-20160816; b=rHw/XucUWYmHjAt1O4L4IstaNMLal2mB3X6NOoNpOLGfRd2jJ0QKqXT4IuRyTi/9ge vZcMgAJXYuOL7KrnfZ14AqQrxqKA7q81TAXp3At3BcaCEepMOvx+LN9P12ND/WjzO1lw jyOnNURMQjjp6sPp2IFmNgd06GL4uK9jWVHIQiKLxyHkijYGY7dzMM8LDVPMd4pBtNlz nyd5oaemP1KH7U7Ou+cdI/kFMT4G0dJgUIBRfee8tzWnPfB+/tVUwJWjgVopvGPiAoaJ tuhQSAkjV35eIe/SmW3SsTX2Ri2EJmkAzzIOkHvkTQcuFPymj0sAqGMChKQS0GaPvw1p Izvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=u9zXB3qqVZ0k/Ms/7UTwwNWaO6cuhnG1yPubtNR+wj0=; b=UOgsQ3iuvcmhR+QiciZ1zDEVp29neickTXfrBAkcEnl4CpJnIaUQvfNjn7z3RTcjh2 PZ6HrGGs7NpNCnjgo5SxDnK0lARvABHQqBpnCb3tjbPOMj0bnnfqwEryL8HtlbGmN/Ar rBbQkNHXn96RyiSr5XceDtrxWb5K5S+pn4owViLknL4/bSLGH7pYw7K21tAhdmNzC8Od KpZuQ3WSP0RbevwSXfUYiYOXEQbnyBsPDcwcR3kMaxVu3br9HoSAmr3w+yi3Nc6c+kr0 n43O4HqsUctBnPj5lFYsPiyQrqQcQi1V3D3fMChXLkZ3OstTLB8YRKaZcT5LlJZVBQ2L htjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=QZLGvXd4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m6-20020a170902f64600b0017bcea4e6b6si14586989plg.234.2022.11.29.09.43.05; Tue, 29 Nov 2022 09:43:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=QZLGvXd4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236565AbiK2RAr (ORCPT + 84 others); Tue, 29 Nov 2022 12:00:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236484AbiK2RAN (ORCPT ); Tue, 29 Nov 2022 12:00:13 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2548C6DFF2; Tue, 29 Nov 2022 08:56:30 -0800 (PST) Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2ATFCEI4002709; Tue, 29 Nov 2022 16:56:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=u9zXB3qqVZ0k/Ms/7UTwwNWaO6cuhnG1yPubtNR+wj0=; b=QZLGvXd4PSSC8lmS85vnOI+Dtp2UyIW2PraLvE2ceo8p2aJWT5doqqI7bE7YCgrVRPUn eQMosBzs99TFvkNLEHAjCvsA2ebDlgdl78Y0J5/9GQ7P2EWuQQ4iOcK393qf4PhVnI0V qWNh1TcSN3knH6p7Svq4uLg3N5IKpD2/7YDYNTCLA169aCd3xwaMB5/JZPtOZamh4E6D jiJFiGAjKvyzdqE7QeYtIp5JKNI314nJho/vsdfz+PDJB+2sfnNuJq14jRvnUolvCYo2 zMcZ9/NDUsumEHbFppR9FtBbm28n1+OGD1NSWeYF8S5+WAeF9Z0iFB9kRLVmFoSCF0lP Tg== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3m5bnh1u5k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Nov 2022 16:56:21 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2ATGuKjP030058 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Nov 2022 16:56:20 GMT Received: from [10.216.8.159] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 29 Nov 2022 08:56:16 -0800 Message-ID: <2a1047a7-3121-6cbe-d4c5-46bbff0c5cc5@quicinc.com> Date: Tue, 29 Nov 2022 22:26:13 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.2 Subject: Re: PM-runtime: supplier looses track of consumer during probe To: Tushar Nimkar , Adrian Hunter , , , "Rafael J. Wysocki" CC: , LKML , , , , , Peter Wang References: <36aed941-a73e-d937-2721-4f0decd61ce0@quicinc.com> <8c0a715a-d626-aa70-15f1-79f1e23fbc67@quicinc.com> <8ca27fcb-b146-3ea7-a042-55f99e0ae3fb@quicinc.com> Content-Language: en-US From: Nitin Rawat In-Reply-To: <8ca27fcb-b146-3ea7-a042-55f99e0ae3fb@quicinc.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: PCdJ6YPgUwI8byB6RxkpvBrLF8MLWPan X-Proofpoint-GUID: PCdJ6YPgUwI8byB6RxkpvBrLF8MLWPan X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-29_11,2022-11-29_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 adultscore=0 lowpriorityscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 bulkscore=0 impostorscore=0 mlxscore=0 spamscore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211290094 X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Adrian, On 11/21/2022 11:38 AM, Tushar Nimkar wrote: > Hi Adrian, > > On 11/18/2022 8:25 PM, Adrian Hunter wrote: >> On 4/11/22 11:19, Tushar Nimkar wrote: >>> Hi linux-pm/linux-scsi, > >>>> Process -1 >>>> ufshcd_async_scan context (process 1) >>>> scsi_autopm_put_device() //0:0:0:0 >> >> I am having trouble following your description.  What function is calling >> scsi_autopm_put_device() here? >> > Below is flow which calls scsi_autopm_put_device() > Process -1 > ufshcd_async_scan() >     scsi_probe_and_add_lun() >         scsi_add_lun() >             slave_configure() >                 scsi_sysfs_add_sdev() >                     scsi_autopm_get_device() >                         device_add()     <- invoked [Process 2] sd_probe() >                             scsi_autopm_put_device() > >>>> pm_runtime_put_sync() >>>> __pm_runtime_idle() >>>> rpm_idle() -- RPM_GET_PUT(4) >>>>       __rpm_callback >>>>           scsi_runtime_idle() >>>>               pm_runtime_mark_last_busy() >>>>               pm_runtime_autosuspend()  --[A] >>>>                   rpm_suspend() -- RPM_AUTO(8) >>>>                       pm_runtime_autosuspend_expiration() >>>> use_autosuspend    is false return 0   --- [B] >>>>                           __update_runtime_status to RPM_SUSPENDING >>>>                       __rpm_callback() >>>>                           __rpm_put_suppliers(dev, false) >>>>                       __update_runtime_status to RPM_SUSPENDED >>>>                   rpm_suspend_suppliers() >>>>                       rpm_idle() for supplier -- RPM_ASYNC(1) return >>>> (-EAGAIN) [ Other consumer active for supplier] >>>>                   rpm_suspend() – END with return=0 >>>>           scsi_runtime_idle() END return (-EBUSY) always. >> >> Not following here either.  Which device is EBUSY and why? > > scsi_runtime_idle() return -EBUSY always [3] > Storage/scsi team can better explain -EBUSY implementation. EBUSY is returned from below code for consumer dev 0:0:0:0. scsi_runtime_idle is called from scsi_autopm_put_device which inturn is called from ufshcd_async_scan (Process 1 as per above call stack) static int scsi_runtime_idle(struct device *dev) { : if (scsi_is_sdev_device(dev)) { pm_runtime_mark_last_busy(dev); pm_runtime_autosuspend(dev); return -EBUSY; ---> EBUSY returned from here. } } > > [3] > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/scsi/scsi_pm.c?h=next-20221118#n210 > > >>>> >>>> [1]: https://lore.kernel.org/lkml/4748074.GXAFRqVoOG@kreacher/T/ >>>> [2]: https://lkml.org/lkml/2022/10/12/259 >>>> >>>> Thanks, >>>> Tushar Nimkar >> > Thanks, > Tushar Nimkar Thanks, Nitin