Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3565720ybc; Mon, 18 Nov 2019 17:40:44 -0800 (PST) X-Google-Smtp-Source: APXvYqzu6MhpcyYA2wU2UXya3meDilYMA+9dgktjPBjOV326hEWGZxaCYJ1ft2ny5CiE8faHQtKK X-Received: by 2002:a17:906:3ec8:: with SMTP id d8mr31254314ejj.55.1574127643892; Mon, 18 Nov 2019 17:40:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574127643; cv=none; d=google.com; s=arc-20160816; b=uuaLs0ajlvTLvUjqc46lHvIF0RTeCqcN/Ix5OfMKU3t6PuqoowQ2zNrf9ka9KJxYb9 p7TQOOkbIcB+eYoCzzWsmsxF2dZyqZwsyk47NXWUkxvm6phtfEfay8SNzhqkOmIMQPKF 4BSiA6k9/y/MmrdzdZmrOiySshnbqUQ1AP33XOO5SGXoNrDNTmA74glYIHhigGln6t6R 8XGJDbGZwtgo9cfag/se5ZgPBetOGzt4Dxed7cgOigwGzEloYjMQIpMTCtaRRI8TkzCa T7WZS9jzMWAeXjeiiDgWWp3oogumauE4fFyW1k/Eo8fEp1LvYqusbeD+trzKQoQws5Jm 5J2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:feedback-id:user-agent:message-id :references:in-reply-to:subject:cc:to:from:date :content-transfer-encoding:mime-version:dkim-signature :dkim-signature; bh=X5WnDpmPQIzOAa+vyodiIlE1aNxudPoYFEIncTY6/qc=; b=0itt9CX/R2MVoRI0qYRIHlydIIrVGxjy+zfv1HMpaoMqYdDyKASjLMwtnbiT03XWfO 2U3N3SgCoi3PSSX0/zRRtQBhLMlHUX8xgQBx3kIileEiXZP/Z5rDHJs18j6ufjG1GwdC 0s8K+4fYp9D21+1+wHc9JVsSe8tzzOjOWxQyj9BzBIsWCwddOPYYIGduMO8W3/CBTYS3 633wLWn3cPMg9BUsmJgKDRNE4GtN+AoY0KmG9rH+9gSB4O28FVA7b6nCLQtJDMTk9OnK W3oVR6mGsQYrmiRTBKnmnodw0obDmcvHm1qYt7gEsHtu1FLWq8oSsmtL1btiNr3Wgofv zxJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=zsmsymrwgfyinv5wlfyidntwsjeeldzt header.b=VAAUxtrZ; dkim=pass header.i=@amazonses.com header.s=gdwg2y3kokkkj5a55z2ilkup5wp5hhxx header.b=LRZnYRxW; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e4si13841986edy.83.2019.11.18.17.40.08; Mon, 18 Nov 2019 17:40:43 -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=@codeaurora.org header.s=zsmsymrwgfyinv5wlfyidntwsjeeldzt header.b=VAAUxtrZ; dkim=pass header.i=@amazonses.com header.s=gdwg2y3kokkkj5a55z2ilkup5wp5hhxx header.b=LRZnYRxW; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727020AbfKSBg2 (ORCPT + 99 others); Mon, 18 Nov 2019 20:36:28 -0500 Received: from a27-187.smtp-out.us-west-2.amazonses.com ([54.240.27.187]:53526 "EHLO a27-187.smtp-out.us-west-2.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726761AbfKSBg2 (ORCPT ); Mon, 18 Nov 2019 20:36:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=zsmsymrwgfyinv5wlfyidntwsjeeldzt; d=codeaurora.org; t=1574127387; h=MIME-Version:Content-Type:Content-Transfer-Encoding:Date:From:To:Cc:Subject:In-Reply-To:References:Message-ID; bh=gu0VjLFeEaynap/88TiNlWcXPPYqNHDR0ClbwmBdRGY=; b=VAAUxtrZIz+6M1F7k1+jk+qa1T4ZmM1W40ccZ9muxYtXhfR/85SlGZBBMFXRiASA yKOj+XCvq5Mwr4oVw0+w8/T9gT/Jua67g3c+ZXC2R3SKfaS+SNcf+0c5fkGuOIS1qe7 /smkQXwesa8x/nAzOyiHSQOsfvtlrERGrcA0LFH0= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=gdwg2y3kokkkj5a55z2ilkup5wp5hhxx; d=amazonses.com; t=1574127387; h=MIME-Version:Content-Type:Content-Transfer-Encoding:Date:From:To:Cc:Subject:In-Reply-To:References:Message-ID:Feedback-ID; bh=gu0VjLFeEaynap/88TiNlWcXPPYqNHDR0ClbwmBdRGY=; b=LRZnYRxWv1tToV9a+xDGcOe1bjySH1viP7qAWDYUSjmk3Z2Xb55F43IC3AZqE2L3 cf4jGGZzvko8j1KCcsjipHFE6sfGOAYOU8rO9DUXHFp/YU9uIltEupQFjnAlANBvGwf CDBJyIyVcA0tnXzkdi/Dj3xG2y/re4WZErMB9t6Q= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 19 Nov 2019 01:36:27 +0000 From: cang@codeaurora.org To: Alim Akhtar Cc: Can Guo , asutoshd@codeaurora.org, nguyenb@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, Mark Salyzyn , Alim Akhtar , Avri Altman , Pedro Sousa , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Bean Huo , Tomas Winkler , Venkat Gopalakrishnan , Bjorn Andersson , Arnd Bergmann , open list Subject: Re: [PATCH v2 4/4] scsi: ufs: Complete pending requests in host reset and restore path In-Reply-To: References: <1574049061-11417-1-git-send-email-cang@qti.qualcomm.com> <1574049061-11417-5-git-send-email-cang@qti.qualcomm.com> Message-ID: <0101016e814dc1ec-bde59f85-9e2c-48f9-bae3-202b2a3d24bd-000000@us-west-2.amazonses.com> X-Sender: cang@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 X-SES-Outgoing: 2019.11.19-54.240.27.187 Feedback-ID: 1.us-west-2.CZuq2qbDmUIuT3qdvXlRHZZCpfZqZ4GtG9v3VKgRyF0=:AmazonSES Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-11-18 21:23, Alim Akhtar wrote: > On Mon, Nov 18, 2019 at 9:22 AM Can Guo wrote: >> >> From: Can Guo >> >> 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 and silence the UPIU dump from them. >> >> Signed-off-by: Can Guo >> --- > > Tested-by: Alim Akhtar > > Please add all previous Ack/reviewed and tested-by tags so that we are > aware what need to be done for this patch. > Thanks > Hi Alim, Thanks for pointing out it. I updated the patch a little bit so I think the prevoius tags are not valid any more. Best Regards, Can Guo. >> drivers/scsi/ufs/ufshcd.c | 24 ++++++++++-------------- >> drivers/scsi/ufs/ufshcd.h | 2 ++ >> 2 files changed, 12 insertions(+), 14 deletions(-) >> >> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c >> index 5950a7c..b92a3f4 100644 >> --- a/drivers/scsi/ufs/ufshcd.c >> +++ b/drivers/scsi/ufs/ufshcd.c >> @@ -4845,7 +4845,7 @@ static void ufshcd_slave_destroy(struct >> scsi_device *sdev) >> break; >> } /* end of switch */ >> >> - if (host_byte(result) != DID_OK) >> + if ((host_byte(result) != DID_OK) && !hba->silence_err_logs) >> ufshcd_print_trs(hba, 1 << lrbp->task_tag, true); >> return result; >> } >> @@ -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,15 @@ 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); >> + hba->silence_err_logs = true; >> + ufshcd_complete_requests(hba); >> + hba->silence_err_logs = false; >> spin_unlock_irqrestore(hba->host->host_lock, flags); >> >> /* scale up clocks to max frequency before full >> reinitialization */ >> @@ -6369,7 +6375,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 +6384,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; >> } >> >> diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h >> index e0fe247..1e51034 100644 >> --- a/drivers/scsi/ufs/ufshcd.h >> +++ b/drivers/scsi/ufs/ufshcd.h >> @@ -513,6 +513,7 @@ struct ufs_stats { >> * @uic_error: UFS interconnect layer error status >> * @saved_err: sticky error mask >> * @saved_uic_err: sticky UIC error mask >> + * @silence_err_logs: flag to silence error logs >> * @dev_cmd: ufs device management command information >> * @last_dme_cmd_tstamp: time stamp of the last completed DME command >> * @auto_bkops_enabled: to track whether bkops is enabled in device >> @@ -670,6 +671,7 @@ struct ufs_hba { >> u32 saved_err; >> u32 saved_uic_err; >> struct ufs_stats ufs_stats; >> + bool silence_err_logs; >> >> /* Device management request data */ >> struct ufs_dev_cmd dev_cmd; >> -- >> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora >> Forum, >> a Linux Foundation Collaborative Project >>