build: make boost-lib-dir more robust

'find' can find more than one library due to leftover junk, make it more
robust.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mgmt: update

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
pvclock-abi: respect the TSC_STABLE_BIT flag

According to the ABI we should not assume the clock is monotonic
unless TSC_STABLE_BIT is set. When it's not, we use a global variable
to prevent clock backwards jumps.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mgmt: update

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
x64: Remove extra comma in boot16.S

Signed-off-by: Vinícius Tinti <viniciustinti@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: make trace points active state / backtrace individually controlled, with API calls for external (REST) management

In itself slightly underwelming, but sort of a prerequisite for ever adding
full REST control, with export etc. REST part obviously in other patch set
for the http server.

Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
xen: remove trailing newline form xenirq thread's name

It screws up 'trace list' output:

0xffff80003ef1f030 xenirq0
         0         0.000035096 timer_cancel         timer=0xffff80003f4fa788

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
aarch64: exceptions: enable PPIs and SPIs separately

enable PPIs in batch on cpu init, but instead enable
single SPIs only later in the boot process when needed.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
drivers: pl011: implement data input path

allows reading incoming data from the pl011 device.

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

While we correctly report the number of physical pages in the system, we
totally fail to report the number of available pages in the system - which is
used by Java's os.getFreePhysicalMemorySize().

This may lead to applications doing stupid decisions with, for instance, heap
vs off-heap placement. Example of Apache's solr log report:

Before:
sysconf(): stubbed for parameter 86
System Memory: 100.0001% used of 3.9996223 GiB

After:
System Memory: 2.9508517% used of 3.9996223 GiB

Unfortunately, that didn't help with the benchmark results as I was expecting
it could.  But it is wrong nevertheless.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
vmxnet3: mimic Linux driver registration

vmxnet3 driver supplies information about its version and guest
OS to the device. The device (probably) uses this information
to enable or disable features accordingly.

Since we are going to use features absent in FreeBSD driver's
code we'd rather mimic Linux driver registration.

Reviewed-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
vmxnet3: avoid excessive kicks on TX

There is a mechanism in vmxnet3 device that allows to decrease
number of device kicks on TX. This patch makes our driver use this feature.

Having this patch applied TX throughput improvement
of around 5% observed on small packets tests.

Reviewed-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
vfs: fix utimes() to handle NULL as argument

If NULL is passed as argument to utimes(), it fails.
man utimes says it should also handle NULL as argument
and update timestamps to current time in this case.

Signed-off-by: Jaspal Singh Dhillon <jaspal.iiith@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tests: add a test for utimes()

Add a small test to check whether utimes() can handle NULL.

Signed-off-by: Jaspal Singh Dhillon <jaspal.iiith@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
mmu: remove reinterpret_cast from get_mem_area_base()

Constant expression cannot have reinterpret_cast in any of its
subexpressions. As a result GCC 4.9 decides to call get_mem_area_base()
and initialize phys_mem at runtime. This is done when .init functions
are invoked, much later that the first use of phys_mem.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
mmu: use static_casts in translate_mem_area()

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
mmu: make get_mem_area() static inline instead of constexpr

Because of use of reinterpret_cast that function cannot be a constant
expression anyway.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
gdb: pretty print PERCPU(type, var)

In OSv some variables are duplicated so that there's a copy
for each CPU, to avoid synchronization overhead.
Typically those object would be CPU-local caches.
For example, in core/mempool.cc we have

    PERCPU(page_buffer, percpu_page_buffer);

a free page buffer for each CPU.

Printing those variables is not trivial in gdb, we thus introduce a
command to print all values for all CPUs. Typical usage is:

    (gdb) osv percpu memory::percpu_page_buffer

that would print the value of percpu_page_buffer for all available
or:

    (gdb) osv percpu memory::percpu_page_buffer nr

which would print the nr field in the percpu_page_buffer for all
available CPUs. Finally:

    (gdb) osv percpu memory::percpu_page_buffer free 0

would print percpu_page_buffer.free[0] for all available CPUs.

Usage:

    (gdb) osv percpu <per-cpu instance> [field-descend-to...]

Reviewed-by: Tomasz Grabiec <tgrabiec@gmail.com>
Signed-off-by: Elazar Leibovich <elazarl@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
clock: extract common code between kvmclock and xenclock

A recent commit 34232de90fc982293d9beadab6930b2f013552e9 fixed a bug
in kvmclock. It turns out that xenclock suffers from the same
problems. Both clocks share a lot of logic. This change extracts
common code to pv_based_clock base class which forces xenclock to
inherit the fixes.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
tests: introduce microbenchmark for various locking primitives

Results on my machine:

$ scripts/run.py -e "/tests/misc-lock-perf.so"
OSv v0.09-119-g59c0cec
eth0: 192.168.122.15
dummy      =   0.037 ns/cycle
preempt    =   6.360 ns/cycle
migrate    =   5.297 ns/cycle
mutex      =  25.474 ns/cycle

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>