linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Bart Van Assche <bvanassche@acm.org>,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: "James E . J . Bottomley" <jejb@linux.ibm.com>,
	Bean Huo <huobean@gmail.com>, Avri Altman <avri.altman@wdc.com>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Can Guo <cang@codeaurora.org>,
	Asutosh Das <asutoshd@codeaurora.org>,
	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	Wei Li <liwei213@huawei.com>,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH V4 1/3] scsi: ufs: Fix error handler clear ua deadlock
Date: Mon, 20 Sep 2021 20:30:57 +0300	[thread overview]
Message-ID: <85faef6e-d136-c0ec-cdc2-4a9e6c6223ee@intel.com> (raw)
In-Reply-To: <fb303d7d-d069-f503-a351-6791d5e21f38@acm.org>

On 17/09/21 8:58 pm, Bart Van Assche wrote:
> On 9/17/21 10:39 AM, Adrian Hunter wrote:
>> On 17/09/21 7:09 pm, Bart Van Assche wrote:
>>> On 9/16/21 10:02 AM, Adrian Hunter wrote:
>>>> -static void ufshcd_request_sense_done(struct request *rq, blk_status_t error)
>>>> +static int ufshcd_request_sense_direct(struct ufs_hba *hba, u8 wlun)
>>>>    {
>>> [ ... ]
>>>> +    /* The command queue cannot be frozen */
>>>> +    req = blk_get_request(q, REQ_OP_DRV_OUT, 0);
>>>
>>> hba->cmd_queue shares a tag set with the request queues associated with SCSI
>>> LUNs. Since this blk_get_request() call happens from the context of the error
>>> handler before SCSI requests are unblocked, it will hang if all tags are
>>> in use for SCSI requests before the error handler starts.
>>
>> All the commands sent by ufshcd_probe_hba() take the same approach, so no
>> difference there.
> 
> The same comment applies to the commands sent by ufshcd_probe_hba() I think.
> If you would like to address this issue, how about passing the flag
> BLK_MQ_REQ_RESERVED to the blk_get_request() call in ufshcd_exec_dev_cmd()?
> The following additional changes are required to make this work:
> * Add a 'reserved_tags' member to struct scsi_host_template, e.g. close to
>   tag_alloc_policy.
> * Modify scsi_mq_setup_tags() such that it copies the reserved_tags value
>   from the host template into tag_set->reserved_tags.
> * Set 'reserved_tags' in the UFS driver SCSI host template.

I think these things only happen on the reset path, so all the slots should
be free, even if all the tags are allocated.  With some care, it might be
possible simply to grab a free slot.

  reply	other threads:[~2021-09-20 17:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16 17:02 [PATCH V4 0/3] scsi: ufs: Let devices remain runtime suspended during system suspend Adrian Hunter
2021-09-16 17:02 ` [PATCH V4 1/3] scsi: ufs: Fix error handler clear ua deadlock Adrian Hunter
2021-09-17 16:09   ` Bart Van Assche
2021-09-17 17:39     ` Adrian Hunter
2021-09-17 17:58       ` Bart Van Assche
2021-09-20 17:30         ` Adrian Hunter [this message]
2021-09-20 20:33           ` Bart Van Assche
2021-09-16 17:02 ` [PATCH V4 2/3] scsi: ufs: Fix runtime PM dependencies getting broken Adrian Hunter
2021-09-16 17:02 ` [PATCH V4 3/3] scsi: ufs: Let devices remain runtime suspended during system suspend Adrian Hunter

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=85faef6e-d136-c0ec-cdc2-4a9e6c6223ee@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=bvanassche@acm.org \
    --cc=cang@codeaurora.org \
    --cc=huobean@gmail.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=liwei213@huawei.com \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=martin.petersen@oracle.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;
as well as URLs for NNTP newsgroup(s).