Opened 9 years ago

Last modified 8 years ago

#36 new defect

Kernel threads implementation (assertion failed in vboxdrv.sys) — at Initial Version

Reported by: Valery V. Sedletski Owned by:
Priority: major Milestone: VBox driver
Component: Driver Keywords: kernel threads assertion failed trap3
Cc: erdmann

Description

When testing a new VBox build on an Intel Core i3 machine, I got a trap 3 when booting the support driver (no such problems on Athlon64 and Core2Duo machines). It is probably, a failed assertion.

Trying to determine the assertion address, I got the cause of this problem known. The failed assertion is in Runtime\common\misc\thread.cpp, in RTThreadCreate(), the AssertReleaseRC(rc) at the end of the function. Here, rc == -12 == VERR_NOT_IMPLEMENTED is returned, hence the failed assertion. The error code was returned from rtThreadNativeCreate(). This function is unimplemented, and returns the above return code.

The kernel thread is VBoxTscThread, and could be disabled with undefining SUPDRV_USE_TSC_DELTA_THREAD. The disabling of this thread is not fatal, and everything seems to work without it. Also, I saw the messages in VM logs like this:

GIM: Warning!!! Host TSC is unstable. The guest may behave unpredictably with a paravirtualized clock.

The problem is that Runtime\r0drv\os2\thread2.cpp API's are unimplemented, and contain dummies. And the problem is that the kernel threads in OS/2 are a problem, because no preempting in kernel. The kernel multitasking in OS/2 kernel is cooperative one.

So, the question remains to be open, how to implement/emulate kernel threads in OS/2

1) I heard from Pavel Shtemenko that JFS uses some kind of a lazy writer thread in ring0. So, we may check JFS sources, what is used to start such threads. Also, there's some number of 'threads' in kernel, like sysinit, ager, etc.

2) OS4User suggested to try using context hooks to emulate kernel threads.

Context hook is created once with DevHlp_AllocateCtxHook, and can be "armed" multiple times with DevHlp_ArmCtxHook. The hook is executed in task time in the first available context (ring0). AllocateCtxHook returns a hook handle, which can be used until it is freed with DevHlp_FreeCtxHook.

Change History (0)

Note: See TracTickets for help on using tickets.