Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Jun 2002 21:43:01 +0800
From:      "kai ouyang" <oykai@msn.com>
To:        <current@FreeBSD.org>
Subject:   Help!
Message-ID:  <OE1349FFf70DQLGJZGT0000e264@hotmail.com>

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

------=_NextPart_001_0000_01C209B5.4D632930
Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: quoted-printable

Hi, everybody
 I am working on transfer RaidFrame from FreeBSD4.x to FreeBSD5.0.  Scott=
 Long has transfered RAIDFrame from NetBSD to FreeBSD 4.x.
Now, I am transfering those codes to FreeBSD5.0. This is my first strolli=
ng in FreeBSD5.0 kernel. =20
 Firstly, I transfered some codes based on the relationship of vinum and =
ccd between 4.x and 5.0. It could compile successfully.
 Now when I boot the box, the system tell me:
 panic: sleeping without a mutex
 Debugger("panic")
Stopped at Debugger+0x40: xorl %eax,%eax

I traced the source code and found some information as follow:
These is a function on RAIDFrame in the FreeBSD4.x .
static __inline int
RF_LTSLEEP(void *cond, int pri, const char *text, int time, struct simple=
lock *mutex)
{
 int ret;
 if (mutex !=3D NULL)
  simple_unlock(mutex);
 ret =3D tsleep(cond, pri, text, time);
 if (mutex !=3D NULL)
  simple_lock(mutex);
 return (ret);
}

These is the above funtion I modifed to support FreeBSD5.0:
static __inline int
RF_LTSLEEP(void *cond, int pri, const char *text, int time, struct mtx *m=
utex)
{
 int ret;
 if (mutex !=3D NULL)
  mtx_unlock(mutex);
 ret =3D tsleep(cond, pri, text, time);
 if (mutex !=3D NULL)
  mtx_lock(mutex);
 return (ret);
}

I have a clear ideal to use mtx. =20
I think there are maybe some problem in using the mtx.
Thank you very much!

Best Regards
Ouyang Kai=B4=D3=CD=F8=D5=BE=B5=C3=B5=BD=B8=FC=B6=E0=D0=C5=CF=A2=A1=A3MSN=
 Explorer =C3=E2=B7=D1=CF=C2=D4=D8:http://explorer.msn.com/lccn

------=_NextPart_001_0000_01C209B5.4D632930
Content-Type: text/html; charset="gb2312"
Content-Transfer-Encoding: quoted-printable

<HTML><BODY STYLE=3D"font:10pt verdana; border:none;"><DIV>Hi, everybody<=
/DIV> <DIV>&nbsp;I am working on transfer RaidFrame from FreeBSD4.x to Fr=
eeBSD5.0.&nbsp; Scott Long has transfered RAIDFrame from NetBSD to FreeBS=
D 4.x.</DIV> <DIV>Now, I am transfering those codes to FreeBSD5.0. This i=
s my first strolling in FreeBSD5.0 kernel. </DIV> <DIV>&nbsp;Firstly, I t=
ransfered some codes based on the relationship of vinum and ccd between 4=
.x and 5.0. It could compile successfully.</DIV> <DIV>&nbsp;Now when I bo=
ot the box, the system tell me:</DIV> <DIV>&nbsp;panic: sleeping without =
a mutex</DIV> <DIV>&nbsp;Debugger("panic")</DIV> <DIV>Stopped at Debugger=
+0x40: xorl %eax,%eax</DIV> <DIV>&nbsp;</DIV> <DIV>I traced the source co=
de and found some information as follow:</DIV> <DIV>These is a function o=
n RAIDFrame in the FreeBSD4.x .</DIV> <DIV>static __inline int<BR>RF_LTSL=
EEP(void *cond, int pri, const char *text, int time, struct simplelock *m=
utex)<BR>{<BR>&nbsp;int ret;<BR>&nbsp;if (mutex !=3D NULL)<BR>&nbsp;&nbsp=
;simple_unlock(mutex);<BR>&nbsp;ret =3D tsleep(cond, pri, text, time);<BR=
>&nbsp;if (mutex !=3D NULL)<BR>&nbsp;&nbsp;simple_lock(mutex);<BR>&nbsp;r=
eturn (ret);<BR>}<BR></DIV> <DIV>These is the above funtion I modifed to =
support FreeBSD5.0:</DIV> <DIV>static __inline int<BR>RF_LTSLEEP(void *co=
nd, int pri, const char *text, int time, struct mtx *mutex)<BR>{<BR>&nbsp=
;int ret;<BR>&nbsp;if (mutex !=3D NULL)<BR>&nbsp;&nbsp;mtx_unlock(mutex);=
<BR>&nbsp;ret =3D tsleep(cond, pri, text, time);<BR>&nbsp;if (mutex !=3D =
NULL)<BR>&nbsp;&nbsp;mtx_lock(mutex);<BR>&nbsp;return (ret);<BR>}</DIV> <=
DIV>&nbsp;</DIV> <DIV>I have a clear ideal to use mtx. </DIV> <DIV>I thin=
k there are maybe some problem in using the mtx.</DIV> <DIV>Thank you ver=
y much!</DIV> <DIV><BR>Best Regards<BR>Ouyang Kai</DIV></BODY></HTML><br =
clear=3Dall><hr>=B4=D3=CD=F8=D5=BE=B5=C3=B5=BD=B8=FC=B6=E0=D0=C5=CF=A2=A1=
=A3MSN Explorer =C3=E2=B7=D1=CF=C2=D4=D8=A3=BA<a href=3D'http://explorer.=
msn.com/lccn'>http://explorer.msn.com/lccn</a><br></p>;

------=_NextPart_001_0000_01C209B5.4D632930--

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




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