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>
scsi: Free req and data in scsi_common::exec_inquery

It is not freed after we're done with it.

Signed-off-by: Asias He <asias@cloudius-systems.com>
scsi: Intorduce req->free_by_driver flag

This is used to tell lower-level scsi driver to free the request,
otherwise the scsi layer will free the request.

read/write/flush scsi are async request, they are freed by the
lower-level scsi driver. Other scsi request are freed by the scsi layer.

Signed-off-by: Asias He <asias@cloudius-systems.com>
scsi: Introduce req->cdb_len

Set req->cdb_len to the actual size of the scsi command and only copy
the actual size of the command.

This reduces the number of bytes we copy.

This also fixes the warning in pvscsi which complains the size of the
cdb is larger than expected.

Signed-off-by: Asias He <asias@cloudius-systems.com>
scsi: Construct cdb in-place

Instead of copying a scsi cdb, construct it in-place.
This saves 16 bytes of memory copying on every read or write.

Signed-off-by: Asias He <asias@cloudius-systems.com>
apps: update for cassandra/jenkins integration

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
trace: do not attempt to read across the pivot page

This is an optimization. We first check if the entry is valid using
the 'tp' field and only if it is we try to read the rest.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
trace: encode and decode strings

Python3 became more restrictive with regards to string handling than
python2. In python3 strings no longer conform to byte array interface,
they have to be encoded explicitly. The current code throws exception
when run in python3.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
gdb: remove dead import

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
gdb: use "int" type instead of "long"

There is no difference between them in python2 and python3 no
longer has "long".

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
gdb: use print with parentheses

Needed by python3.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
gdb: create a wrapper for getting dict values

Python3 dicts do not have itervalues() or viewvalues(), they have values().

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
gdb: apply 2to3 fixes which work with both versions

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
gdb: strip \0 from thread_name in portable way

In python3 struct.unpack() returns bytes, not str, which
does not have rstrip().

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
gdb: concatenate trace_log in a generic way

The GDB which uses python3 returns memoryview object from
read_memory().  This class does not support + operator. I added a
concatenation wrapper which works with all indexable types.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
trace: fix command help

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
run.py: add --trace option

This option enables given tracepoint from the very beginning. This is
useful if you want to enable tracing but don't want to alter the
command line.

Before:

  run.py -e " --trace=... $(cat build/release/cmdline)"

After:

 run.py --trace=...

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
run.py: add --trace-backtrace option

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: make 'prof' show all trace samples by default

Often profile has only one tracepoint, let's save users some typing by
showing all by default.

Before:

  trace prof -t sched_wait

After:

  trace prof

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