Skip to contentSkip to conversation

sgi-xp: nested calls to spin_lock_irqsave()

PATCH In review Robin Holt 3 participants 3 messages Jun 27, 2012 – Jun 29, 2012

Subsystems (2)
lore
Share & tools
lore

Robin Holt

author
#0 lore raw

PATCH 1/1 sgi-xp: nested calls to spin_lock_irqsave()

The code here has a nested spin_lock_irqsave(). It's not needed since IRQs are already disabled and it causes a problem because it means that IRQs won't be enabled again at the end. The second call to spin_lock_irqsave() will overwrite the value of irq_flags and we can't restore the proper settings.

drivers/misc/sgi-xp/xpc_uv.c +2 -2
index 17bbacb..87b251a 100644
@@ -452,9 +452,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,
 
 		if (msg->activate_gru_mq_desc_gpa ! 		    part_uv->activate_gru_mq_desc_gpa) {
-			spin_lock_irqsave(&part_uv->flags_lock, irq_flags);
+			spin_lock(&part_uv->flags_lock);
 			part_uv->flags &= ~XPC_P_CACHED_ACTIVATE_GRU_MQ_DESC_UV;
-			spin_unlock_irqrestore(&part_uv->flags_lock, irq_flags);
+			spin_unlock(&part_uv->flags_lock);
 			part_uv->activate_gru_mq_desc_gpa  			    msg->activate_gru_mq_desc_gpa;
 		}
#1 lore raw
Quoted 5 lines · On Wed, 27 Jun 2012 08:51:55 -0500 Robin Holt <[email protected]> wrote:

The code here has a nested spin_lock_irqsave(). It's not needed since IRQs are already disabled and it causes a problem because it means that IRQs won't be enabled again at the end. The second call to spin_lock_irqsave() will overwrite the value of irq_flags and we can't restore the proper settings.

Please find large crayon and write on forehead "when fixing a bug, be sure to describe the end-user impact of that bug".

Then others will have a chance of deciding whether the fix should be backported.

Quoted 2 lines

I'm wondering if there should have been a Reported-by:dan in there. He's like that.

#2 lore raw

This is actually my patch, so the patch description is my fault. It's a static checker patch and I don't have the hardware, but the changelog could have been written more clearly as well.

Robin, the trick to resending patches is to put a:

From: Dan Carpenter <[email protected]>

before the patch description and then it shows up as mine.

Also, btw, Robin, I'm looking through my mailbox again and you did respond to the patch the first time I sent it. Sorry, that I didn't see that before, and thanks for your help on this.

regards,
dan carpenter