From: kernel test robot <lkp@intel.com>
To: SEO HOYOUNG <hy50.seo@samsung.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com,
martin.petersen@oracle.com, beanhuo@micron.com,
bvanassche@acm.org, kwangwon.min@samsung.com,
kwmad.kim@samsung.com, sh425.lee@samsung.com, sc.suh@samsung.com,
quic_nguyenb@quicinc.com, cpgs@samsung.com,
grant.jung@samsung.com, junwoo80.lee@samsung.com
Cc: oe-kbuild-all@lists.linux.dev, SEO HOYOUNG <hy50.seo@samsung.com>
Subject: Re: [PATCH v1] scsi: ufs: core: fix racing issue during ufshcd_mcq_abort
Date: Mon, 13 Nov 2023 23:37:12 +0800 [thread overview]
Message-ID: <202311132304.bqVcJ27s-lkp@intel.com> (raw)
In-Reply-To: <20231113112935.16343-1-hy50.seo@samsung.com>
Hi SEO,
kernel test robot noticed the following build errors:
[auto build test ERROR on jejb-scsi/for-next]
[also build test ERROR on mkp-scsi/for-next linus/master v6.7-rc1 next-20231113]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/SEO-HOYOUNG/scsi-ufs-core-fix-racing-issue-during-ufshcd_mcq_abort/20231113-194433
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
patch link: https://lore.kernel.org/r/20231113112935.16343-1-hy50.seo%40samsung.com
patch subject: [PATCH v1] scsi: ufs: core: fix racing issue during ufshcd_mcq_abort
config: arc-randconfig-001-20231113 (https://download.01.org/0day-ci/archive/20231113/202311132304.bqVcJ27s-lkp@intel.com/config)
compiler: arceb-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231113/202311132304.bqVcJ27s-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311132304.bqVcJ27s-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/ufs/core/ufshcd.c: In function 'ufshcd_try_to_abort_task':
>> drivers/ufs/core/ufshcd.c:7571:34: error: 'cmd' undeclared (first use in this function)
7571 | if (!ufshcd_cmd_inflight(cmd) ||
| ^~~
drivers/ufs/core/ufshcd.c:7571:34: note: each undeclared identifier is reported only once for each function it appears in
vim +/cmd +7571 drivers/ufs/core/ufshcd.c
7484
7485 /**
7486 * ufshcd_try_to_abort_task - abort a specific task
7487 * @hba: Pointer to adapter instance
7488 * @tag: Task tag/index to be aborted
7489 *
7490 * Abort the pending command in device by sending UFS_ABORT_TASK task management
7491 * command, and in host controller by clearing the door-bell register. There can
7492 * be race between controller sending the command to the device while abort is
7493 * issued. To avoid that, first issue UFS_QUERY_TASK to check if the command is
7494 * really issued and then try to abort it.
7495 *
7496 * Return: zero on success, non-zero on failure.
7497 */
7498 int ufshcd_try_to_abort_task(struct ufs_hba *hba, int tag)
7499 {
7500 struct ufshcd_lrb *lrbp = &hba->lrb[tag];
7501 int err = 0;
7502 int poll_cnt;
7503 u8 resp = 0xF;
7504 u32 reg;
7505
7506 for (poll_cnt = 100; poll_cnt; poll_cnt--) {
7507 err = ufshcd_issue_tm_cmd(hba, lrbp->lun, lrbp->task_tag,
7508 UFS_QUERY_TASK, &resp);
7509 if (!err && resp == UPIU_TASK_MANAGEMENT_FUNC_SUCCEEDED) {
7510 /* cmd pending in the device */
7511 dev_err(hba->dev, "%s: cmd pending in the device. tag = %d\n",
7512 __func__, tag);
7513 break;
7514 } else if (!err && resp == UPIU_TASK_MANAGEMENT_FUNC_COMPL) {
7515 /*
7516 * cmd not pending in the device, check if it is
7517 * in transition.
7518 */
7519 dev_err(hba->dev, "%s: cmd at tag %d not pending in the device.\n",
7520 __func__, tag);
7521 if (is_mcq_enabled(hba)) {
7522 /* MCQ mode */
7523 if (ufshcd_cmd_inflight(lrbp->cmd)) {
7524 /* sleep for max. 200us same delay as in SDB mode */
7525 usleep_range(100, 200);
7526 continue;
7527 }
7528 /* command completed already */
7529 dev_err(hba->dev, "%s: cmd at tag=%d is cleared.\n",
7530 __func__, tag);
7531 goto out;
7532 }
7533
7534 /* Single Doorbell Mode */
7535 reg = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
7536 if (reg & (1 << tag)) {
7537 /* sleep for max. 200us to stabilize */
7538 usleep_range(100, 200);
7539 continue;
7540 }
7541 /* command completed already */
7542 dev_err(hba->dev, "%s: cmd at tag %d successfully cleared from DB.\n",
7543 __func__, tag);
7544 goto out;
7545 } else {
7546 dev_err(hba->dev,
7547 "%s: no response from device. tag = %d, err %d\n",
7548 __func__, tag, err);
7549 if (!err)
7550 err = resp; /* service response error */
7551 goto out;
7552 }
7553 }
7554
7555 if (!poll_cnt) {
7556 err = -EBUSY;
7557 goto out;
7558 }
7559
7560 err = ufshcd_issue_tm_cmd(hba, lrbp->lun, lrbp->task_tag,
7561 UFS_ABORT_TASK, &resp);
7562 if (err || resp != UPIU_TASK_MANAGEMENT_FUNC_COMPL) {
7563 if (!err) {
7564 err = resp; /* service response error */
7565 dev_err(hba->dev, "%s: issued. tag = %d, err %d\n",
7566 __func__, tag, err);
7567 }
7568 goto out;
7569 }
7570
> 7571 if (!ufshcd_cmd_inflight(cmd) ||
7572 test_bit(SCMD_STATE_COMPLETE, &cmd->state))
7573 goto out;
7574
7575 err = ufshcd_clear_cmd(hba, tag);
7576 if (err)
7577 dev_err(hba->dev, "%s: Failed clearing cmd at tag %d, err %d\n",
7578 __func__, tag, err);
7579
7580 out:
7581 return err;
7582 }
7583
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
prev parent reply other threads:[~2023-11-13 15:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20231113112703epcas2p3522b4ea309a6f767adc4170ded172cf4@epcas2p3.samsung.com>
2023-11-13 11:29 ` [PATCH v1] scsi: ufs: core: fix racing issue during ufshcd_mcq_abort SEO HOYOUNG
2023-11-13 15:37 ` kernel test robot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202311132304.bqVcJ27s-lkp@intel.com \
--to=lkp@intel.com \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=cpgs@samsung.com \
--cc=grant.jung@samsung.com \
--cc=hy50.seo@samsung.com \
--cc=jejb@linux.ibm.com \
--cc=junwoo80.lee@samsung.com \
--cc=kwangwon.min@samsung.com \
--cc=kwmad.kim@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=quic_nguyenb@quicinc.com \
--cc=sc.suh@samsung.com \
--cc=sh425.lee@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox