public inbox for linux-ide@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ata: libata-scsi: Remove superfluous local_irq_save()
@ 2025-12-04 13:18 Niklas Cassel
  2025-12-04 13:21 ` Niklas Cassel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Niklas Cassel @ 2025-12-04 13:18 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel; +Cc: Hannes Reinecke, linux-ide

Commit 28a3fc2295a7 ("libata: implement ZBC IN translation") added
ata_scsi_report_zones_complete(). Since the beginning, this function
has disabled IRQs on the local CPU using local_irq_save().

qc->complete_fn is always called with ap->lock held, and the ap->lock
is always taking using spin_lock_irq*().

Thus, this local_irq_save() is superfluous and can be removed.

Signed-off-by: Niklas Cassel <cassel@kernel.org>
---
 drivers/ata/libata-scsi.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 434774e71fe61..86d283d340e32 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3572,13 +3572,13 @@ static void ata_scsi_report_zones_complete(struct ata_queued_cmd *qc)
 {
 	struct scsi_cmnd *scmd = qc->scsicmd;
 	struct sg_mapping_iter miter;
-	unsigned long flags;
 	unsigned int bytes = 0;
 
+	lockdep_assert_held(qc->ap->lock);
+
 	sg_miter_start(&miter, scsi_sglist(scmd), scsi_sg_count(scmd),
 		       SG_MITER_TO_SG | SG_MITER_ATOMIC);
 
-	local_irq_save(flags);
 	while (sg_miter_next(&miter)) {
 		unsigned int offset = 0;
 
@@ -3626,7 +3626,6 @@ static void ata_scsi_report_zones_complete(struct ata_queued_cmd *qc)
 		}
 	}
 	sg_miter_stop(&miter);
-	local_irq_restore(flags);
 
 	ata_scsi_qc_complete(qc);
 }
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ata: libata-scsi: Remove superfluous local_irq_save()
  2025-12-04 13:18 [PATCH] ata: libata-scsi: Remove superfluous local_irq_save() Niklas Cassel
@ 2025-12-04 13:21 ` Niklas Cassel
  2025-12-05  7:31 ` Hannes Reinecke
  2025-12-08  0:01 ` Damien Le Moal
  2 siblings, 0 replies; 4+ messages in thread
From: Niklas Cassel @ 2025-12-04 13:21 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: Hannes Reinecke, linux-ide

On Thu, Dec 04, 2025 at 02:18:04PM +0100, Niklas Cassel wrote:
> Commit 28a3fc2295a7 ("libata: implement ZBC IN translation") added
> ata_scsi_report_zones_complete(). Since the beginning, this function
> has disabled IRQs on the local CPU using local_irq_save().
> 
> qc->complete_fn is always called with ap->lock held, and the ap->lock
> is always taking using spin_lock_irq*().

s/taking/taken/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ata: libata-scsi: Remove superfluous local_irq_save()
  2025-12-04 13:18 [PATCH] ata: libata-scsi: Remove superfluous local_irq_save() Niklas Cassel
  2025-12-04 13:21 ` Niklas Cassel
@ 2025-12-05  7:31 ` Hannes Reinecke
  2025-12-08  0:01 ` Damien Le Moal
  2 siblings, 0 replies; 4+ messages in thread
From: Hannes Reinecke @ 2025-12-05  7:31 UTC (permalink / raw)
  To: Niklas Cassel, Damien Le Moal; +Cc: linux-ide

On 12/4/25 14:18, Niklas Cassel wrote:
> Commit 28a3fc2295a7 ("libata: implement ZBC IN translation") added
> ata_scsi_report_zones_complete(). Since the beginning, this function
> has disabled IRQs on the local CPU using local_irq_save().
> 
> qc->complete_fn is always called with ap->lock held, and the ap->lock
> is always taking using spin_lock_irq*().
> 
> Thus, this local_irq_save() is superfluous and can be removed.
> 
> Signed-off-by: Niklas Cassel <cassel@kernel.org>
> ---
>   drivers/ata/libata-scsi.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index 434774e71fe61..86d283d340e32 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -3572,13 +3572,13 @@ static void ata_scsi_report_zones_complete(struct ata_queued_cmd *qc)
>   {
>   	struct scsi_cmnd *scmd = qc->scsicmd;
>   	struct sg_mapping_iter miter;
> -	unsigned long flags;
>   	unsigned int bytes = 0;
>   
> +	lockdep_assert_held(qc->ap->lock);
> +
>   	sg_miter_start(&miter, scsi_sglist(scmd), scsi_sg_count(scmd),
>   		       SG_MITER_TO_SG | SG_MITER_ATOMIC);
>   
> -	local_irq_save(flags);
>   	while (sg_miter_next(&miter)) {
>   		unsigned int offset = 0;
>   
> @@ -3626,7 +3626,6 @@ static void ata_scsi_report_zones_complete(struct ata_queued_cmd *qc)
>   		}
>   	}
>   	sg_miter_stop(&miter);
> -	local_irq_restore(flags);
>   
>   	ata_scsi_qc_complete(qc);
>   }

Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare@suse.de                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ata: libata-scsi: Remove superfluous local_irq_save()
  2025-12-04 13:18 [PATCH] ata: libata-scsi: Remove superfluous local_irq_save() Niklas Cassel
  2025-12-04 13:21 ` Niklas Cassel
  2025-12-05  7:31 ` Hannes Reinecke
@ 2025-12-08  0:01 ` Damien Le Moal
  2 siblings, 0 replies; 4+ messages in thread
From: Damien Le Moal @ 2025-12-08  0:01 UTC (permalink / raw)
  To: Niklas Cassel; +Cc: Hannes Reinecke, linux-ide

On 12/4/25 10:18 PM, Niklas Cassel wrote:
> Commit 28a3fc2295a7 ("libata: implement ZBC IN translation") added
> ata_scsi_report_zones_complete(). Since the beginning, this function
> has disabled IRQs on the local CPU using local_irq_save().
> 
> qc->complete_fn is always called with ap->lock held, and the ap->lock
> is always taking using spin_lock_irq*().
> 
> Thus, this local_irq_save() is superfluous and can be removed.
> 
> Signed-off-by: Niklas Cassel <cassel@kernel.org>

I staged this in for-6.20, which I will rebase once rc1 is out.


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-12-08  0:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-04 13:18 [PATCH] ata: libata-scsi: Remove superfluous local_irq_save() Niklas Cassel
2025-12-04 13:21 ` Niklas Cassel
2025-12-05  7:31 ` Hannes Reinecke
2025-12-08  0:01 ` Damien Le Moal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox