scripts: Add script to generate GCE image

* Upload disk tarball to Google Cloud Storage

   $ gsutil cp osv.tar.gz gs://google_cloud_storage_dir/osv.tar.gz

* Create an image which can be used to start instance

   $ gcutil addimage osv gs://google_cloud_storage_dir/osv.tar.gz

Signed-off-by: Asias He <asias@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
scripts: Add script to generate OSv VirtualBox Appliance

* Run scripts/gen-vbox-ova.sh

A build/release/osv.ova will be created

* Import OSv VirtualBox Appliance

Click File -> Import Appliance, Choose osv.ova to import

Signed-off-by: Asias He <asias@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
osv-apps: update for jenkins integration

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
scripts: Add script to generate OSv VMware configuration

./scripts/gen-vmx.sh will create build/release/osv.vmx
You can run this VM image on VMware by executing following command:
vmware build/release/osv.vmx

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
mmu: read page content before populating page table

Page should not be accessible through a page table before it contains
valid data, otherwise a thread running on another vcpu can see garbage.
We rely on zfs file prefetch mechanism to minimize actual disk IO for
mmap_populate mappings. In the feature this will be replaced with proper
page cache integration.

Fixes #228

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Revert "vfs/zfs: Sync vnode and znode refcounts"

This reverts commit ca805bdb48465fdc7dbd46e1c4eee2e64d7c6d1e.

The commit breaks Cassandra startup as follows:

   INFO 09:18:00,244 Opening /var/lib/cassandra/data/system/local/system-local-jb-5 (5677 bytes)
  page fault outside application, addr 0
  [backtrace]
  0x31899b <mmu::vm_fault(unsigned long, exception_frame*)+219>
  0x34c105 <page_fault+101>
  0x34acc7 <ex_pf+35>
  0x391e94 <vn_stat+132>
  0x3935c9 <sys_stat+41>
  0x38a4ee <__xstat+78>

Raphael explains:

  I found that the following commit
  ca805bdb48465fdc7dbd46e1c4eee2e64d7c6d1e is the guilty one. It correctly
  fixes some mismatches between znode and vnode refcnts, then moves
  VOP_INACTIVE from vrele to keep them synchronized. This change assumes
  that there is no mismatch anymore.

  However, there is apparently a corner-case that the patch doesn't
  address. Example: If the vnode is one refcnt ahead of the respective
  znode, on an eventual vrele, the znode would be destroyed while the
  vnode is still alive. zfs_getattr attempts to dereference the field of
  the znode which doesn't exist anymore, thus the page fault.

As it's a regression, revert the commit for now.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tst-zfs-mount.so: Disable reference count check

Commit 951cca4 ("Revert "vfs/zfs: Sync vnode and znode refcounts")
forgot to disable ZFS reference count test case.

Reported-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
zfs: Set f_fsid in zfs_statfs

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
vfs/zfs: Add st_dev field support to stat

Tomek says:

Some programs rely on the fact that the (stat.st_ino, stat.st_dev) pair
uniquely identifies the file.
In OSv only st_ino is set by vn_stat(), st_dev is zeroed. It is possible that
files on different file systems will have the same inode number and hence
appear as referring to the same file.

Spotted during code inspection of openssl and vfs, I didn't run into any issue
related to that yet.

This patch addresses the issue #216

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tests: Check st_dev and f_fsid validity

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Fix uma_zone cache regression

In commit 08835b4e608eddcbd0ce17e3ef7a813d7b239731, we turned off uma
allocation caching when CONF_debug_memory is on because it hid bugs.
Or at least, this is what was *intended*. What the patch actually did
was the opposite - it turned off the cache in the normal compilation!

This caused a deterioration of UDP memcached performance, from 159,000
to 131,000 req/sec. This was the second half of the recent memcached
performance deterioration (see issue #227).

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
x64: Fix duplicate ex_pf() declaration

There is a duplication in OSv exceptions.

Signed-off-by: Wangbicheng <wangbicheng@huawei.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
run: reuse command line in standalone images

If the user specifies an image, take the command line from there, instead
of looking for an unrelated build/release/cmdline.

TODO: support --verbose and friends using imgedit.py.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
dhcp.hh: Replaced const with constexpr

Replaced all const specifiers with constexpr in dhcp.hh.

Signed-off-by: Andrei Preda <andreipreda07@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>