All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] Fix up and simplify error recovery mechanism
@ 2020-07-14  2:28 Can Guo
  2020-07-14  2:28 ` [PATCH v2 1/4] scsi: ufs: Add checks before setting clk-gating states Can Guo
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Can Guo @ 2020-07-14  2:28 UTC (permalink / raw)
  To: asutoshd, nguyenb, hongwus, rnayak, linux-scsi, kernel-team,
	saravanak, salyzyn, cang

This series contains 4 changes, the first 3 of them are minor changes to make
sure the main change "scsi: ufs: Fix up and simplify error recovery mechanism"
work properly. The main change has been tested with error injections of multiple
error types (and all kinds of mix of them) during runtime, e.g. hibern8 enter/
exit error, power mode change error and fatal/non-fatal error from IRQ context.
During the test, error injections happen randomly across all contexts, e.g. clk
scaling, clk gate/ungate, runtime suspend/resume and IRQ. There are a few more
fixes to resolve other minor problems based on the main change, but they will be
pushed after this series is taken, due to there are already too many lines in
this change.

Change since v1:
- Fixed a compilation error in case that CONFIG_PM is N

Can Guo (4):
  scsi: ufs: Add checks before setting clk-gating states
  scsi: ufs: Fix imbalanced scsi_block_reqs_cnt caused by ufshcd_hold()
  ufs: ufs-qcom: Fix a few BUGs in func ufs_qcom_dump_dbg_regs()
  scsi: ufs: Fix up and simplify error recovery mechanism

 drivers/scsi/ufs/ufs-qcom.c  |  17 +-
 drivers/scsi/ufs/ufs-sysfs.c |   1 +
 drivers/scsi/ufs/ufshcd.c    | 465 ++++++++++++++++++++++++++-----------------
 drivers/scsi/ufs/ufshcd.h    |  15 ++
 4 files changed, 309 insertions(+), 189 deletions(-)

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: [PATCH v2 4/4] scsi: ufs: Fix up and simplify error recovery mechanism
@ 2020-07-14 20:46 kernel test robot
  0 siblings, 0 replies; 15+ messages in thread
From: kernel test robot @ 2020-07-14 20:46 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 9368 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <1594693693-22466-5-git-send-email-cang@codeaurora.org>
References: <1594693693-22466-5-git-send-email-cang@codeaurora.org>
TO: Can Guo <cang@codeaurora.org>
TO: asutoshd(a)codeaurora.org
TO: nguyenb(a)codeaurora.org
TO: hongwus(a)codeaurora.org
TO: rnayak(a)codeaurora.org
TO: linux-scsi(a)vger.kernel.org
TO: kernel-team(a)android.com
TO: saravanak(a)google.com
TO: salyzyn(a)google.com
TO: cang(a)codeaurora.org
CC: Alim Akhtar <alim.akhtar@samsung.com>

Hi Can,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on scsi/for-next]
[also build test WARNING on v5.8-rc5]
[cannot apply to mkp-scsi/for-next target/for-next next-20200714]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use  as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Can-Guo/Fix-up-and-simplify-error-recovery-mechanism/20200714-103547
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
:::::: branch date: 18 hours ago
:::::: commit date: 18 hours ago
config: i386-randconfig-m021-20200714 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/scsi/ufs/ufshcd.c:6714 ufshcd_reset_and_restore() error: double unlocked '*hba->host->host_lock' (orig line 6694)
drivers/scsi/ufs/ufshcd.c:7539 ufshcd_probe_hba() error: double unlocked '*hba->host->host_lock' (orig line 7535)

Old smatch warnings:
drivers/scsi/ufs/ufshcd.c:1449 ufshcd_suspend_clkscaling() error: double unlocked '*hba->host->host_lock' (orig line 1446)
drivers/scsi/ufs/ufshcd.c:1722 ufshcd_gate_work() error: double unlocked '*hba->host->host_lock' (orig line 1682)
drivers/scsi/ufs/ufshcd.c:2165 ufshcd_send_uic_cmd() error: double unlocked '*hba->host->host_lock' (orig line 2163)
drivers/scsi/ufs/ufshcd.c:2165 ufshcd_send_uic_cmd() error: double unlocked '*hba->host->host_lock' (orig line 2163)
drivers/scsi/ufs/ufshcd.c:2720 ufshcd_wait_for_dev_cmd() error: double unlocked '*hba->host->host_lock' (orig line 2714)
drivers/scsi/ufs/ufshcd.c:2720 ufshcd_wait_for_dev_cmd() error: double unlocked '*hba->host->host_lock' (orig line 2714)
drivers/scsi/ufs/ufshcd.c:3827 ufshcd_uic_pwr_ctrl() error: double unlocked '*hba->host->host_lock' (orig line 3785)
drivers/scsi/ufs/ufshcd.c:3886 ufshcd_link_recovery() error: double unlocked '*hba->host->host_lock' (orig line 3875)
drivers/scsi/ufs/ufshcd.c:5536 ufshcd_quirk_dl_nac_errors() error: double unlocked '*hba->host->host_lock' (orig line 5516)
drivers/scsi/ufs/ufshcd.c:5554 ufshcd_quirk_dl_nac_errors() error: double unlocked '*hba->host->host_lock' (orig line 5536)
drivers/scsi/ufs/ufshcd.c:5625 ufshcd_err_handler() error: double unlocked '*hba->host->host_lock' (orig line 5606)
drivers/scsi/ufs/ufshcd.c:5638 ufshcd_err_handler() error: double unlocked '*hba->host->host_lock' (orig line 5606)
drivers/scsi/ufs/ufshcd.c:5657 ufshcd_err_handler() error: double unlocked '*hba->host->host_lock' (orig line 5606)
drivers/scsi/ufs/ufshcd.c:5674 ufshcd_err_handler() error: double unlocked '*hba->host->host_lock' (orig line 5606)
drivers/scsi/ufs/ufshcd.c:5677 ufshcd_err_handler() error: double unlocked '*hba->host->host_lock' (orig line 5674)
drivers/scsi/ufs/ufshcd.c:5677 ufshcd_err_handler() error: double unlocked '*hba->host->host_lock' (orig line 5674)
drivers/scsi/ufs/ufshcd.c:5717 ufshcd_err_handler() error: double unlocked '*hba->host->host_lock' (orig line 5677)
drivers/scsi/ufs/ufshcd.c:5741 ufshcd_err_handler() error: double unlocked '*hba->host->host_lock' (orig line 5717)
drivers/scsi/ufs/ufshcd.c:5771 ufshcd_err_handler() error: double unlocked '*hba->host->host_lock' (orig line 5638)
drivers/scsi/ufs/ufshcd.c:5775 ufshcd_err_handler() error: double unlocked '*hba->host->host_lock' (orig line 5771)
drivers/scsi/ufs/ufshcd.c:6650 ufshcd_host_reset_and_restore() error: double unlocked '*hba->host->host_lock' (orig line 6644)
drivers/scsi/ufs/ufshcd.c:6744 ufshcd_eh_host_reset_handler() error: double unlocked '*hba->host->host_lock' (orig line 6737)
drivers/scsi/ufs/ufshcd.c:8026 ufshcd_hba_exit() error: double unlocked '*hba->host->host_lock' (orig line 8023)
drivers/scsi/ufs/ufshcd.c:8414 ufshcd_suspend() error: double unlocked '*hba->host->host_lock' (orig line 8315)
drivers/scsi/ufs/ufshcd.c:8425 ufshcd_suspend() error: double unlocked '*hba->host->host_lock' (orig line 8315)
drivers/scsi/ufs/ufshcd.c:8527 ufshcd_resume() error: double unlocked '*hba->host->host_lock' (orig line 8524)

# https://github.com/0day-ci/linux/commit/639c70977d10f4f217e04e8825682e285f5e47a8
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 639c70977d10f4f217e04e8825682e285f5e47a8
vim +6714 drivers/scsi/ufs/ufshcd.c

3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26  6667  
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26  6668  /**
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26  6669   * ufshcd_reset_and_restore - reset and re-initialize host/device
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26  6670   * @hba: per-adapter instance
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26  6671   *
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26  6672   * Reset and recover device, host and re-establish link. This
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26  6673   * is helpful to recover the communication in fatal error conditions.
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26  6674   *
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26  6675   * Returns zero on success, non-zero on failure
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26  6676   */
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26  6677  static int ufshcd_reset_and_restore(struct ufs_hba *hba)
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26  6678  {
639c70977d10f4f Can Guo            2020-07-13  6679  	u32 saved_err;
639c70977d10f4f Can Guo            2020-07-13  6680  	u32 saved_uic_err;
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26  6681  	int err = 0;
639c70977d10f4f Can Guo            2020-07-13  6682  	unsigned long flags;
1d337ec2f35e69a Sujit Reddy Thumma 2014-09-25  6683  	int retries = MAX_HOST_RESET_RETRIES;
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26  6684  
639c70977d10f4f Can Guo            2020-07-13  6685  	/*
639c70977d10f4f Can Guo            2020-07-13  6686  	 * This is a fresh start, cache and clear saved error first,
639c70977d10f4f Can Guo            2020-07-13  6687  	 * in case new error generated during reset and restore.
639c70977d10f4f Can Guo            2020-07-13  6688  	 */
639c70977d10f4f Can Guo            2020-07-13  6689  	spin_lock_irqsave(hba->host->host_lock, flags);
639c70977d10f4f Can Guo            2020-07-13  6690  	saved_err = hba->saved_err;
639c70977d10f4f Can Guo            2020-07-13  6691  	saved_uic_err = hba->saved_uic_err;
639c70977d10f4f Can Guo            2020-07-13  6692  	hba->saved_err = 0;
639c70977d10f4f Can Guo            2020-07-13  6693  	hba->saved_uic_err = 0;
639c70977d10f4f Can Guo            2020-07-13 @6694  	spin_unlock_irqrestore(hba->host->host_lock, flags);
639c70977d10f4f Can Guo            2020-07-13  6695  
1d337ec2f35e69a Sujit Reddy Thumma 2014-09-25  6696  	do {
d8d9f7931ac2698 Bjorn Andersson    2019-08-28  6697  		/* Reset the attached device */
d8d9f7931ac2698 Bjorn Andersson    2019-08-28  6698  		ufshcd_vops_device_reset(hba);
d8d9f7931ac2698 Bjorn Andersson    2019-08-28  6699  
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26  6700  		err = ufshcd_host_reset_and_restore(hba);
1d337ec2f35e69a Sujit Reddy Thumma 2014-09-25  6701  	} while (err && --retries);
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26  6702  
639c70977d10f4f Can Guo            2020-07-13  6703  	spin_lock_irqsave(hba->host->host_lock, flags);
639c70977d10f4f Can Guo            2020-07-13  6704  	/*
639c70977d10f4f Can Guo            2020-07-13  6705  	 * Inform scsi mid-layer that we did reset and allow to handle
639c70977d10f4f Can Guo            2020-07-13  6706  	 * Unit Attention properly.
639c70977d10f4f Can Guo            2020-07-13  6707  	 */
639c70977d10f4f Can Guo            2020-07-13  6708  	scsi_report_bus_reset(hba->host, 0);
639c70977d10f4f Can Guo            2020-07-13  6709  	if (err) {
639c70977d10f4f Can Guo            2020-07-13  6710  		hba->ufshcd_state = UFSHCD_STATE_ERROR;
639c70977d10f4f Can Guo            2020-07-13  6711  		hba->saved_err |= saved_err;
639c70977d10f4f Can Guo            2020-07-13  6712  		hba->saved_uic_err |= saved_uic_err;
639c70977d10f4f Can Guo            2020-07-13  6713  	}
639c70977d10f4f Can Guo            2020-07-13 @6714  	spin_unlock_irqrestore(hba->host->host_lock, flags);
639c70977d10f4f Can Guo            2020-07-13  6715  
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26  6716  	return err;
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26  6717  }
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26  6718  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36016 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-07-14 20:46 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-14  2:28 [PATCH v2 0/4] Fix up and simplify error recovery mechanism Can Guo
2020-07-14  2:28 ` [PATCH v2 1/4] scsi: ufs: Add checks before setting clk-gating states Can Guo
2020-07-14  3:38   ` Bart Van Assche
2020-07-14  4:11     ` Can Guo
2020-07-14  2:28 ` [PATCH v2 2/4] scsi: ufs: Fix imbalanced scsi_block_reqs_cnt caused by ufshcd_hold() Can Guo
2020-07-14  3:41   ` Bart Van Assche
2020-07-14  4:11     ` Can Guo
2020-07-14  2:28 ` [PATCH v2 3/4] ufs: ufs-qcom: Fix a few BUGs in func ufs_qcom_dump_dbg_regs() Can Guo
2020-07-14  3:47   ` Bart Van Assche
2020-07-14  4:17     ` Can Guo
2020-07-14  2:28 ` [PATCH v2 4/4] scsi: ufs: Fix up and simplify error recovery mechanism Can Guo
2020-07-14  3:52   ` Bart Van Assche
2020-07-14  4:26     ` Can Guo
2020-07-14  9:13       ` Can Guo
  -- strict thread matches above, loose matches on Subject: below --
2020-07-14 20:46 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.