linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ATM stack locking broken
@ 2002-11-12 18:11 Benjamin Herrenschmidt
  2002-11-12 20:34 ` romieu
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2002-11-12 18:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: werner.almesberger

Hi !

I've spent some time trying to figure out why an ATM driver
I was hacking with kept deadlocking until I figured out the
problem actually is the kernel ATM stack on SMP.

spinlock usage in net/atm/* seem to be utterly broken, though
I don't know the ATM stack well enough myself to fix it quickly,
I though you may want to know about it :)

Typicaly examples are:

atm_ioctl() in net/atm/common.c

  That one grabs a spinlock for the entire duration of the
  function, which includes doing things like get/put_user
  (can schedule), copy_to/from_user (can schedule), or
  call the low level driver's ioctl() callback, which in
  lots of cases will want to be able to schedule as well.
  I'm not even looking at the other code path going deep
  inside the ATM code here.

The above is what I ran into. Quick look at the code shows
others though, like bind_vcc() beeing called with lock held,
itself calling then will call unlink_vcc() which can itself
eventually call shutdown_atm_dev(). At this point, you can
happily try to double take the spinlock (among others).
Another example is atm_do_connect_dev() called with the lock,
itself calling dev->open(). I can imagine a whole bunch of
reasons why the low driver would want to schedule in there.

Another issue is that this lock is protecting against another
CPU or preempt, but not against interrupts (maybe this is by
design though).

Regards,
Ben.



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ATM stack locking broken
  2002-11-12 18:11 ATM stack locking broken Benjamin Herrenschmidt
@ 2002-11-12 20:34 ` romieu
  0 siblings, 0 replies; 2+ messages in thread
From: romieu @ 2002-11-12 20:34 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linux-kernel, werner.almesberger

Benjamin Herrenschmidt <benh@kernel.crashing.org> :
[...]
> I've spent some time trying to figure out why an ATM driver
> I was hacking with kept deadlocking until I figured out the
> problem actually is the kernel ATM stack on SMP.
> 
> spinlock usage in net/atm/* seem to be utterly broken, though
> I don't know the ATM stack well enough myself to fix it quickly,

It's known (for quite some time :o/ )
Don't hold your breath until xmas.

--
Ueimor

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-11-12 20:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-12 18:11 ATM stack locking broken Benjamin Herrenschmidt
2002-11-12 20:34 ` romieu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).