tests: add auto-load safe-path init command to gdb

Signed-off-by: Elazar Leibovich <elazarl@gmail.com>
tests: fix unsigned/signed comparison in misc-free-perf.cc

thread_allocator::next_core is compared against sched::cpus.size().
GCC 4.9 doesn't like the fact that the former is signed and the latter
is unsigned.

Reviewed-by: Tomasz Grabiec <tgrabiec@gmail.com>
Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
scripts: Fix download.osv.io S3 bucket name

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
scripts: Fix capstan release upload

We can no longer use "--delete-removed" because the S3 bucket hosts
Capstan executables and access logs.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
mmu: remove unused function debug_count_ptes

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
ring_spsc: revert the previous commit to push()

It's ok to load _begin with relaxed ordering (in the size()) since
store to _ring[end & MaxSizeMask] may not be reordered with it due to
control dependency (see Documentation/memory-barriers.txt in the
Linux tree).

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mmu: call correct unmap() callback for huge pages in unpopulate class

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
aarch64: implement lock adapter for arch_fpu

this fixes AArch64 build broken by #202b2ccc

Cc: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
clock_gettime(CLOCK_PROCESS_CPUTIME_ID) - subtract idle time

clock_gettime(CLOCK_PROCESS_CPUTIME_ID) currently returns the full wall time
since boot, but we are expected to remove, at least, idle time, so this patch
does it.

As explained in comments, the accuracy of this implementation is
limited to the length of idle time slices (while a cpu is inside the
idle time slice, we don't know that it is, and believe it is busy);
This currently cannot be more than 0.1 seconds but on a busy system
is usually much shorter. I think this is fine (certainly better than what
we had until now), but if it bothers anyone we can fix it in the future).

Reviewed-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
runtime: Implement times()

Java application calls os.getProcessCpuTime() which in turn calls times() to
get process cpu time.

With this patch, solr-benchmark[1] reports Average CPU Load correctly. This
patch also makes jvisualvm get the correct cpu usage.

[1] https://hg.codespot.com/a/apache-extras.org/luceneutil

Fixes #321

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>
vfs: implement futimesat()

Fixes #330

OpenJDK uses futimesat() in some places.
dirfd must point to a directory if pathname is not absolute.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Jaspal Singh Dhillon <jaspal.iiith@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
mempool, trace: use single tracepoint to track memory allocations

Because of #295 (per-CPU tracepoint buffers) some samples may be lost what
quite effectively ruins attempts to track the lifetime of allocations.
Since the ability to show which allocations are still unfreed is not crucial
the simplest solution is be not to use memory_free tracepoints and put all
needed information in memory_malloc_{large, mempool}.

Signed-off-by: Pawel Dziepak <pdziepak@quarnos.org>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
math: make math functions generic

We are using now C++ implementation. Since they seem to rely on C++ intrinsics
and not in any OS-provided symbol, I trust AARCH64's C++ compiler will provide us
with something as well. We can then make it generic.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Tested-by: Claudio Fontana <claudio.fontana@huawei.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
pthread: implement pthread_exit

iperf client mode call this when connection fails, so this is needed to prevent
abort() on the condition.

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
vfs: fix errno in futimesat()

If dirfd is invalid, fstat returns -1 and sets errno.
Return this errno instead of returning -1 as errno.

Found while writing a test for futimesat.

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

Add tests for futimesat().

Signed-off-by: Jaspal Singh Dhillon <jaspal.iiith@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tests: printf benchmark

Add a printf test for benchmarking serial console performance.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
aarch64: update to latest Mach-Virt addresses

until we have the ACPI ported, we have to follow mach-virt.
Its addresses for the GIC have been recently changed.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Merge branch 'master' of github.com:elazarl/osv

Github pull request description:

  Running make check from a fresh Ubuntu gave the following error
  message

    TEST tracing_smoke_test

    warning: File "/home/elazar/dev/osv/scripts/loader.py" auto-loading
    has been declined by your `auto-load safe-path' set to
    "$debugdir:$datadir/auto-load".

  Signed-off-by: Elazar Leibovich <elazarl@gmail.com>
drivers: Rename ConsoleDriver to console_driver

We use snake case in OSv code.

Reviewed-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>