Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Jun 2007 17:43:03 +0200
From:      "Attilio Rao" <attilio@freebsd.org>
To:        "Bruce Evans" <brde@optusnet.com.au>
Cc:        Kostik Belousov <kostikbel@gmail.com>, cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org
Subject:   Re: cvs commit: src/sys/kern kern_mutex.c
Message-ID:  <3bbf2fe10706050843x5aaafaafy284e339791bcfe42@mail.gmail.com>
In-Reply-To: <3bbf2fe10706050829o2d756a4cu22f98cf11c01f5e4@mail.gmail.com>
References:  <200706051420.l55EKEih018925@repoman.freebsd.org> <20070606003412.W35544@besplex.bde.org> <20070605150005.GW2268@deviant.kiev.zoral.com.ua> <20070605150521.GX2268@deviant.kiev.zoral.com.ua> <20070606011022.R35623@besplex.bde.org> <3bbf2fe10706050829o2d756a4cu22f98cf11c01f5e4@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
2007/6/5, Attilio Rao <attilio@freebsd.org>:
> 2007/6/5, Bruce Evans <brde@optusnet.com.au>:
> >
> > I get a "spin lock held too long" panic during (an interrupt in?) acpi
> > initialization on booting non-PREEMPTION SCHED_4BSD SMP.  Haven't tried
> > other cases.
>
> Do you have a backtrace or any other debugging stuffs available?

Mmm, I think I got the bug.
basically, in kern_mutex.c::_mtx_unlock_sleep(), in the not-preemptive
case what happens at some point is:

td = curthread;
if (td->td_critnest > 0 || td1->td_priority >= td->td_priority)
         return;

thread_lock(td1);
if (!TD_IS_RUNNING(td1)) {
...

mi_switch(SW_INVOL, NULL);
...
}
thread_unlock(td1);

Which is wrong beacause td1 is not curthread and really curthread
should be locked too when context switching.

To a first look the idea is that td and td1 should be locked both, but
I just want more time to look better at it.

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3bbf2fe10706050843x5aaafaafy284e339791bcfe42>