Re: NFS deadlock explained (on S/390)

Ulrich Weigand (Ulrich.Weigand@de.ibm.com)
Mon, 3 Sep 2001 14:35:43 +0200


Manfred Spraul:

>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.

>> 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: Ulrich.Weigand@de.ibm.com

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/