* [PATCH v2] scsi: ufs: core: Do not hold any lock in ufshcd_hba_stop
@ 2024-11-28 7:25 Avri Altman
2024-12-09 19:13 ` Bart Van Assche
2024-12-10 2:46 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Avri Altman @ 2024-11-28 7:25 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, linux-kernel, Bart Van Assche, Avri Altman
This change is motivated by Bart's suggestion in [1], which enables to
further reduce the scsi host lock usage in the ufs driver. The reason
why it make sense, because although the legacy interrupt is disabled by
some but not all ufshcd_hba_stop() callers, it is safe to nest
disable_irq() calls as it checks the irq depth.
[1] https://lore.kernel.org/linux-scsi/c58e4fce-0a74-4469-ad16-f1edbd670728@acm.org/
Suggested-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Avri Altman <avri.altman@wdc.com>
---
Changes compared to v1:
- ensure that interrupts are only re-enabled after the controller has
been fully disabled (Bart)
---
drivers/ufs/core/ufshcd.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index acc3607bbd9c..2e4748077275 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -4811,20 +4811,14 @@ EXPORT_SYMBOL_GPL(ufshcd_make_hba_operational);
*/
void ufshcd_hba_stop(struct ufs_hba *hba)
{
- unsigned long flags;
int err;
- /*
- * Obtain the host lock to prevent that the controller is disabled
- * while the UFS interrupt handler is active on another CPU.
- */
- spin_lock_irqsave(hba->host->host_lock, flags);
+ ufshcd_disable_irq(hba);
ufshcd_writel(hba, CONTROLLER_DISABLE, REG_CONTROLLER_ENABLE);
- spin_unlock_irqrestore(hba->host->host_lock, flags);
-
err = ufshcd_wait_for_register(hba, REG_CONTROLLER_ENABLE,
CONTROLLER_ENABLE, CONTROLLER_DISABLE,
10, 1);
+ ufshcd_enable_irq(hba);
if (err)
dev_err(hba->dev, "%s: Controller disable failed\n", __func__);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] scsi: ufs: core: Do not hold any lock in ufshcd_hba_stop
2024-11-28 7:25 [PATCH v2] scsi: ufs: core: Do not hold any lock in ufshcd_hba_stop Avri Altman
@ 2024-12-09 19:13 ` Bart Van Assche
2024-12-10 2:46 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Bart Van Assche @ 2024-12-09 19:13 UTC (permalink / raw)
To: Avri Altman, Martin K . Petersen; +Cc: linux-scsi, linux-kernel
On 11/27/24 11:25 PM, Avri Altman wrote:
> This change is motivated by Bart's suggestion in [1], which enables to
> further reduce the scsi host lock usage in the ufs driver. The reason
> why it make sense, because although the legacy interrupt is disabled by
> some but not all ufshcd_hba_stop() callers, it is safe to nest
> disable_irq() calls as it checks the irq depth.
>
> [1] https://lore.kernel.org/linux-scsi/c58e4fce-0a74-4469-ad16-f1edbd670728@acm.org/
>
> Suggested-by: Bart Van Assche <bvanassche@acm.org>
> Signed-off-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] scsi: ufs: core: Do not hold any lock in ufshcd_hba_stop
2024-11-28 7:25 [PATCH v2] scsi: ufs: core: Do not hold any lock in ufshcd_hba_stop Avri Altman
2024-12-09 19:13 ` Bart Van Assche
@ 2024-12-10 2:46 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2024-12-10 2:46 UTC (permalink / raw)
To: Avri Altman
Cc: Martin K . Petersen, linux-scsi, linux-kernel, Bart Van Assche
Avri,
> This change is motivated by Bart's suggestion in [1], which enables to
> further reduce the scsi host lock usage in the ufs driver. The reason
> why it make sense, because although the legacy interrupt is disabled
> by some but not all ufshcd_hba_stop() callers, it is safe to nest
> disable_irq() calls as it checks the irq depth.
Applied to 6.14/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-12-10 2:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-28 7:25 [PATCH v2] scsi: ufs: core: Do not hold any lock in ufshcd_hba_stop Avri Altman
2024-12-09 19:13 ` Bart Van Assche
2024-12-10 2:46 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox