* [PATCH 1/4] drivers/scsi/qla2xxx/qla_init.c: convert nested spin_lock_irqsave to spin_lock
@ 2010-10-19 9:43 Julia Lawall
[not found] ` <1287481436-26656-1-git-send-email-julia-dAYI7NvHqcQ@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2010-10-19 9:43 UTC (permalink / raw)
To: Andrew Vasquez
Cc: kernel-janitors, linux-driver, James E.J. Bottomley, Grant Likely,
linux-scsi, linux-kernel, devicetree-discuss
From: Julia Lawall <julia@diku.dk>
If spin_lock_irqsave is called twice in a row with the same second
argument, the interrupt state at the point of the second call overwrites
the value saved by the first call. Indeed, the second call does not need
to save the interrupt state, so it is changed to a simple spin_lock.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression lock1,lock2;
expression flags;
@@
*spin_lock_irqsave(lock1,flags)
... when != flags
*spin_lock_irqsave(lock2,flags)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/scsi/qla2xxx/qla_init.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 3cafbef..c8d0b12 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1818,14 +1818,14 @@ qla2x00_init_rings(scsi_qla_host_t *vha)
qla2x00_init_response_q_entries(rsp);
}
- spin_lock_irqsave(&ha->vport_slock, flags);
+ spin_lock(&ha->vport_slock);
/* Clear RSCN queue. */
list_for_each_entry(vp, &ha->vp_list, list) {
vp->rscn_in_ptr = 0;
vp->rscn_out_ptr = 0;
}
- spin_unlock_irqrestore(&ha->vport_slock, flags);
+ spin_unlock(&ha->vport_slock);
ha->isp_ops->config_rings(vha);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH 1/4] drivers/scsi/qla2xxx/qla_init.c: convert nested spin_lock_irqsave to spin_lock
[not found] ` <1287481436-26656-1-git-send-email-julia-dAYI7NvHqcQ@public.gmane.org>
@ 2010-10-19 16:21 ` Madhu Iyengar
0 siblings, 0 replies; 2+ messages in thread
From: Madhu Iyengar @ 2010-10-19 16:21 UTC (permalink / raw)
To: Julia Lawall, Andrew Vasquez, Madhu Iyengar, Giridhar Malavali
Cc: linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
James E.J. Bottomley, Linux Driver
Julia,
We've submitted this patch upstream to scsi-misc already on Oct 15th (Dan Carpenter had flagged this). Here's the submission info (patch (01/12) or item #12 in the link below:
http://marc.info/?l=linux-scsi&w=2&r=1&s=qla2xxx&q=b
Thanks,
Madhu
-----Original Message-----
From: linux-scsi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [mailto:linux-scsi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Julia Lawall
Sent: Tuesday, October 19, 2010 2:44 AM
To: Andrew Vasquez
Cc: kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Linux Driver; James E.J. Bottomley; Grant Likely; linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: [PATCH 1/4] drivers/scsi/qla2xxx/qla_init.c: convert nested spin_lock_irqsave to spin_lock
From: Julia Lawall <julia-dAYI7NvHqcQ@public.gmane.org>
If spin_lock_irqsave is called twice in a row with the same second
argument, the interrupt state at the point of the second call overwrites
the value saved by the first call. Indeed, the second call does not need
to save the interrupt state, so it is changed to a simple spin_lock.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression lock1,lock2;
expression flags;
@@
*spin_lock_irqsave(lock1,flags)
... when != flags
*spin_lock_irqsave(lock2,flags)
// </smpl>
Signed-off-by: Julia Lawall <julia-dAYI7NvHqcQ@public.gmane.org>
---
drivers/scsi/qla2xxx/qla_init.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 3cafbef..c8d0b12 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1818,14 +1818,14 @@ qla2x00_init_rings(scsi_qla_host_t *vha)
qla2x00_init_response_q_entries(rsp);
}
- spin_lock_irqsave(&ha->vport_slock, flags);
+ spin_lock(&ha->vport_slock);
/* Clear RSCN queue. */
list_for_each_entry(vp, &ha->vp_list, list) {
vp->rscn_in_ptr = 0;
vp->rscn_out_ptr = 0;
}
- spin_unlock_irqrestore(&ha->vport_slock, flags);
+ spin_unlock(&ha->vport_slock);
ha->isp_ops->config_rings(vha);
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-19 16:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-19 9:43 [PATCH 1/4] drivers/scsi/qla2xxx/qla_init.c: convert nested spin_lock_irqsave to spin_lock Julia Lawall
[not found] ` <1287481436-26656-1-git-send-email-julia-dAYI7NvHqcQ@public.gmane.org>
2010-10-19 16:21 ` Madhu Iyengar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox