Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1304628ybc; Tue, 12 Nov 2019 18:27:24 -0800 (PST) X-Google-Smtp-Source: APXvYqyTJUEjX7QN7ByRNX0tHO/AjBdd6w99V8KnIdbIPE9QHhr/x6zkFlApn4XX04xULQOwLl96 X-Received: by 2002:a17:906:95c1:: with SMTP id n1mr539670ejy.158.1573612044695; Tue, 12 Nov 2019 18:27:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573612044; cv=none; d=google.com; s=arc-20160816; b=cN0CPGKtpXUTcJxK0brS052IUnfR1nkVNq5SI42vuZgXH0qrgXg06cITjQjWhwpmmD 4oH8bgUxBe3u7SbhxLIRzfHES4BSshm+2+k+BGru7GuT3WZ1lsX5whVH9cXFovLLz+XM 8IbYunlotCbpL1t+/OwDHOYizyTmvyT/rML0x0fxpB1/g9+09A+3b2ZKxK3vYhc0TNE0 3Pck5cIRlmd21/YEp8d+k9uwTn4TaCcZ7l/HCa46Ofhjs0nbRXZ/YUQvHOYGLiV2bpuP Bnvr/xV4ky9bZ43F7ZuU8blRvhMHFvWmKsyadjz2T//arjyuSOeHg09Wq9WXqIlyzZmW GtUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=67vt+2/hcnur/stdYuxW6KOlEarE4FFpvwMXouje6z0=; b=mq5ttXhdhLGAQAByMh3wb922d2N4bYX221u/1MudU8YrtPTLTpOHC9uWufdLU5bHel FLUGxqd7dVjAqGaarF+B1i2WroJBzdxFtM87w3qWNVzNOCeRnxSW5aFeDg7gHU9y0NCz 9HVJ4FvPY6pdS4SSF/KpK+M3U9eFZgB3OtXkLlxqCPXH1MWAH6+WKsYTyBbtWAF04KuM YvVm3R84hTmMLMOiVI75sXgnDy+Vwkda5Xfyqh2BkcZ41pUd0WkLgYRNmGWhpdev17UZ J0hy+WsZRTm/8q4OvERyq/PsHIVY32A37AMqTojuklI5eqTCJO5eiody5srhx4oTrJAk kmYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=C5zJXaoW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r20si325222edm.17.2019.11.12.18.27.00; Tue, 12 Nov 2019 18:27:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=C5zJXaoW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730219AbfKMCZI (ORCPT + 99 others); Tue, 12 Nov 2019 21:25:08 -0500 Received: from mail-io1-f67.google.com ([209.85.166.67]:33206 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727723AbfKMCZG (ORCPT ); Tue, 12 Nov 2019 21:25:06 -0500 Received: by mail-io1-f67.google.com with SMTP id j13so810150ioe.0; Tue, 12 Nov 2019 18:25:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=67vt+2/hcnur/stdYuxW6KOlEarE4FFpvwMXouje6z0=; b=C5zJXaoWqhirA5JCzRzQxV6NeESF2nnVYyWxW3GPmZgA3s9X0SjSG7oOgw7GKTeKd6 4UMme8ZH+Z5d040MLiivvMDkk7mV7Y4M2lyRmLy02gcoA8HavuwI81OkKq19KHVvuISM hjpF56QT9rMyiN0DCZtYVVuUNz7msCut/xpm3zLFDL1WDZ8NFnvqwFVEoP9LDdYxl4HC 7v0eBMSBZ7Vt111I1M9fKgU4pcE60ZmLtIm6VPz9tIT3zYHjysYcSRbFSGiowSFh5AN3 CnyJ3cSirM+W+u0JslaNlQCyGu+b4dFHpV/7oHaHD036f2WdS3cVE3qnoFwCo7vW+1VH 9Mrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=67vt+2/hcnur/stdYuxW6KOlEarE4FFpvwMXouje6z0=; b=HQKMcBq0T/O/1gWQTv8tE8zmv0TB1gyNACAArdnVzqyESW4FsIFo44+g3+cJpBYRnN 81pN8Ty5odZ/Xr65goevoQoRhXjMu9fVrY3YbuCqI/CZElwjJhXNMCLm7S6O6+K+SeP/ FZjQuOfpZESsG0fGYsOisMJMnsgo89vvHXQJ1/qmKJVkIQm8kwcfdEjW8M48tCAfdJt5 5MqBzgsR+NWHpNpSJb8nfCmp/R+QrF/oYKVR7jvyOVpgEXoWZaRgtrztM/CUHO85kz3Q 31a5ROspV3P62kFaxUEO0/DRd83cidyxiQoYdP9N33djomPSw8UihuL0VTJIUgJ81CdD tWRA== X-Gm-Message-State: APjAAAV4eijhwgggWfsz/fFGyej1/BNO7QjS6UVoMzAepWZuaT+daUKz 9Gn2gn9EJ/h4pN6UxzA7H7lPipwdFPRk3R090iM= X-Received: by 2002:a6b:b987:: with SMTP id j129mr1093188iof.105.1573611904929; Tue, 12 Nov 2019 18:25:04 -0800 (PST) MIME-Version: 1.0 References: <1573200932-384-1-git-send-email-cang@codeaurora.org> <1573200932-384-6-git-send-email-cang@codeaurora.org> In-Reply-To: <1573200932-384-6-git-send-email-cang@codeaurora.org> From: Alim Akhtar Date: Wed, 13 Nov 2019 07:54:28 +0530 Message-ID: Subject: Re: [PATCH v1 5/5] scsi: ufs: Complete pending requests in host reset and restore path To: Can Guo Cc: asutoshd@codeaurora.org, nguyenb@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com, Alim Akhtar , Avri Altman , Pedro Sousa , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Bean Huo , Subhash Jadavani , Tomas Winkler , open list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Can, On Fri, Nov 8, 2019 at 1:50 PM Can Guo wrote: > > In UFS host reset and restore path, before probe, we stop and start the > host controller once. After host controller is stopped, the pending > requests, if any, are cleared from the doorbell, but no completion IRQ > would be raised due to the hba is stopped. > These pending requests shall be completed along with the first NOP_OUT > command(as it is the first command which can raise a transfer completion > IRQ) sent during probe. > Since the OCSs of these pending requests are not SUCCESS(because they are > not yet literally finished), their UPIUs shall be dumped. When there are > multiple pending requests, the UPIU dump can be overwhelming and may lead > to stability issues because it is in atomic context. > Therefore, before probe, complete these pending requests right after host > controller is stopped. > > Signed-off-by: Can Guo > --- Looks good, I hope this is tested on your platform. Reviewed-by: Alim Akhtar > drivers/scsi/ufs/ufshcd.c | 20 +++++++------------- > 1 file changed, 7 insertions(+), 13 deletions(-) > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index 5950a7c..4df4136 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -5404,8 +5404,8 @@ static void ufshcd_err_handler(struct work_struct *work) > > /* > * if host reset is required then skip clearing the pending > - * transfers forcefully because they will automatically get > - * cleared after link startup. > + * transfers forcefully because they will get cleared during > + * host reset and restore > */ > if (needs_reset) > goto skip_pending_xfer_clear; > @@ -6333,9 +6333,13 @@ static int ufshcd_host_reset_and_restore(struct ufs_hba *hba) > int err; > unsigned long flags; > > - /* Reset the host controller */ > + /* > + * Stop the host controller and complete the requests > + * cleared by h/w > + */ > spin_lock_irqsave(hba->host->host_lock, flags); > ufshcd_hba_stop(hba, false); > + ufshcd_complete_requests(hba); > spin_unlock_irqrestore(hba->host->host_lock, flags); > > /* scale up clocks to max frequency before full reinitialization */ > @@ -6369,7 +6373,6 @@ static int ufshcd_host_reset_and_restore(struct ufs_hba *hba) > static int ufshcd_reset_and_restore(struct ufs_hba *hba) > { > int err = 0; > - unsigned long flags; > int retries = MAX_HOST_RESET_RETRIES; > > do { > @@ -6379,15 +6382,6 @@ static int ufshcd_reset_and_restore(struct ufs_hba *hba) > err = ufshcd_host_reset_and_restore(hba); > } while (err && --retries); > > - /* > - * After reset the door-bell might be cleared, complete > - * outstanding requests in s/w here. > - */ > - spin_lock_irqsave(hba->host->host_lock, flags); > - ufshcd_transfer_req_compl(hba); > - ufshcd_tmc_handler(hba); > - spin_unlock_irqrestore(hba->host->host_lock, flags); > - > return err; > } > > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project > -- Regards, Alim