tst-queue-mpsc: fix one bug in the test.

The second stack trace mentioned in issue #178 happens because of a
bug in tst-queue-mpsc (this is what happens when tests become too
complex, and have bugs of their own...):

The "popper" thread reads an "item" from a lockfree:queue_mpsc, and wakes
the "pusher" thread in that item. But we have a bug when the pusher thread
is done and returns: While the condvar remains valid, the "item" containing
it does not! We cannot continue to use the index item->value.waiter after
we woke this thread, because it can return and item points to invalid
memory... We need to save the index "item->value.waiter" before waking
the thread.

Unfortunately, this does *not* completely solve issue #178 - the timer
bug (similar to the two stack traces on issue #178) is still seen
(rarely) after this patch.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
balloon: capture exception if the monitor can't start

At least in its current incarnation, it is risky to start the balloon without
the monitor. Tomek found a problem under which a problem with Tomcat's logging
system would cause an exception to be thrown.

While we were mistaken about the effects of that problem, namely, the exception
seems to caught by the logger itself and won't affect the functioning of the
monitor, it drew our attention to the fact that exceptions do can happen. And if
they do, we should be prepared to catch them and abort.

Reviewed-by: Tomasz Grabiec <tgrabiec@gmail.com>
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
loader: Add support for "&" in command line

Our loader's command line (what is given to the "-e" option of run.py)
already allows running multiple commands (each a shared object with
arguments) separated with a semicolon - e.g.,

    run.py -e "program1.so; program2.so; program3.so"

This patch allows, just like in Unix, to use a "&" instead of a ";",
in which case the preceding program is run in the background, in our case
this means in a new thread.

For example,
    run.py -e "httpserver.so& java.so ..."

As before a command line can constitute multiple commands, and whitespaces
around the separators (; or &) are optional.

Take care if you intend to run the *same* object multiple times concurrently,
e.g., "something.so& something.so". For an object to support this use case,
it should support its main() being called in parallel, and in particular
avoid using global variables.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Fix tst-commands.cc

A previous test changed loader.cc's command line parsing to also support
"&" as a separator of commands, causing the previous command to be executed
in a new thread. To achieve this, the parser ends each command with another
string, containing "&", ";" or "", depending on what appeared on the end
of this command.

This change caused tst-commands.cc, which checks the results of the
command line parsing, to fail. So this patch fixes the test to match
the code.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
mmu: correctly calculate huge page pte address in unpopulate

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