Skip to contentSkip to conversation

NFS deadlock explained (on S/390)

DISCUSSION Ulrich Weigand 1 participant 1 message Sep 3, 2001

lore
Share & tools
lore
#0 lore raw

Manfred Spraul:

Quoted 10 lines

I think in_irq() and in_interrupt() should check the cpu interrupt flag and return TRUE if the per-cpu interrupts are disabled.

The current behavious is just weird:

   spin_lock_bh();
   in_interrupt(); --> true
   spin_unlock_bh();
   spin_lock_irq();
   in_interrupt(); --> false
   spin_unlock_irq();

I see. Instead of checking the interrupt flag in in_irq(), spin_lock_irq could also simply increment the local_irq_count, just like spin_lock_bh increments the local_bh_count.

Quoted 8 lines
Quoted 3 lines

Whether this same situation can explain the deadlocks seen on other platforms depends on whether the drivers used there exhibit similar locking behaviours as the QDIO driver, of course.

It should be possible to detect that automatically: if dev_kfree_skb_any() is called outside irq context with disabled per-cpu interrupts then it's probably due to a spin_lock_irq() and could deadlock.

This would definitely solve the deadlock in our case. However, I'm not sure this doesn't have some adverse effect on other code; e.g. there are quite a few routines that use if (!in_interrupt()) as a bug-check, and some might possibly be called from inside a spin_lock_irq ...

Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

--
Dr. Ulrich Weigand
Linux for S/390 Design & Development
IBM Deutschland Entwicklung GmbH, Schoenaicher Str. 220, 71032 Boeblingen
Phone: +49-7031/16-3727 --- Email: [email protected]