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=-10.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 8C48DC432BE for ; Sun, 29 Aug 2021 09:57:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 719F9601FF for ; Sun, 29 Aug 2021 09:57:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235027AbhH2J6Z (ORCPT ); Sun, 29 Aug 2021 05:58:25 -0400 Received: from mga03.intel.com ([134.134.136.65]:3357 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234954AbhH2J6X (ORCPT ); Sun, 29 Aug 2021 05:58:23 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10090"; a="218186770" X-IronPort-AV: E=Sophos;i="5.84,361,1620716400"; d="scan'208";a="218186770" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2021 02:57:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,361,1620716400"; d="scan'208";a="458670272" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.174]) ([10.237.72.174]) by fmsmga007.fm.intel.com with ESMTP; 29 Aug 2021 02:57:26 -0700 Subject: Re: [PATCH v3 16/18] scsi: ufs: Synchronize SCSI and UFS error handling From: Adrian Hunter To: Bart Van Assche , "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, Jaegeuk Kim , Stanley Chu , Can Guo , Asutosh Das , Avri Altman , "James E.J. Bottomley" , Matthias Brugger , Bean Huo , Kiwoong Kim , Keoseong Park References: <20210722033439.26550-1-bvanassche@acm.org> <20210722033439.26550-17-bvanassche@acm.org> <88e0dc4c-34ff-6d87-fa9f-2fc924f50369@intel.com> Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: Date: Sun, 29 Aug 2021 12:57:58 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <88e0dc4c-34ff-6d87-fa9f-2fc924f50369@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org On 28/08/21 12:47 pm, Adrian Hunter wrote: > On 22/07/21 6:34 am, Bart Van Assche wrote: >> Use the SCSI error handler instead of a custom error handling strategy. >> This change reduces the number of potential races in the UFS drivers since >> the UFS error handler and the SCSI error handler no longer run concurrently. >> >> Cc: Adrian Hunter >> Cc: Stanley Chu >> Cc: Can Guo >> Cc: Asutosh Das >> Cc: Avri Altman >> Signed-off-by: Bart Van Assche >> --- > > Hi > > There is a deadlock that seems to be related to this patch, because now > requests are blocked while the error handler waits on the host_sem. > > > Example: > > ufshcd_err_handler() races with ufshcd_wl_suspend() for host_sem. > ufshcd_wl_suspend() wins the race but now PM requests deadlock: > > because: > scsi_queue_rq() -> scsi_host_queue_ready() -> scsi_host_in_recovery() is FALSE That is scsi_host_queue_ready() is FALSE because scsi_host_in_recovery() is TRUE > > because: > scsi_schedule_eh() has done: > scsi_host_set_state(shost, SHOST_RECOVERY) == 0 || > scsi_host_set_state(shost, SHOST_CANCEL_RECOVERY) == 0) > > > Some questions for thought: > > Won't any holder of host_sem deadlock if it tries to do SCSI requests > and the error handler is waiting on host_sem? > > Won't runtime resume deadlock if it is initiated by the error handler? > > > Regards > Adrian >