- Feb 19, 2013
-
-
Avi Kivity authored
Add a detached thread class (with a private destructor, so it can only be allocated on the heap). The implementation uses a reaper thread to wait until the detached thread is dead, and then ->join() and delete it.
-
Avi Kivity authored
fixes loading unit tests with "main" as the entry point.
-
- Feb 18, 2013
-
-
Guy Zana authored
-
Christoph Hellwig authored
This is like printf() but prints straight to the console instead of going through the stdio library, the VFS and the device layer. To be used for debugging outout in the kernel.
-
- Feb 17, 2013
-
-
Avi Kivity authored
Protect the array with a cpu_set (bit set -> corresponding queue non-empty). This means we need to scan one word, instead of nr_cpus (plus of course all the cpus for which an incoming is waiting).
-
Avi Kivity authored
Supporting up to 64 cpus for now.
-
Avi Kivity authored
This fixes an issue where a symbol exists in multiple objects; when just one is loaded it is resolved to one of the modules, but after the second is loaded, it resolves to the second. To the program this appears as if the address or contents of a static variable has changed. In our case this was triggered by both statically and dynamically linking a library.
-
- Feb 14, 2013
-
-
Avi Kivity authored
Currently, we have an atomic _waiting state for a thread, and additional non-atomic _on_runqueue and _terminated states. This is problematic since a ->wake() racing with a ->stop_wait() can cause a thread to be simultaneously running and queued. Fix by using a single atomic variable for all theses states.
-
Avi Kivity authored
When we migrate a thread, remove its timers from the cpu-local timer list, and move them back when we complete migration.
-
- Feb 13, 2013
- Feb 12, 2013
-
-
Christoph Hellwig authored
-
Christoph Hellwig authored
-
Christoph Hellwig authored
-
Christoph Hellwig authored
-
Christoph Hellwig authored
-
Christoph Hellwig authored
-
Avi Kivity authored
We need to put ourself back in wait mode after every loop iteration, otherwise a spurious wakeup can result in the predicate returning false, and then we will never wait again, instead spinning endlessly.
-
Guy Zana authored
-
Avi Kivity authored
Pack the mutex by placing small fields next to each other. This fixes sizeof(cond_var) becoming larger than sizeof(pthread_cond_t), and corrupting memory.
-
- Feb 11, 2013
-
-
Christoph Hellwig authored
-
Avi Kivity authored
At present, a trivial algorithm is used: wake up once in a while, look for a less-loaded cpu, and push a waiting thread from this cpu to the other cpu. This is very simple wrt. locking, since the waiting thread is guaranteed not to be running, and to be on the runqueue of the load balancer thread.
-
Avi Kivity authored
While it is the default, we'll rely heavily on constant time size to compute the load (from remote processors, too). Document it to avoid having someone "optimize" it away.
-
Avi Kivity authored
-
Avi Kivity authored
Without fairness, the concurrent alloc/free test fails quickly on smp, as the allocator thread hogs the allocator mutex and quickly exhausts all memory. While we could fix up the test to avoid this, fairness is a desirable quality, so implement it. We do so by adding and owner field, and having the unlocker transfer ownership of the locked mutex instead of freeing it and letting the waiter race with a newcomer. Also simplify the wait list to a singly linked list. There was some corruption with the original implementation, and rather than fix it, simplify it to a singly linked list which is all that is needed.
-
- Feb 07, 2013
-
-
Dor Laor authored
-
Avi Kivity authored
This makes it easier to create a thread with no special properties.
-
Avi Kivity authored
This makes it easy to configure a thread with various parameters. The first is the existing stack_info parameter.
-
Avi Kivity authored
Maintain the list of active timers per-cpu, instead of globally. This removes the need for locking (other than disabling preemption). The clock_event interface is awkward in that the callback is global, not per-cpu. This requires us to have a global dispatch object that then uses cpu::current() to pick up the current cpu and dispatch the event. We should probably make clock_event explicitly per-cpu in the future.
-
Christoph Hellwig authored
-
Avi Kivity authored
Since timers are per-cpu constructs, we need to migrate them when a thread migrate. To do that, we need to keep a list of a thread's active timers.
-
Avi Kivity authored
No functional changes - prepare for making timer lists cpu local.
-
- Feb 06, 2013
-
-
Avi Kivity authored
Each cpu has a queue (actually an array of queues, one for each "waking" cpu) of threads that are to be woken. A thread can be queued locklessly, so a runqueue lock is not needed. As we don't IPI yet, the queues are polled at strategic points.
-
Avi Kivity authored
While generally useful, it helps now to avoid wakeups to threads that are no longer there.
-
Avi Kivity authored
-
- Feb 05, 2013
-
-
Christoph Hellwig authored
-
Avi Kivity authored
Single producer, single consumer.
-
Avi Kivity authored
-
Avi Kivity authored
Since ->wake() can be called from an interrupt, we cannot to any allocations there.
-
Avi Kivity authored
Resolved interdependencies later on.
-