All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Xingui Yang" <yangxingui@huawei.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v2] scsi: libsas: Fix SMP IO deadlock during HA resume
Date: Thu, 17 Sep 2026 13:17:58 +0000	[thread overview]
Message-ID: <20260917131758.A2F4A1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260917130642.1796231-1-yangxingui@huawei.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] libsas: missed PM autosuspend in smp_execute_task_sg()
--

commit 8e09b6455fc925eb255f96d9d3584cbd10d1bdaa
Author: Xingui Yang <yangxingui@huawei.com>

scsi: libsas: Fix SMP IO deadlock during HA resume

This commit fixes a deadlock during controller resume by using
pm_runtime_get_noresume() and pm_runtime_put_noidle() when
SAS_HA_RESUMING is set. Outside of the resume window, it converts
pm_runtime_get_sync() to pm_runtime_resume_and_get() to handle
runtime resume failures.

> diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
> index 811c9eb4fef11..a17b938cd3b7c 100644
> --- a/drivers/scsi/libsas/sas_expander.c
> +++ b/drivers/scsi/libsas/sas_expander.c

[ ... ]

> @@ -135,7 +150,10 @@ static int smp_execute_task_sg(struct domain_device *dev,
>  		}
>  	}
>  	mutex_unlock(&dev->ex_dev.cmd_mutex);
> -	pm_runtime_put_sync(ha->dev);
> +	if (ha_resuming)
> +		pm_runtime_put_noidle(ha->dev);

[Severity: Medium]
Does this leave the device permanently in the RPM_ACTIVE state if this
thread outlives the host resume?

If an independent thread starts an SMP IO while SAS_HA_RESUMING is set,
it increments the PM usage count via pm_runtime_get_noresume(). If the
host resume process finishes before this SMP IO completes, the PM core
drops its own reference and performs an idle check, which fails because
this independent thread still holds a reference.

When this thread finishes and calls pm_runtime_put_noidle(), the usage
count drops to 0 but the idle check is explicitly skipped. This means
no autosuspend will be queued, and the device might leak its active
state, preventing the controller from autosuspending and leading to
higher power consumption.

> +	else
> +		pm_runtime_put_sync(ha->dev);
>  
>  	BUG_ON(retry == 3 && task != NULL);
>  	sas_free_task(task);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260917130642.1796231-1-yangxingui@huawei.com?part=1

  reply	other threads:[~2026-09-17 13:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 13:06 [PATCH v2] scsi: libsas: Fix SMP IO deadlock during HA resume Xingui Yang
2026-09-17 13:17 ` sashiko-bot [this message]
2026-09-18  6:59   ` yangxingui

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=20260917131758.A2F4A1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=yangxingui@huawei.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 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.