> On Mon, 28 Jan 2008, [EMAIL PROTECTED] wrote: > > > Hi, > [ ... ] > >>> Calling lwp_create from a kernel driver will get > you > >>> into trouble. Why > >>> would you want to create an LWP from within a > kernel > >>> driver ? > >>> > >>> > >> My present code uses thread_create(). I am seeing > kernel panics due to an ASSERT fail in the > sfmmu_tsbmiss_exception(). > > And why do you think that would have anything to do > with each other ? > > >> > >>> If you're looking for something entirely > different, > >>> the way how to find > >>> out which LWP is executing your kernel driver > code, > >>> use: > >>> > >>> klwp_t *curlwp = ttolwp(threadp()); > >>> Can you clarify what you want to achieve ? > >>> > >>> > >> If I do this in my thread, I am getting curlwp as > NULL. because there is no LWP created when I do a > thread_create(). And this sfmmu_tsbmiss_exception() > is doing the same thing. > >> > >> 11824 /* > >> 11825 * Must set lwp state to LWP_SYS before > >> 11826 * trying to acquire any adaptive lock > >> 11827 */ > > Can you explain that sourcecode comment ? It's wrong, > but why you think > this should be so might give more insight as to what > your expectations > actually are ? > This comment is from /usr/src/uts/sfmmu/vm/hat_sfmmu.c . My intention is just to create a thread and I achieved it by thread_create() but because of this code in sfmmu_tsbmiss_exception() function my code with thread_create() is causing kernel panics. So wondering if I can get rid of this if I can get a valid lwp value.
> >> 11828 lwp = ttolwp(curthread); > >> 11829 ASSERT(lwp); // this is causing kernel > panic > > And what is unusual by that ? Not every thread has an > LWP, it's pretty > normal to see ttolwp(curthread) being NULL. The only > thing that tells you > is that the currently running thread is not part of > any userland process > but has been created by the kernel itself, or by some > kernel driver. > > >> So, to avoid this I was just trying to see if it > is possible to use lwp_create(). > >> > > Creating a kernel thread does not imply that a > klwp_t is created. What > > information from an lwp > > do you need? If there is no user level, you > should not need an lwp. > > So, why do you think > > you need one? > > Seconding Max here - why do you think you need one ? > > Thx, > FrankH. > _______________________________________________ > opensolaris-discuss mailing list > opensolaris-discuss@opensolaris.org This message posted from opensolaris.org _______________________________________________ opensolaris-discuss mailing list opensolaris-discuss@opensolaris.org