tst-async: migration lock is enough

As Nadav pointed out tst-async disabled preemption only to make sure
that two function calls happen on the same CPU. For that purpose migration
lock is sufficient.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
runtime: stub __cxa_thread_atexit_impl

Needed for gcc 4.9.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
vfs: avoid recursive locking on vp when checking vnode refcnt

vcount is used to get vnode refcnt amount, which unnecessarily takes
another lock for the same vnode.
Found it while auditing the code.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
sched: change default timeslice length

This patch changes the "thyst" (hysteresis time) scheduler paramter from
2ms to 5ms.

It can be shown that when when two CPU-hog threads compete they alternate
running in timeslices of length 2*thyst. I.e., after this patch the time
slice in that case will be 10ms, exactly as happens in Linux (as was
measured by tests/misc-timeslice.cc).

thyst also caps the number of preemption-timer setting operations (which
require slow APIC exits) to 1/thyst - i.e., 200 a second.

Please note that the ideal time slice defined by thyst is rarely achieved
in practice, as waking a low-runtime thread can cause a context switch
long before the full time slice was used. For example, network I/O handling
threads are often woken many thousands of times a second; As another example,
our "page access scanner" thread wakes up (on one CPU) every 1ms and runs
for a very short duration, after which a rescheduling occurs, so in the
above example we will switch between the two CPU-hugging thread every 1ms,
instead of every 5ms.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
bio: Switch to use mutex_t and waitqueue

Simplfy the code a bit by switching from pthread_mutex_t and
pthread_cond_t to mutex_t and waitqueue.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Asias He <asias@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
aarch64: add, build libfdt

we need to use libfdt at the moment to pass the information
about the hardware to the guest, because the implementation
of ACPI for the guest seems to be a major effort that will
not happen very quickly. Also contains an one liner to
fix an ARCH use (arch should be used internally).

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>