mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Garry <john.g.garry@oracle.com>
To: TJ Adams <tadamsjr@google.com>,
	Jack Wang <jinpu.wang@cloud.ionos.com>,
	"James E . J . Bottomley" <James.Bottomley@HansenPartnership.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Igor Pylypiv <ipylypiv@google.com>
Subject: Re: [PATCH] scsi: pm80xx: Remove msleep() loop from pm8001_dev_gone_notify()
Date: Tue, 9 Jul 2024 17:09:38 +0100	[thread overview]
Message-ID: <784f6b4a-7c43-4484-988e-73fad594c99d@oracle.com> (raw)
In-Reply-To: <20240709160013.634308-1-tadamsjr@google.com>

On 09/07/2024 17:00, TJ Adams wrote:
> From: Igor Pylypiv <ipylypiv@google.com>
> 
> It's possible to end up in a state where pm8001_dev->running_req never
> reaches zero.

Is that a driver bug then?

> In that state we will be sleeping forever.
> 
> sas_execute_internal_abort_dev() can wait for a response for
> up to 60 seconds (3 retries x 20 seconds). 60 seconds should be enough
> for pm8001_dev->running_req to get to zero.

May I suggest you drop running_req at some stage, and use other methods 
to find how many IOs are active?

> 
> Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
> Signed-off-by: TJ Adams <tadamsjr@google.com>
> ---
>   drivers/scsi/pm8001/pm8001_sas.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
> index a5a31dfa4512..513e9a49838c 100644
> --- a/drivers/scsi/pm8001/pm8001_sas.c
> +++ b/drivers/scsi/pm8001/pm8001_sas.c
> @@ -712,8 +712,11 @@ static void pm8001_dev_gone_notify(struct domain_device *dev)
>   		if (atomic_read(&pm8001_dev->running_req)) {
>   			spin_unlock_irqrestore(&pm8001_ha->lock, flags);
>   			sas_execute_internal_abort_dev(dev, 0, NULL);
> -			while (atomic_read(&pm8001_dev->running_req))
> -				msleep(20);
> +			if (atomic_read(&pm8001_dev->running_req)) {
> +				pm8001_dbg(pm8001_ha, FAIL,
> +					   "device_id: %u: Failed to abort %d requests!\n",
> +					   device_id, atomic_read(&pm8001_dev->running_req));
> +			}
>   			spin_lock_irqsave(&pm8001_ha->lock, flags);
>   		}
>   		PM8001_CHIP_DISP->dereg_dev_req(pm8001_ha, device_id);


  reply	other threads:[~2024-07-09 16:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-09 16:00 TJ Adams
2024-07-09 16:09 ` John Garry [this message]
2024-11-18 18:00   ` TJ Adams

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=784f6b4a-7c43-4484-988e-73fad594c99d@oracle.com \
    --to=john.g.garry@oracle.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=ipylypiv@google.com \
    --cc=jinpu.wang@cloud.ionos.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=tadamsjr@google.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®