net: Use Jubmo packets zone for m_defrag() allocations

This patch fixes part of TCP instability/low throughput problems on Xen.

On transmit networking stack passes to Xen netfront driver a list of mbufs
of up to PAGE_SIZE (4096) bytes each.
In case the list consists of more than MAX_TX_REQ_FRAGS (18) fragments
driver tries to defragment it with m_defrag().

m_defrag() in turn tries to build list of buffers of up to MCLBYTES
(2048) bytes each. This leads to even longer chain and packet being dropped.
As a result around 1% of TCP segments are lost and intensive TCP
retransmissions and slowdowns occur.

This patch makes m_defrag() use Jumbo packets zone for allocation, i.e.
PAGE_SIZE per mbuf.

This patch is pretty similar to what Glauber done on RX path before.

Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
net: maximum IP datagram size decreased by ETH header length

FreeBSD networking code limits IP datagram size by IP_MAXPACKET
which is exactly 64K. This calculation doesn't take into account
Ethernet header length and may generate Ethernet packet longer than 64K.

Such a packet cannot be processed properly by some devices (Xen netback)
and being dropped.

This patch fixes this corner case for all supported IP protocols.

Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
Automate releasing to Artifactory

This adds a script for releasing OSv QCOW2 images to Artifactory.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Fix make mode=debug build

When building with -O0 we get:

 bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.o: In
 function `zfs_ioc_destroy_snaps_nvl':
 (...)/bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c:3265:
 undefined reference to `zvol_remove_minor'

Looks like the problem is that the missing symbol,
`zvol_remove_minor', referenced from zfs_ioctl.o is not in the zvol.o
because it's not defined, because it is inside '#ifdef NOTYET' block
(which is off). It works in the normal build because when compiled
with -O2 (and even with -O1), the reference to zvol_remove_minor in
zfs_ioctl.c is optimized away.

This patch puts the block using zvol_remove_minor also inside '#ifdef
NOTYET' to be consistent.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Fix linker error in make mode=debug

This is a workaround for linker error when compiling with -O0

  `.text._Z9safe_loadIcEbPKT_RS0_' referenced in section `.text.fixup'
  of core/mmu.o: defined in discarded section
  `.text._Z9safe_loadIcEbPKT_RS0_[_Z9safe_loadIcEbPKT_RS0_]' of
  core/mmu.o

The safe_load() template is used in both runtime.cc and core/mmu.cc
but the linker keeps it only in one section discarding the other.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
x64: Fix missing newline in dump_registers()

The debug() format string is missing a newline. Fix that up.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
debug: Add format specifiers to debug_ll()

Needed to make dump_registers() safe to call from fault handler.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
x64: Make dump_register() fault-handler safe

The debug() call can deadlock because it's using boost format. Switch to
debug_ll().

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Fix broken example in README

After commit 9bb558386dc295e23f2043d7f2c36571db0ca982, the name our jars
now contains the version number 1.0.0 instead of 1.0. The default command
line was changed accordingly (in build.mk), but we forgot to likewise
update the example in the README. This trivial patch fixes the example.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
loader: version numbering

This patch adds version numbering to the loader. We use "git tag" for
generating an unique version number with a little bit of shell script
magic to make sure version number is always up-to-date.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
runtime: Make exit() power off the VM

Use osv::poweroff() instead of abort() in exit() to make the VM stop
cleanly on JVM System.exit().

Needed by DaCapo.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Automate releases to Amazon S3

We are switching to Amazon S3 for OSv pre-built image releases.

The script uses S3cmd:

  http://s3tools.org/s3cmd

which can be installed on Fedora with:

  yum install s3cmd python-magic

Please remember to configure your Amazon S3 credentials before running
the script:

  s3cmd --configure

To release a new version of OSv:

  git tag <version>

  ./scrips/release-s3

  git push --tags

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Fix top of call stack - and treatment of unhandled C++ exceptions

As noticed by Tomek in issue #64, unhandled C++ exceptions cause OSv to
silently hang, in an endless loop inside the unwinding code.

So this patch fixes the wrong CFI (DWARF Call Frame Information) which
caused the unwinder to loop. We just had a single line of assembly missing:
The topmost frame - the thread's main function - needs to undefine the
saved %rip to prevent going further back. If we don't do that, gdb will
end every "bt" output with a warning "Frame did not save its PC" (but hey,
nobody complained... ;-)), and the unwinding library, will, unfortunately,
go into an endless loop as seen in issue #64.

With this one-line patch, unhandled exceptions now work as expected -
they abort with a message like:

	terminate called after throwing an instance of 'int'
	Aborted

And attaching a debugger you can see exactly where the offending throw came
from (i.e., the stack does *not* unnecessarily unwind when there's nobody
waiting to catch the exception).

This works for uncaught exceptions anywhere - including inside main()
and from constructors when loading the object (before running main()).

"bt" in gdb also no longer ends each stack trace with an error message.
The last frame it shows is "thread_main()".

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Bump up mgmt version

Use the latest and greatest mgmt in preparation for v0.02.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
scripts: Use short tag format for releases

Currently, OSv release numbers would look like this:

  $ git describe --tags --long
  v0.02-0-gc40b86b

Stop using "--long" and let "git describe" do the right thing:

  $ git describe --tags
  v0.01-298-g42d11fb
  $ git tag v0.02
  $ git describe --tags
  v0.02

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tst-rename.so: Fix printf of file name instead of descriptor

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Removed ether_sprintf (wrong format, not used)

ether_sprintf() used special format specifiers from BSD's printf(9).

http://www.unix.com/man-page/freebsd/9/printf/

Instead of re-implementing these specifiers in different ways and
because this method is not being used anywhere, it was completely
removed.

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Removed m_print (wrong format, not used)

m_print() used special format specifiers from BSD's printf(9).

http://www.unix.com/man-page/freebsd/9/printf/

Instead of re-implementing these specifiers in different ways and
because this method is not being used anywhere, it was completely
removed.

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Fix usage of non literal format print

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tst-solaris-taskq.so: Fix printf format string

Spotted by GCC:

../../tests/tst-solaris-taskq.c: In function ‘tq_test_func’:
../../tests/tst-solaris-taskq.c:25:2: error: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘void *’ [-Werror=format=]
  kprintf("%s called for %s\n", __func__, arg);
  ^

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