mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Darren Reed <darrenr@reed.wattle.id.au>
To: "linux-os (Dick Johnson)" <linux-os@analogic.com>
Cc: Darren Reed <darrenr@reed.wattle.id.au>, linux-kernel@vger.kernel.org
Subject: Re: 2.6.11: spinlock problem
Date: Sat, 24 Jun 2006 12:47:30 +1000 (EST)	[thread overview]
Message-ID: <200606240247.k5O2lU3C009083@firewall.reed.wattle.id.au> (raw)
In-Reply-To: <Pine.LNX.4.61.0606231331310.16810@chaos.analogic.com>

[ Charset ISO-8859-1 unsupported, converting... ]
> On Fri, 23 Jun 2006, Darren Reed wrote:
> 
> > Hi,
> >
> > I'm seeing a spinlock held panic with a kernel stack like this:
> >
> > spinlock - panic, lock already held
> > ..
> > __do_softirq
> > do_softirq
> > =========
> > do_IRQ
> > common_interrupt
> > spinlock/spinunlock
> > ..
> >
> > when I load up the system in testing.
> > The code protected by the spinlock is quite small - counter increment.
> >
> > I'm using 2.6.11-1.1369_FC4 #1, installed inside of vmware,
> > running as a guest on a Windows XP box.
> >
> > Is this
> > (a) linux allowing the IRQ too early
> > (b) vmware not doing something right
> > (c) enivitable
> > (d) somehow my fault
> > (e) something else?
> >
> > Thanks,
> > Darren
> 
> Where's the code? Also, did you initialize the spin-lock variable
> before use?

locks are intialised...code runs for a minute or so before panic'ing

I write my own wrappers to read/write_lock/unlock.

The call stack for the panic is:
panic
ipf_read_enter
..
do_softirq
=====
do_IRQ
common_interrupt
ipf_rw_exit

ipf_read_enter and ipf_rw_exit are being called for different locks.
The panic is occuring in the spin_lock() for the counter increment.
The counter incrememnt/decrement uses the same lock, regardless of
the counter being used.

I believe I'm hitting a race condition of sorts...I just don't know
who owns it yet - vmware or linux and I cant test running linux
natively at present because I only have one computer.

Darren

INLINE void ipf_rw_exit(rwlk)
ipfrwlock_t *rwlk;
{
        if (rwlk->ipf_isw > 0) {
                rwlk->ipf_isw = 0;
                write_unlock(&rwlk->ipf_lk);
        } else if (rwlk->ipf_isr > 0) {
                ATOMIC_DEC32(rwlk->ipf_isr);
                read_unlock(&rwlk->ipf_lk);
        } else {
                panic("rwlk->ipf_isw %d isr %d rwlk %p name [%s]\n",
                      rwlk->ipf_isw, rwlk->ipf_isr, rwlk, rwlk->ipf_lname);
        }
}

INLINE void ipf_read_enter(rwlk)
ipfrwlock_t *rwlk;
{
        read_lock(&rwlk->ipf_lk);
        ATOMIC_INC32(rwlk->ipf_isr);
}

#  define       ATOMIC_INC32(x)         MUTEX_ENTER(&ipf_rw); (x)++; \
                                        MUTEX_EXIT(&ipf_rw)
#  define       ATOMIC_DEC32(x)         MUTEX_ENTER(&ipf_rw); (x)--; \
                                        MUTEX_EXIT(&ipf_rw)
#  define       MUTEX_ENTER(x)          spin_lock(&(x)->ipf_lk)
#  define       MUTEX_EXIT(x)           spin_unlock(&(x)->ipf_lk)


  reply	other threads:[~2006-06-24  4:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-23 16:51 Darren Reed
2006-06-23 17:34 ` linux-os (Dick Johnson)
2006-06-24  2:47   ` Darren Reed [this message]
2006-06-25  9:38     ` Frederik Deweerdt
2006-06-23 19:19 ` Hareesh Nagarajan
2006-06-24 10:18 Chuck Ebbert

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=200606240247.k5O2lU3C009083@firewall.reed.wattle.id.au \
    --to=darrenr@reed.wattle.id.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-os@analogic.com \
    /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

all inboxes | Powered by JetHome®