Skip to contentSkip to conversation

- ia64_ctx.lock deadlock

PATCH In review Jack Steiner 3 participants 3 messages Dec 27, 2003 – Dec 29, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 - ia64_ctx.lock deadlock

I hit a deadlock involving the ia64_ctx.lock. The lock
may be taken in interrupt context to process an IPI from smp_flush_tlb_mm.

Here is a patch:

include/asm-ia64/mmu_context.h +3 -2
@@ -95,12 +95,13 @@
 static inline mm_context_t
 get_mmu_context (struct mm_struct *mm)
 {
+	unsigned long flags;
 	mm_context_t context = mm->context;
 
 	if (context)
 		return context;
 
-	spin_lock(&ia64_ctx.lock);
+	spin_lock_irqsave(&ia64_ctx.lock, flags);
 	{
 		/* re-check, now that we've got the lock: */
 		context = mm->context;
@@ -110,7 +111,7 @@
 			mm->context = context = ia64_ctx.next++;
 		}
 	}
-	spin_unlock(&ia64_ctx.lock);
+	spin_unlock_irqrestore(&ia64_ctx.lock, flags);
 	return context;
 }
 
Signature · 4 lines
Thanks

Jack Steiner ([email protected])          651-683-5302
Principal Engineer                      SGI - Silicon Graphics, Inc.
#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Jack Steiner

Jack> I hit a deadlock involving the ia64_ctx.lock. The lock may be Jack> taken in interrupt context to process an IPI from Jack> smp_flush_tlb_mm.

The patch looks correct to me.

Thanks,

	--david
#2 lore raw
In reply to Jack Steiner

include/asm-ia64/mmu_context.h line 104

Quoted 6 lines · Jack Steiner

I hit a deadlock involving the ia64_ctx.lock. The lock
may be taken in interrupt context to process an IPI from smp_flush_tlb_mm.

Here is a patch:

include/asm-ia64/mmu_context.h +1 -1
-	spin_lock(&ia64_ctx.lock);
+	spin_lock_irqsave(&ia64_ctx.lock, flags);

Would it be better to use spin_lock_irq() / spin_unlock_irq() here? It seems to me this function is only called from task context.

Signature · 6 lines
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain