trace: include inlined-by functions in the backtrace

Fixes #255.

The default OSv build has plenty of inlined functions. The tracing
tool is using 'addr2line -Cfp' to resolve symbols. That mode of
operation of addr2line yields one line per symbol and that line will
only show the inlined function, even though the information about
"logical" callers is also available.

Example:

  $ addr2line -Cfp -e build/release/loader.elf
  0x32963d
  lock_guard at (...)

There is the '-i' switch we could use to also see code locations into
which this function was inlined:

  $ addr2line -Cfpi -e build/release/loader.elf
  0x32963d
  lock_guard at (...)
   (inlined by) lock_guard_for_with_lock at (...)
   (inlined by) mmu::vm_fault(unsigned long, exception_frame*) at (...)

In this case, 'mmu::vm_fault' is much more interesting than
lock_guard and thus we would like to show it in the backtrace. This change
allows symbol resolvers to return multiple source addresses per raw
address and changes the default implementation to return inlined-by
functions by default.

The new behavior can be suppressed with --no-inlined-by.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: suppress displaying of _M_invoke in the backtrace

It's just cluttering the backtrace.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
elf: use symbol_binding() where appropriate

There is already defined (but unused before this patch) function that
extracts binding type from Elf_Sym::st_info.

Signed-off-by: Pawel Dziepak <pdziepak@quarnos.org>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
early-console: implement arch independent early console

includes an implementation of arch_early_console for x64
using isa-serial, and an implementation for aarch64
using the (for now write-only) pl011.

This restores output functionality for AArch64 lost in
commit 9bbbe9dc.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
vfs: prepare read uio in get_arcbuf()

It was accidentally changed to "write" by 4658e56364a6a31b197e0.

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
vfs: remove unnecessary vcount() checks in rename()

Elevated vnode reference count should not prevent rename() from working.

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
pagecache: save vnode pointer instead of dentry in write page cache

dentry object represents a directory, vnode represent a file, so it is
better to use vnode in the page cache.

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mmu: do not destroy pt roots with double initialization

the class construction of the page_table_root must happen
before priority "mempool", or all the work in arch-setup
will be destroyed by the class constructor.
Problem noticed while working on the page fault handler for AArch64.

Signed-off-by: Jani Kokkonen <jani.kokkonen@huawei.com>
Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
aarch64: gic: implement GICv2

implement simple GIC class for interacting with
the GIC distributor and CPU interface.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
trace: introduce trace.py prof-lock command

The command shows a profile with amount of time threads were blocked
on a mutex. This can be used to estimate lock contention.

To use the profile the 'mutex_lock_wa*' tracepoints need to be enabled
with backtrace.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: fix symbol resolving for addr2line v2.23

The script did not parse the response properly in case the symbol is
unknown. That version of addr2line responds in two lines:

 ??
 ??:0

but the script was assuming one line ?? ??:0, as returned by addr2line v2.24

Reported-by: Asias He <asias@cloudius-systems.com>
Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: LOCK() and UNLOCK() do not have to return a value

The return values of LOCK() and UNLOCK() are never used. Besides, in the
current Musl version these macros do not have return values at all.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pawel Dziepak <pdziepak@quarnos.org>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
timerfd: Add nsec validity check to timerfd_settime

According to the manual page, the nsec field from both it_value
and it_interval must be checked, if wrong, return EINVAL.

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>
build.mk: remove --vga from cmdline on osv.vmdk/.vdi

Now we enabled both VGA and serial, we nolonger need to add --vga cmdline for VMW/VBox.

Reviewed-by: Asias He <asias@cloudius-systems.com>
Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Merge branch 'master' into rt-lock
net: cleanup syncache_head construction

This change moves syncache_head construction to its constructor so that the
timer can be nicely embedded in the structure.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
vmxnet3: support net channel on vmxnet3.

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
disable routing radix tree lock

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
disable arp cache locking

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
disable LL lock

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