From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DF6DC433ED for ; Tue, 20 Apr 2021 04:15:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 341E661354 for ; Tue, 20 Apr 2021 04:15:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229507AbhDTEPy (ORCPT ); Tue, 20 Apr 2021 00:15:54 -0400 Received: from mga07.intel.com ([134.134.136.100]:57516 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229594AbhDTEPw (ORCPT ); Tue, 20 Apr 2021 00:15:52 -0400 IronPort-SDR: yKZ0xjNLquz34LfCYWwfZ788qQnTaafP5DdJy7QBveY6WfJX+pqQYB+0SftJ+0oYdwXp+d8iU5 hq2DrkL7raDg== X-IronPort-AV: E=McAfee;i="6200,9189,9959"; a="259396549" X-IronPort-AV: E=Sophos;i="5.82,236,1613462400"; d="scan'208";a="259396549" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2021 21:15:16 -0700 IronPort-SDR: 6rAbk6FueexjTrFKkwcckZGJwZ+VFfmCi4dOdTEvAZsYOeRXNbxB+x28s3fHPtKOddNihST939 DqZQceaPM7zg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,236,1613462400"; d="scan'208";a="420249358" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.174]) ([10.237.72.174]) by fmsmga008.fm.intel.com with ESMTP; 19 Apr 2021 21:15:09 -0700 Subject: Re: [PATCH v20 1/2] scsi: ufs: Enable power management for wlun To: "Asutosh Das (asd)" , cang@codeaurora.org, martin.petersen@oracle.com, linux-scsi@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, Alim Akhtar , Avri Altman , "James E.J. Bottomley" , Krzysztof Kozlowski , Stanley Chu , Andy Gross , Bjorn Andersson , Steven Rostedt , Ingo Molnar , Matthias Brugger , Lee Jones , Bean Huo , Kiwoong Kim , Colin Ian King , Wei Yongjun , Yue Hu , Bart van Assche , "Gustavo A. R. Silva" , Dinghao Liu , 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..." References: <07e3ea07-e1c3-7b8c-e398-8b008f873e6d@codeaurora.org> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <90809796-1c32-3709-13d3-65e4d5c387cc@intel.com> Date: Tue, 20 Apr 2021 07:15:24 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <07e3ea07-e1c3-7b8c-e398-8b008f873e6d@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On 20/04/21 12:53 am, Asutosh Das (asd) wrote: > On 4/19/2021 11:37 AM, Adrian Hunter wrote: >> On 16/04/21 10:49 pm, Asutosh Das wrote: >>> >>> Co-developed-by: Can Guo >>> Signed-off-by: Can Guo >>> Signed-off-by: Asutosh Das >>> --- >> >> I came across 3 issues while testing.  See comments below. >> > Hi Adrian > Thanks for the comments. >> >> >>> @@ -5794,7 +5839,7 @@ static void ufshcd_err_handling_unprepare(struct ufs_hba *hba) >>>       if (ufshcd_is_clkscaling_supported(hba)) >>>           ufshcd_clk_scaling_suspend(hba, false); >>>       ufshcd_clear_ua_wluns(hba); >> >> ufshcd_clear_ua_wluns() deadlocks trying to clear UFS_UPIU_RPMB_WLUN >> if sdev_rpmb is suspended and sdev_ufs_device is suspending. >> e.g. ufshcd_wl_suspend() is waiting on host_sem while ufshcd_err_handler() >> is running, at which point sdev_rpmb has already suspended. >> > Umm, I didn't understand this deadlock. > When you say, sdev_rpmb is suspended, does it mean runtime_suspended? > sdev_ufs_device is suspending - this can't be runtime_suspending, while ufshcd_err_handling_unprepare is running. > > If you've a call-stack of this deadlock, please can you share it with me. I'll also try to reproduce this. Yes it is system suspend. sdev_rpmb has suspended, sdev_ufs_device is waiting on host_sem. ufshcd_err_handler() holds host_sem. ufshcd_clear_ua_wlun(UFS_UPIU_RPMB_WLUN) gets stuck. I will get some call-stacks. > > I'll address the other comments in the next version. > > > Thank you! > >>> -    pm_runtime_put(hba->dev); >>> +    ufshcd_rpm_put(hba); >>>   } >> >> >> >>> +void ufshcd_resume_complete(struct device *dev) >>> +{ >