Date: Wed, 19 Sep 2001 16:42:31 -0700 From: "mike varga" <mike.varga@cavium.com> To: <freebsd-arch@freebsd.org> Subject: kevent hangs Message-ID: <00dd01c14164$c54b3560$4a10a8c0@stcla1.sfba.home.com>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. ------=_NextPart_000_00DA_01C1412A.137AA080 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I opted to break the changelist=20 and eventlist into 2 seperate calls. When I make the first call to add the=20 changelist, the call to kevent hangs. Does anyone know what is wrong? /*****APPLICATION CODE****/ { struct timespec to; int n; struct kevent ke; int data, udata; PKP_kq_handle =3D kqueue(); =20 to.tv_sec =3D 2; /* seconds */ to.tv_nsec =3D 10000; /* and microseconds */ EV_SET(&ke, PKP_driver_handle, EVFILT_READ, EV_ADD, 0,NULL,NULL); =20 /******* HANGS ON THIS CALL *********/ if (kevent(PKP_kq_handle,&ke,1,NULL,0,&to) <=3D 0) { close(PKP_kq_handle); PKP_kq_handle =3D -1; return errno; } else cond_code =3D 0; =20 /******DRIVER CODE*****/ static struct filterops cavium_filtops =3D { 1, NULL, kqdetach, kqfilter }; static int kqfilter(struct knote* kn, long hint) { cavium_softc* sc; DEBUG_PRINT(("CAVIUM kqfilter: 1 called\n")); =20 sc =3D (cavium_softc*)kn->kn_hook; return 1; } static void kqdetach(struct knote* kn) { cavium_softc* sc; =20 DEBUG_PRINT(("CAVIUM kqdetach: 1 called\n")); sc =3D (cavium_softc*)kn->kn_hook; =20 LOCK(sc->cache_lock,sc->cache_slock); SLIST_REMOVE(&sc->klist,kn,knote,kn_selnext); UNLOCK(sc->cache_lock,sc->cache_slock); } int cavium_kqueue(dev_t dev, struct knote* kn) { int unit; cavium_softc* sc; =20 DEBUG_PRINT(("CAVIUM cavium_kqfilter: 1 called\n")); =20 unit =3D UNIT(dev); if (!(sc=3DGET_SOFTC(unit))) { DEBUG_PRINT(("CAVIUM cavium_open: failed\n")); return 1; } switch(kn->kn_filter) { case EVFILT_READ: kn->kn_fop =3D &cavium_filtops; break; default: return 1; } =20 DEBUG_PRINT(("CAVIUM cavium_kqfilter: 2 called\n")); =20 kn->kn_hook =3D (caddr_t)sc;=20 LOCK(sc->cache_lock,sc->cache_slock); SLIST_INSERT_HEAD(&sc->klist,kn,kn_selnext); UNLOCK(sc->cache_lock,sc->cache_slock); =20 DEBUG_PRINT(("CAVIUM cavium_kqfilter: 3 called\n")); return 0; } ------=_NextPart_000_00DA_01C1412A.137AA080 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3D"MSHTML 5.50.4522.1800" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2> <DIV><FONT face=3DArial size=3D2>I opted to </FONT><FONT face=3DArial = size=3D2>break the=20 changelist </FONT></DIV> <DIV><FONT face=3DArial size=3D2>and eventlist </FONT><FONT face=3DArial = size=3D2>into 2=20 seperate calls.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>When I make the first call to add the = </FONT></DIV> <DIV><FONT face=3DArial size=3D2>changelist, the call to kevent = hangs.</FONT></DIV> <DIV> </DIV> <DIV>Does anyone know what is wrong?</DIV> <DIV> </DIV> <DIV>/*****APPLICATION CODE****/</DIV> <DIV> {<BR> struct timespec to;<BR> int = n;<BR> struct kevent=20 ke;<BR> int data, udata;</DIV> <DIV><BR> PKP_kq_handle =3D=20 kqueue();<BR> <BR> to.tv_sec =3D=20 2; /* seconds=20 */<BR> to.tv_nsec =3D=20 10000; /* and microseconds = */</DIV> <DIV> </DIV> <DIV> EV_SET(&ke, PKP_driver_handle, EVFILT_READ,=20 EV_ADD,<BR> 0,NULL,NULL);<BR> </DIV> <DIV>/******* HANGS ON THIS CALL *********/<BR> if=20 (kevent(PKP_kq_handle,&ke,1,NULL,0,&to) <=3D=20 0)<BR> {<BR> close(PKP_kq_handle);<BR> &= nbsp; PKP_kq_handle=20 =3D -1;<BR> return=20 errno;<BR> }<BR> else<BR> cond_cod= e =3D=20 0;<BR> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV>/******DRIVER CODE*****/</DIV> <DIV> </DIV> <DIV>static struct filterops cavium_filtops =3D=20 {<BR> 1,<BR> NULL,<BR> kqdetach,<BR> kqfilter<BR>};</= DIV> <DIV> </DIV> <DIV>static int kqfilter(struct knote* kn, long=20 hint)<BR>{<BR> cavium_softc* sc;<BR> DEBUG_PRINT(("CAVIUM = kqfilter: 1=20 called\n"));<BR> <BR> sc =3D = (cavium_softc*)kn->kn_hook;</DIV> <DIV> </DIV> <DIV> return 1;<BR>}</DIV> <DIV> </DIV> <DIV>static void kqdetach(struct knote* kn)<BR>{<BR> cavium_softc*=20 sc;<BR> <BR> DEBUG_PRINT(("CAVIUM kqdetach: 1 = called\n"));</DIV> <DIV> </DIV> <DIV> sc =3D=20 (cavium_softc*)kn->kn_hook;<BR> <BR> LOCK(sc->cache_lock,= sc->cache_slock);<BR> SLIST_REMOVE(&sc->klist,kn,knote,kn_= selnext);<BR> UNLOCK(sc->cache_lock,sc->cache_slock);<BR>}</DI= V> <DIV> </DIV> <DIV>int cavium_kqueue(dev_t dev, struct knote* kn)<BR>{<BR> int=20 unit;<BR> cavium_softc* sc;<BR> <BR> DEBUG_PRINT(("CAVIUM = cavium_kqfilter: 1 called\n"));<BR> <BR> unit =3D = UNIT(dev);</DIV> <DIV> </DIV> <DIV> if=20 (!(sc=3DGET_SOFTC(unit)))<BR> {<BR> DEBUG_PRINT(("CAVIUM = cavium_open: failed\n"));<BR> return 1;<BR> }</DIV> <DIV> </DIV> <DIV> switch(kn->kn_filter)<BR> {<BR> case=20 EVFILT_READ:<BR> kn->kn_fop =3D=20 &cavium_filtops;<BR> break;<BR> default:<= BR> return=20 1;<BR> }<BR> <BR> DEBUG_PRINT(("CAVIUM cavium_kqfilter: 2 = called\n"));<BR> <BR> kn->kn_hook =3D = (caddr_t)sc; </DIV> <DIV> </DIV> <DIV> LOCK(sc->cache_lock,sc->cache_slock);<BR> SLIST_INS= ERT_HEAD(&sc->klist,kn,kn_selnext);<BR> UNLOCK(sc->cache_l= ock,sc->cache_slock);<BR> <BR> DEBUG_PRINT(("CAVIUM=20 cavium_kqfilter: 3 called\n"));<BR> return=20 0;<BR>}</DIV></FONT></DIV></BODY></HTML> ------=_NextPart_000_00DA_01C1412A.137AA080-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?00dd01c14164$c54b3560$4a10a8c0>