public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: linux-kernel@vger.kernel.org
Cc: werner.almesberger@epfl.ch
Subject: ATM stack locking broken
Date: 12 Nov 2002 19:11:19 +0100	[thread overview]
Message-ID: <1037124679.2774.111.camel@zion> (raw)

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.



             reply	other threads:[~2002-11-12 18:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-12 18:11 Benjamin Herrenschmidt [this message]
2002-11-12 20:34 ` ATM stack locking broken romieu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1037124679.2774.111.camel@zion \
    --to=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=werner.almesberger@epfl.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox