Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 May 2001 11:38:53 -0700 (PDT)
From:      Matthew Jacob <mjacob@feral.com>
To:        John Baldwin <jhb@FreeBSD.ORG>
Cc:        smp@FreeBSD.ORG
Subject:   more recursive mutex panics- help me out with the One True way? :-)
Message-ID:  <Pine.LNX.4.21.0105221131160.10376-100000@zeppo.feral.com>

next in thread | raw e-mail | index | archive | help

After overnight run, I got:

isp1: kthread up release simq
lrecursed on non-recursive lock (sleep mutex) process lock @
../../kern/kern_lock.c:262
first acquired @ ../../kern/kern_sig.c:447
panic: recurse
panic
Stopped at

hangs irretrievably (can't send BREAK to break to DDB any more- hasn't worked
on pc164 for months)


The kthread in question:

static void
isp_kthread(void *arg)
{
        int wasfrozen;
        struct ispsoftc *isp = arg;

        mtx_lock(&isp->isp_lock);
        for (;;) {
                isp_prt(isp, ISP_LOGALL, "kthread checking FC state");
                while (isp_fc_runstate(isp, 2 * 1000000) != 0) {
                        msleep(&lbolt, &isp->isp_lock,
                            PRIBIO, "isp_fc_worker", 0);
                }
                wasfrozen = isp->isp_osinfo.simqfrozen & SIMQFRZ_LOOPDOWN;
                isp->isp_osinfo.simqfrozen &= ~SIMQFRZ_LOOPDOWN;
                if (wasfrozen && isp->isp_osinfo.simqfrozen == 0) {
                        isp_prt(isp, ISP_LOGALL, "kthread up release simq");
                        ISPLOCK_2_CAMLOCK(isp);
                        xpt_release_simq(isp->isp_sim, 1);
                        CAMLOCK_2_ISPLOCK(isp);
                }
                cv_wait(&isp->isp_osinfo.kthread_cv, &isp->isp_lock);
        }
}



And the lock transitions to acquire Giant on entry to CAM are:

#define ISPLOCK_2_CAMLOCK(isp)  \
        mtx_unlock(&(isp)->isp_lock); mtx_lock(&Giant)
#define CAMLOCK_2_ISPLOCK(isp)  \
        mtx_unlock(&Giant); mtx_lock(&(isp)->isp_lock)


So- 2 questions:


1. Are the defines for grabbing/releasing Giant acceptable in kthread context?

2. Is the msleep on lbolt a bad idea?

-matt



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-smp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.21.0105221131160.10376-100000>