mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Fulghum <paulkf@microgate.com>
To: snits@snitselaar.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: Problem: Possible deadlock for 2.4 SMP systems
Date: Thu, 16 Feb 2006 13:55:23 -0600	[thread overview]
Message-ID: <43F4D8AB.5040708@microgate.com> (raw)
In-Reply-To: <48822.198.115.32.5.1139956559.squirrel@cantor.snitselaar.org>

Gerard Snitselaar wrote:
> What appears to happen is cpu0 calls cli() in
> shutdown() (drivers/char/serial.c), grabbing global_irq_lock.
> Meanwhile cpu1 sets IRQ_INPROGRESS, and eventually calls
> handle_IRQ_event() and spins on global_irq_lock in irq_enter().
> CPU0 calls free_irq() and eventually gets to the point where
> it spins while IRQ_INPROGRESS is set. Since cpu0 is holding
> global_irq_lock, cpu1 can't do its work and clear IRQ_INPROGRESS.

 From looking at irq.c (2.4.31) I guess that calling free_irq()
on SMP after cli() is not safe because of the race you describe.

> I read somewhere that global_irq_lock is deprecated, so is there
> something that the serial driver should be doing instead of cli()
> and restore_flags() in shutdown()?

shutdown() seems a little backwards:
it calls free_irq(), then it disables device interrupts.

One way of handling this may be to move the code
block (the if statement after 'Free the IRQ' comment)
that calls free_irq() to after the restore_flags().

At that point, the device is no longer generating
interrupts and has been removed from the IRQ_ports
list so the ISR will not touch the device instance
and free_irq() can finish safely.

-- 
Paul Fulghum
Microgate Systems, Ltd.

      reply	other threads:[~2006-02-16 19:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-14 22:35 Gerard Snitselaar
2006-02-16 19:55 ` Paul Fulghum [this message]

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=43F4D8AB.5040708@microgate.com \
    --to=paulkf@microgate.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=snits@snitselaar.org \
    /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

Powered by JetHome