x64: Fix DMI table scanning on legacy systems

Even if we detect SMBIOS on a system, we also need to check that the DMI
table markers are there. While at it, also validate SMBIOS entry point
checksum.

Spotted during code inspection.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
apps: update to latest

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
httpserver/osv-gui: update to latest

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
build.mk: Don't build loader.elf with wrong parameters

As explained in issue #545, we have a makefile bug where the rule for
building libosv.so, which depends on loader.elf the variables usually defined
for compiling a .so to be "inherited" by the compilation of loader.elf,
causing some of OSv's objects to be compiled with slightly different flags
than other object files (e.g., we saw runtime.o compile with -fPIC).
The result is that compilation with and without "-j" comes out *not*
identical.

In this patch, we give up the notion of libosv.so being a separate target,
and just build it right after loader.elf - as those are anyway closely
related.

Fixes #545.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
sched: fix rare case of idle thread's runtime becoming NaN

This patch fixes a bug where the idle thread's runtime could become a
NaN value, causing bad decisions by the scheduler in rare cases.

A thread's runtime is updated by thread_runtime::ran_for(). The key line
of code is:
     _Rtt += _priority * (cnew - cold);

In other words, the runtime consumption (cnew-cold) is multiplied by
thread's priority, so that a thread with priority 2 consumes runtime
at twice the normal rate (and as result, will run half of what its
priority 1 comrades will run).

For the idle thread, _priority=Inf, with the intention that the above
addition will lead to _Rtt=Inf, so the idle thread will always lose the
lowest-runtime contest.

Unfortunately, there is one case where this doesn't happen correctly -
when ran_for() is called for an extremely tiny duration. In one extreme
case, I saw it called after the idle thread only ran for 4 nanoseconds!
In that case we can end up with the two single-precision floats cnew and
cold equal, and we end up with a calculation Inf*0, whose result is NaN
instead of Inf.

So this patch changes to code to explicitly set _Rtt=Inf when
_priority=Inf, without attempting the multiplication.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Update readme - remove SSH support from default image

Signed-off-by: Tzach Livyatan <tzach@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
setup.py: need curl on Ubuntu

We need "curl" for our default "make" (it is used to fetch Lua for the
default image's CLI). So add this requirement for Ubuntu in setup.py.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Adding the monitor-agent module

The monitor agent responsible for gotharing and sending usage information to a
remote server.  It is currently upload the information to s3 bucket.

On boot, the gothered information is saved in a uuid file on a predefine s3
bucket.

The collected data function is fill_data and additional information can be
added as needed.

A copy of the saved data is stored locally. The bucket name and local file name
can be overriden from the command line.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
modules/monitoring-agent: Trivial coding style cleanups

Various trivial cleanups:

  - Spelling
  - Formatting
  - Copyright banners

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
xenbus: get rid of the initialized trick

Use an instance() method as we do in other places.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
xenbus: add detach function

The device drivers can regiter a detach function, but we were so far using
only probe and attach. Add detach to the mix.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
xenfront: derive unit number from xenstore

We currently bump an integer and have that to be the index number.  However,
the interfaces are already indexed in the xenstore. Following a different
indexing scheme is possible and valid, but has the side effect that referring
to "interface 0" from outside the guest won't necessarily match the same
"interface 0" within it.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
xenfront: code teardown sequence

- Close our endpoint, so the backend will let the grants go.
- stop the network interface
- free each ring element and release grants
- free the rings themselves, as well as the remaining structures.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
xen: allow an interrupt handler to be unregistered

As part of the teardown process for a device, we need to be able to unregister
its interrupt handler. The driver layer will call it, but the function is
currently unimplemented.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
xenbus: expose function to detach a device

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Create an RPM for the external CLI

This adds an option to creat an RPM for the external CLI. It uses the rpmbuild
to create the rpm.

The cli dependencies in the lua libraries and files was changed to be relevant
to the current directory.

It would copy all the lua depnedencies with it, including the lua so files.  To
run either call from inside the cli:
make rpm

or from the rpmbuild directory call
make

To install the cli use yum for example
sudo yum install ./RPMS/x86_64/osv-cli-1.0-1.fc20.x86_64.rpm

To uninstall do:
sudo yum remove osv-cli

After installation, you can call
cli

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
An upload-cli script to upload the standalone cli to S3

The script will create and rpm and would upload the results.
To use call:
scripts/upload-cli

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
config.json: Add monitoring-agent to default image configuration

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
build.mk: remove a few unintended lines from make progress

Tell "make" not to print two silly comments to its output.
Also, the "call quiet" macro prints an empty line if you don't give
it anything to print, so when we have nothing good to print, let's just
use "@" instead, to avoid the empty lines.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Revert "config.json: Add monitoring-agent to default image configuration"

This reverts commit ea77c2dfe955656513c6ec526a32353fc585051b.

We want the agent to be enabled in binaries we push out but not in
images built by developers.