percpu.hh: Fix pointer arithmetic

Fixes the following complaint by GCC:

  In file included from ../../include/osv/per-cpu-counter.hh:13:0,
                   from ../../include/osv/trace-count.hh:10,
                   from api/trace.cc:20:
  ../../include/osv/percpu.hh: In instantiation of ‘T* dynamic_percpu<T, align>::addr(void*) [with T = long unsigned int; long unsigned int align = 8ul]’:
  ../../include/osv/percpu.hh:85:19:   required from ‘void dynamic_percpu<T, align>::construct() [with T = long unsigned int; long unsigned int align = 8ul]’
  ../../include/osv/percpu.hh:68:56:   required from ‘dynamic_percpu<T, align>::dynamic_percpu() [with T = long unsigned int; long unsigned int align = 8ul]’
  ../../include/osv/per-cpu-counter.hh:18:7:   required from here
  ../../include/osv/percpu.hh:88:37: warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
           return static_cast<T*>(base + _offset);

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
setup.py: fix regression on Ubuntu 14.04/Fedora 20

This patch fixes a "no attribute" error:

Traceback (most recent call last):
  File "./scripts/setup.py", line 98, in <module>
    if dver.ec2_post_install:
AttributeError: type object 'Ubuntu_14_04' has no attribute 'ec2_post_install'

Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
poll: Fix two indention

Spotted during code inspection.

Signed-off-by: Asias He <asias@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
loader: remove unused extern declaration

This is no longer used after 1146a63e26af89df1e640b954cff5be46ef6224d.

Signed-off-by: Zifei Tong <zifeitong@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Adding the osv-gui is a submodule of the httpserver

This adds the OSV-GUI repository as a submodule of the httpserver

Reviewed-by: Tomasz Grabiec <tgrabiec@gmail.com>
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Http Server: Compile and copy the gui to the image

The httpserver compilation needs to verify that the gui submodule was
pulled, compile and add it as part of the image.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Httpserver: Mapping the GUI files in the server

This adds a mapping of the GUI to the server, after this patch a call to
http://192.168.122.89:8000/dashboard/
Will display the GUI.

Reviewed-by: Tomasz Grabiec <tgrabiec@gmail.com>
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
build: don't place mnttab.o in source directory

Breaks cross-arch build.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
net: Kill unused struct protosw inetsw[]

It is #if 0'd.

Spotted during code inspection.

Signed-off-by: Asias He <asias@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
build: don't place mnttab.o in source directory (again)

Found in another place.

Breaks cross-arch build.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
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>
memcpy: use aligned sse load/stores when alignment permits

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
memcpy: omit frame pointer in wrappers

It's quite expensive with small sizes.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Add helper template for generating a compile-time index list (0, 1, 2...)

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
initialize: add variant for compile-time initialization via template instantation

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>