mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
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,
	kwangwon.min@samsung.com, kwmad.kim@samsung.com,
	sh425.lee@samsung.com, quic_nguyenb@quicinc.com,
	cpgs@samsung.com, h10.kim@samsung.com
Subject: Re: [PATCH v1] scsi: ufs: core: changing the status to check inflight
Date: Fri, 5 Apr 2024 11:41:35 -0700	[thread overview]
Message-ID: <a70f1a3d-1ec9-496b-9b93-5d4b06b4f967@acm.org> (raw)
In-Reply-To: <20240405071601.84337-1-hy50.seo@samsung.com>

On 4/5/24 00:16, SEO HOYOUNG wrote:
> According to below the patch applied, lrbp->cmd do not will NULL
> after call release_scsi_cmd()
> So check the rq->state unconditionally even if it is completed normally
> in ufshcd_cmd_inflight()
> 
> If occurred abort status and tm_cmd timeout, will run err_handler
> for re-init UFS.
> Then err_handler will check pending request for clearing cmd.
> At that time, check if the state of rq is not MQ_RQ_IDLE.
> In other words, check if it is MQ_RQ_COMPLETE or MQ_RQ_IN_FLIGHT.
> If rq->state is MQ_RQ_COMPLETE, it is already completed in the block,
> so there is no need to process the queue.

The above description does not explain the motivation for this patch
very well. How about the following description?

"ufshcd_cmd_inflight() is used to check whether or not a command is
in progress. Make it skip commands that have already completed by
changing the !blk_mq_request_started(rq) check into blk_mq_rq_state(rq) 
!= MQ_RQ_IN_FLIGHT. We cannot rely on lrbp->cmd since lrbp->cmd is not
cleared when a command completes."

> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 21429eec1b82..3f47ea584cb1 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -3088,7 +3088,7 @@ bool ufshcd_cmd_inflight(struct scsi_cmnd *cmd)
>   		return false;
>   
>   	rq = scsi_cmd_to_rq(cmd);
> -	if (!blk_mq_request_started(rq))
> +	if (blk_mq_rq_state(rq) != MQ_RQ_IN_FLIGHT)
>   		return false;
>   
>   	return true;

Please convert the two return statements into a single return statement,
e.g. as follows:

	return cmd &&
	    blk_mq_rq_state(scsi_cmd_to_rq(cmd)) == MQ_RQ_IN_FLIGHT;

Thanks,

Bart.

      reply	other threads:[~2024-04-05 18:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20240405071217epcas2p470124e9f6e9066cb5cdc7f78557042e3@epcas2p4.samsung.com>
2024-04-05  7:16 ` SEO HOYOUNG
2024-04-05 18:41   ` Bart Van Assche [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=a70f1a3d-1ec9-496b-9b93-5d4b06b4f967@acm.org \
    --to=bvanassche@acm.org \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=cpgs@samsung.com \
    --cc=h10.kim@samsung.com \
    --cc=hy50.seo@samsung.com \
    --cc=jejb@linux.ibm.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=quic_nguyenb@quicinc.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

all inboxes | Powered by JetHome®