Linux SCSI subsystem development
 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 1/3] scsi: hisi_sas: Fix incorrect delay values from magic-number cleanup
Date: Sat, 29 Aug 2026 03:36:28 +0000	[thread overview]
Message-ID: <20260829033628.9802D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260829032858.1661019-2-yangxingui@huawei.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Hardware callback executes a 50ms busy-wait delay while holding an IRQ-disabled spinlock, severely degrading system latency and risking watchdog timeouts.
--

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

scsi: hisi_sas: Fix incorrect delay values from magic-number cleanup

This commit fixes incorrect delay values in the hisi_sas v3 hardware driver
that were introduced during a magic-number cleanup. It adds separate macros
for each delay site to restore their original timings of 50us, 50ms, and
10ms respectively.

> diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
> index 8a2500993e19d..9c363e2373538 100644
> --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
> +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

[ ... ]

> @@ -1072,7 +1075,7 @@ static void disable_phy_v3_hw(struct hisi_hba *hisi_hba, int phy_no)
>  	cfg &= ~PHY_CFG_ENA_MSK;
>  	hisi_sas_phy_write32(hisi_hba, phy_no, PHY_CFG, cfg);
>  
> -	mdelay(HISI_SAS_DELAY_FOR_PHY_DISABLE);
> +	mdelay(DISABLE_PHY_DELAY_MS);

[Severity: High]
This is a pre-existing issue, but is it safe to use a 50ms busy-wait delay
here while holding an IRQ-disabled spinlock?

Looking at hisi_sas_phy_enable() in drivers/scsi/hisi_sas/hisi_sas_main.c,
the hardware callback is invoked with interrupts disabled:

hisi_sas_phy_enable() {
        ...
        spin_lock_irqsave(&phy->lock, flags);
        if (enable) {
                ...
        } else {
                phy->negotiated_linkrate = SAS_PHY_DISABLED;
                hisi_hba->hw->phy_disable(hisi_hba, phy_no);
        }
        ...
}

Since hisi_hba->hw->phy_disable resolves to disable_phy_v3_hw(), this will
block the CPU with interrupts disabled for 50ms. When looping over multiple
PHYs in hisi_sas_stop_phys(), this delay can multiply, potentially causing
severe scheduling latency, dropped interrupts, or triggering softlockup
panics.

Could this delay be moved outside the spinlock, or could we use a sleepable
context here instead?

[ ... ]

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

  reply	other threads:[~2026-08-29  3:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-29  3:28 [PATCH 0/3] scsi: hisi_sas: Some Misc fixes Xingui Yang
2026-08-29  3:28 ` [PATCH 1/3] scsi: hisi_sas: Fix incorrect delay values from magic-number cleanup Xingui Yang
2026-08-29  3:36   ` sashiko-bot [this message]
2026-08-29  3:28 ` [PATCH 2/3] scsi: hisi_sas: Clear PHY error counts on phyup Xingui Yang
2026-08-29  3:56   ` sashiko-bot
2026-08-29  3:28 ` [PATCH 3/3] scsi: hisi_sas: Fix spinup failure for SAS SSP devices in Active_Wait state Xingui Yang
2026-08-29  3:56   ` sashiko-bot

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=20260829033628.9802D1F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox