]> Git Repo - qemu.git/log
qemu.git
7 years agomigration: use s->threshold_size inside migration_update_counters
Wei Wang [Mon, 22 Jan 2018 11:36:39 +0000 (19:36 +0800)]
migration: use s->threshold_size inside migration_update_counters

Fixes: b15df1ae50 ("migration: cleanup stats update into function")
The threshold size is changed to be recorded in s->threshold_size.

Signed-off-by: Wei Wang <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
Reviewed-by: Juan Quintela <[email protected]>
Signed-off-by: Juan Quintela <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
7 years agomigration/savevm.c: set MAX_VM_CMD_PACKAGED_SIZE to 1ul << 32
Daniel Henrique Barboza [Fri, 26 Jan 2018 15:59:40 +0000 (13:59 -0200)]
migration/savevm.c: set MAX_VM_CMD_PACKAGED_SIZE to 1ul << 32

MAX_VM_CMD_PACKAGED_SIZE is a constant used in qemu_savevm_send_packaged
and loadvm_handle_cmd_packaged to determine whether a package is too
big to be sent or received. qemu_savevm_send_packaged is called inside
postcopy_start (migration/migration.c) to send the MigrationState
in a single blob to the destination, using the MIG_CMD_PACKAGED subcommand,
which will read it up using loadvm_handle_cmd_packaged. If the blob is
larger than MAX_VM_CMD_PACKAGED_SIZE, an error is thrown and the postcopy
migration is aborted. Both MAX_VM_CMD_PACKAGED_SIZE and MIG_CMD_PACKAGED
were introduced by commit 11cf1d984b ("MIG_CMD_PACKAGED: Send a packaged
chunk ..."). The constant has its original value of 1ul << 24 (16MB).

The current MAX_VM_CMD_PACKAGED_SIZE value is not enough to support postcopy
migration of bigger pseries guests. The blob size for a postcopy migration of
a pseries guest with the following setup:

qemu-system-ppc64 --nographic -vga none -machine pseries,accel=kvm -m 64G \
-smp 1,maxcpus=32 -device virtio-blk-pci,drive=rootdisk \
-drive file=f27.qcow2,if=none,cache=none,format=qcow2,id=rootdisk \
-netdev user,id=u1 -net nic,netdev=u1

Goes around 12MB. Bumping the RAM to 128G makes the blob sizes goes to 20MB.
With 256G the blob goes to 37MB - more than twice the current maximum size.
At this moment the pseries machine can handle guests with up to 1TB of RAM,
making this postcopy blob goes to 128MB of size approximately.

Following the discussions made in [1], there is a need to understand what
devices are aggressively consuming the blob in that manner and see if that
can be mitigated. Until then, we can set MAX_VM_CMD_PACKAGED_SIZE to the
maximum value allowed. Since the size is a 32 bit int variable, we can set
it as 1ul << 32, giving a maximum blob size of 4G that is enough to support
postcopy migration of 32TB RAM guests given the above constraints.

[1] https://lists.nongnu.org/archive/html/qemu-devel/2018-01/msg06313.html

Signed-off-by: Daniel Henrique Barboza <[email protected]>
Reported-by: Balamuruhan S <[email protected]>
Reviewed-by: Juan Quintela <[email protected]>
Signed-off-by: Juan Quintela <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
7 years agomigration: Route errors down through migration_channel_connect
Dr. David Alan Gilbert [Fri, 15 Dec 2017 17:16:55 +0000 (17:16 +0000)]
migration: Route errors down through migration_channel_connect

Route async errors (especially from sockets) down through
migration_channel_connect and on to migrate_fd_connect where they
can be cleaned up.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Juan Quintela <[email protected]>
Signed-off-by: Juan Quintela <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
7 years agomigration: Allow migrate_fd_connect to take an Error *
Dr. David Alan Gilbert [Fri, 15 Dec 2017 17:16:54 +0000 (17:16 +0000)]
migration: Allow migrate_fd_connect to take an Error *

Allow whatever is performing the connection to pass migrate_fd_connect
an error to indicate there was a problem during connection, an allow
us to clean up.

The caller must free the error.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Juan Quintela <[email protected]>
Signed-off-by: Juan Quintela <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
7 years agodocker: change Fedora images to run with python3
Daniel P. Berrange [Tue, 16 Jan 2018 13:42:17 +0000 (13:42 +0000)]
docker: change Fedora images to run with python3

Fedora has switched to Python 3 by default, so it makes sense to use that
for testing QEMU builds, so we get testing of Python 3 compatibility.

Signed-off-by: Daniel P. Berrange <[email protected]>
Message-Id: <20180116134217[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agotravis: improve python version test coverage
Daniel P. Berrange [Tue, 16 Jan 2018 13:42:16 +0000 (13:42 +0000)]
travis: improve python version test coverage

Currently travis declares ancient python 2.4 is desired. Update that to
2.6 which is the oldest version any targetted distros still needs. If we
just list a python 3 version at the top level this will double the
number of travis jobs we run which is unreasonable.

So arbitrarily pick the clang test matrix entries to build with python
3.0 and 3.6, to extend coverage of python versions, without increasing
job count or build time.

Signed-off-by: Daniel P. Berrange <[email protected]>
Message-Id: <20180116134217[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoui: update keycodemapdb to get py3 fixes
Daniel P. Berrange [Tue, 16 Jan 2018 13:42:15 +0000 (13:42 +0000)]
ui: update keycodemapdb to get py3 fixes

Signed-off-by: Daniel P. Berrange <[email protected]>
Message-Id: <20180116134217[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoinput: add missing JIS keys to virtio input
Miika S [Tue, 16 Jan 2018 13:42:14 +0000 (13:42 +0000)]
input: add missing JIS keys to virtio input

keycodemapdb updated to add the QKeyCodes muhenkan and katakanahiragana

Signed-off-by: Miika S <[email protected]>
Message-Id: <20180116134217[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqemu.py: don't launch again before shutdown()
Amador Pahim [Mon, 22 Jan 2018 20:50:33 +0000 (21:50 +0100)]
qemu.py: don't launch again before shutdown()

If a VM is launched, files are created and a cleanup is required before
a new launch. This cleanup is executed by shutdown(), so shutdown() must
be called even if the VM is manually terminated (i.e. using kill).

This patch creates a control to make sure launch() will not be executed
again if shutdown() is not called after the previous launch().

Signed-off-by: Amador Pahim <[email protected]>
Message-Id: <20180122205033[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqemu.py: cleanup redundant calls in launch()
Amador Pahim [Mon, 22 Jan 2018 20:50:32 +0000 (21:50 +0100)]
qemu.py: cleanup redundant calls in launch()

Now that shutdown() is guaranteed to always execute self._load_io_log()
and self._post_shutdown(), their calls in 'except' became redundant and
we can safely replace it by a call to shutdown().

Reviewed-by: Fam Zheng <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Signed-off-by: Amador Pahim <[email protected]>
Message-Id: <20180122205033[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqemu.py: use poll() instead of 'returncode'
Amador Pahim [Mon, 22 Jan 2018 20:50:31 +0000 (21:50 +0100)]
qemu.py: use poll() instead of 'returncode'

The 'returncode' Popen attribute is not guaranteed to be updated. It
actually depends on a call to either poll(), wait() or communicate().

On the other hand, poll() will: "Check if child process has terminated.
Set and return returncode attribute."

Let's use the poll() to check whether the process is running and to get
the updated process exit code, when the process is finished.

Reviewed-by: Fam Zheng <[email protected]>
eviewed-by: Eduardo Habkost <[email protected]>
Signed-off-by: Amador Pahim <[email protected]>
Message-Id: <20180122205033[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqemu.py: always cleanup on shutdown()
Amador Pahim [Mon, 22 Jan 2018 20:50:30 +0000 (21:50 +0100)]
qemu.py: always cleanup on shutdown()

Currently we only cleanup on shutdown() if the VM is running.

To make sure we will always cleanup, this patch makes the
self._load_io_log() and the self._post_shutdown() to
always be called on shutdown(), regardless the VM running state.

Reviewed-by: Fam Zheng <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Signed-off-by: Amador Pahim <[email protected]>
Message-Id: <20180122205033[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqemu.py: refactor launch()
Amador Pahim [Mon, 22 Jan 2018 20:50:29 +0000 (21:50 +0100)]
qemu.py: refactor launch()

This is just a refactor to separate the exception handler from the
actual launch procedure, improving the readability and making future
maintenances in this piece of code easier.

Reviewed-by: Fam Zheng <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Signed-off-by: Amador Pahim <[email protected]>
Message-Id: <20180122205033[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqemu.py: better control of created files
Amador Pahim [Mon, 22 Jan 2018 20:50:28 +0000 (21:50 +0100)]
qemu.py: better control of created files

To launch a VM, we need to create basically two files: the monitor
socket (if it's a UNIX socket) and the qemu log file.

For the qemu log file, we currently just open the path, which will
create the file if it does not exist or overwrite the file if it does
exist.

For the monitor socket, if it already exists, we are currently removing
it, even if it's not created by us.

This patch moves to _pre_launch() the responsibility to create a
temporary directory to host the files so we can remove the whole
directory on _post_shutdown().

Signed-off-by: Amador Pahim <[email protected]>
Message-Id: <20180122205033[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqemu.py: remove unused import
Amador Pahim [Tue, 14 Nov 2017 10:22:39 +0000 (11:22 +0100)]
qemu.py: remove unused import

Removing 'import sys' as it's not used anywhere.

Signed-off-by: Amador Pahim <[email protected]>
Message-Id: <20171114102246[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoconfigure: allow use of python 3
Daniel P. Berrange [Tue, 16 Jan 2018 13:42:13 +0000 (13:42 +0000)]
configure: allow use of python 3

Signed-off-by: Daniel P. Berrange <[email protected]>
Message-Id: <20180116134217[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoscripts: ensure signrom treats data as bytes
Daniel P. Berrange [Tue, 16 Jan 2018 13:42:12 +0000 (13:42 +0000)]
scripts: ensure signrom treats data as bytes

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Daniel P. Berrange <[email protected]>
Message-Id: <20180116134217[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqapi: force a UTF-8 locale for running Python
Daniel P. Berrange [Tue, 16 Jan 2018 13:42:11 +0000 (13:42 +0000)]
qapi: force a UTF-8 locale for running Python

Python2 did not validate locale correctness when reading input data, so
would happily read UTF-8 data in non-UTF-8 locales. Python3 is strict so
if you try to read UTF-8 data in the C locale, it will raise an error
for any UTF-8 bytes that aren't representable in 7-bit ascii encoding.
e.g.

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 54: ordinal not in range(128)
Traceback (most recent call last):
  File "/tmp/qemu-test/src/scripts/qapi-commands.py", line 317, in <module>
    schema = QAPISchema(input_file)
  File "/tmp/qemu-test/src/scripts/qapi.py", line 1468, in __init__
    parser = QAPISchemaParser(open(fname, 'r'))
  File "/tmp/qemu-test/src/scripts/qapi.py", line 301, in __init__
    previously_included)
  File "/tmp/qemu-test/src/scripts/qapi.py", line 348, in _include
    exprs_include = QAPISchemaParser(fobj, previously_included, info)
  File "/tmp/qemu-test/src/scripts/qapi.py", line 271, in __init__
    self.src = fp.read()
  File "/usr/lib64/python3.5/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]

More background on this can be seen in

  https://www.python.org/dev/peps/pep-0538/

Many distros support a new C.UTF-8 locale that is like the C locale,
but with UTF-8 instead of 7-bit ASCII. That is not entirely portable
though. This patch thus sets the LANG to "C", but overrides LC_CTYPE
to be en_US.UTF-8 locale. This gets us pretty close to C.UTF-8, but
in a way that should be portable to everywhere QEMU builds.

This patch only forces UTF-8 for QAPI scripts, since that is the one
showing the immediate error under Python3 with C locale, but potentially
we ought to force this for all python scripts used in the build process.

Signed-off-by: Daniel P. Berrange <[email protected]>
Message-Id: <20180116134217[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqapi: ensure stable sort ordering when checking QAPI entities
Daniel P. Berrange [Tue, 16 Jan 2018 13:42:10 +0000 (13:42 +0000)]
qapi: ensure stable sort ordering when checking QAPI entities

Some early python 3.x versions will have different default
ordering when calling the 'values()' method on a dict, compared
to python 2.x and later 3.x versions. Explicitly sort the items
to get a stable ordering.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Daniel P. Berrange <[email protected]>
Message-Id: <20180116134217[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqapi: remove '-q' arg to diff when comparing QAPI output
Daniel P. Berrange [Tue, 16 Jan 2018 13:42:09 +0000 (13:42 +0000)]
qapi: remove '-q' arg to diff when comparing QAPI output

When the qapi schema tests fail they merely print that the expected
output didn't match the actual output. This is largely useless when
trying diagnose what went wrong. Removing the '-q' arg to diff
means that it is still silent on successful tests, but when it
fails we'll see details of the incorrect output.

Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Daniel P. Berrange <[email protected]>
Message-Id: <20180116134217[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqapi: Adapt to moved location of 'maketrans' function in py3
Daniel P. Berrange [Tue, 16 Jan 2018 13:42:08 +0000 (13:42 +0000)]
qapi: Adapt to moved location of 'maketrans' function in py3

Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Daniel P. Berrange <[email protected]>
Message-Id: <20180116134217[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqapi: adapt to moved location of StringIO module in py3
Daniel P. Berrange [Tue, 16 Jan 2018 13:42:07 +0000 (13:42 +0000)]
qapi: adapt to moved location of StringIO module in py3

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Daniel P. Berrange <[email protected]>
Message-Id: <20180116134217[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqapi: Use OrderedDict from standard library if available
Daniel P. Berrange [Tue, 16 Jan 2018 13:42:06 +0000 (13:42 +0000)]
qapi: Use OrderedDict from standard library if available

The OrderedDict class appeared in the 'collections' module
from python 2.7 onwards, so use that in preference to our
local backport if available.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Daniel P. Berrange <[email protected]>
Message-Id: <20180116134217[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqapi: use items()/values() intead of iteritems()/itervalues()
Daniel P. Berrange [Tue, 16 Jan 2018 13:42:05 +0000 (13:42 +0000)]
qapi: use items()/values() intead of iteritems()/itervalues()

The iteritems()/itervalues() methods are gone in py3, but the
items()/values() methods are still around. The latter are less
efficient than the former in py2, but this has unmeasurably
small impact on QEMU build time, so taking portability over
efficiency is a net win.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Daniel P. Berrange <[email protected]>
Message-Id: <20180116134217[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqapi: convert to use python print function instead of statement
Daniel P. Berrange [Tue, 16 Jan 2018 13:42:04 +0000 (13:42 +0000)]
qapi: convert to use python print function instead of statement

Python 3 no longer supports the bare "print" statement, it must be
called as a normal function with round brackets. It is possible to
opt-in to this new syntax with Python 2.6 onwards by importing the
"print_function" from the "__future__" module, making it easy to
support Python 2 and 3 in parallel.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Daniel P. Berrange <[email protected]>
Message-Id: <20180116134217[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoexynos4210: workaround UBSAN compilation error
Marc-André Lureau [Tue, 16 Jan 2018 15:11:50 +0000 (16:11 +0100)]
exynos4210: workaround UBSAN compilation error

gcc 5.4.0-6ubuntu1~16.04.5 build with UBSAN enabled error:

  CC      hw/display/exynos4210_fimd.o
/home/petmay01/linaro/qemu-for-merges/hw/display/exynos4210_fimd.c: In
function ‘fimd_get_buffer_id’:
/home/petmay01/linaro/qemu-for-merges/hw/display/exynos4210_fimd.c:1105:5:
error: case label does not reduce to an integer constant
     case FIMD_WINCON_BUF2_STAT:

Because FIMD_WINCON_BUF2_STAT case contains an integer
overflow, use U suffix to get the unsigned type.

Signed-off-by: Marc-André Lureau <[email protected]>
Message-Id: <20180116151152[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
7 years agosockets: fix parsing of ipv4/ipv6 opts in parse_socket_addr
Daniel P. Berrange [Thu, 25 Jan 2018 17:14:12 +0000 (17:14 +0000)]
sockets: fix parsing of ipv4/ipv6 opts in parse_socket_addr

The inet_parse() function looks for 'ipv4' and 'ipv6' flags, but only
treats them as bare bool flags. The normal QemuOpts parsing would allow
on/off values to be set too.

This updates inet_parse() so that its handling of the 'ipv4' and 'ipv6'
flags matches that done by QemuOpts.

This impacts the NBD block driver parsing the legacy filename syntax and
the migration code parsing the socket scheme.

Signed-off-by: Daniel P. Berrange <[email protected]>
Message-Id: <20180125171412[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
7 years agoDrop remaining bits of ia64 host support
Peter Maydell [Thu, 25 Jan 2018 16:19:49 +0000 (16:19 +0000)]
Drop remaining bits of ia64 host support

We dropped support for ia64 host CPUs in the 2.11 release (removing
the TCG backend for it, and advertising the support as being
completely removed in the changelog).  However there are a few bits
and pieces of code still floating about.  Remove those, too.

We can drop the check in configure for "ia64 or hppa host?"
entirely, because we don't support hppa hosts either any more.

Signed-off-by: Peter Maydell <[email protected]>
Message-Id: <1516897189[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
7 years agohvf: ept_emulation_fault() needs NetApp BSD attribution
Paolo Bonzini [Fri, 26 Jan 2018 10:37:32 +0000 (11:37 +0100)]
hvf: ept_emulation_fault() needs NetApp BSD attribution

Add the BSD license there.

Reported-by: Izik Eidus <[email protected]>
Message-Id: <20180123123639[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
7 years agoAdd missing hvdos public domain attribution:
Izik Eidus [Tue, 23 Jan 2018 12:36:38 +0000 (14:36 +0200)]
Add missing hvdos public domain attribution:

hvf.c and vmx.h contain code from hvdos.c that is released as public domain:

from hvdos github: https://github.com/mist64/hvdos

"License

See LICENSE.txt (2-clause-BSD).

In order to simplify use of this code as a template, you can consider any parts from "hvdos.c" and "interface.h" as being in the public domain."

Signed-off-by: Izik Eidus <[email protected]>
Message-Id: <20180123123639[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
7 years agoi2c: Add a CONFIG_I2C master switch to the configuration files
Thomas Huth [Mon, 22 Jan 2018 15:27:33 +0000 (16:27 +0100)]
i2c: Add a CONFIG_I2C master switch to the configuration files

The i2c core and the at24c EEPROM should only be compiled and linked
on the machines that support i2c. Otherwise it's quite strange to see
the at24c-eeprom to be "available" on qemu-system-s390x for example.

Signed-off-by: Thomas Huth <[email protected]>
Message-Id: <1516634853[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
7 years agomemory-internal.h: Remove obsolete claim that header is obsolete
Peter Maydell [Tue, 21 Nov 2017 15:08:08 +0000 (15:08 +0000)]
memory-internal.h: Remove obsolete claim that header is obsolete

The memory-internal.h header claims that it is for "obsolete
exec.c functions" which "will be removed soon". This statement
was added in 2011, six years ago, but the header is still here.
(Admittedly none of the prototypes added in commit 67d95c153bef55f6
are still in the header.)

It's convenient to have a place to put prototypes for functions
which are used internally to the various .c files of the memory
system or by the accel/tcg code, which is inevitably fairly
closely coupled. So keep the header but update the comments to
reflect what we're actually using it for.

Signed-off-by: Peter Maydell <[email protected]>
Message-Id: <1511276888[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
7 years agoscripts/qemu-gdb/timers.py: define encoding in header comment
Greg Kurz [Thu, 18 Jan 2018 17:11:37 +0000 (18:11 +0100)]
scripts/qemu-gdb/timers.py: define encoding in header comment

This is required otherwise python complains because of the
accentuated letter in Alex's last name:

Traceback (most recent call last):
  File "scripts/qemu-gdb.py", line 29, in <module>
    from qemugdb import aio, mtree, coroutine, tcg, timers
  File "scripts/qemugdb/timers.py", line 1
SyntaxError: Non-ASCII character '\xc3' in file scripts/qemugdb/timers.py
 on line 1, but no encoding declared;
 see http://www.python.org/peps/pep-0263.html for details

Signed-off-by: Greg Kurz <[email protected]>
Message-Id: <151629549711.18276.15497684562308683805[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
7 years agoreadline: don't free completions in readline_free()
Greg Kurz [Thu, 18 Jan 2018 10:41:03 +0000 (11:41 +0100)]
readline: don't free completions in readline_free()

Since commit e5dc1a6c6c43, QEMU aborts on exit if completion was used
in the monitor:

*** Error in `obj/ppc64-softmmu/qemu-system-ppc64': double free or
 corruption (fasttop): 0x00000100331069d0 ***

 /home/greg/Work/qemu/qemu-spapr/util/readline.c:514
 /home/greg/Work/qemu/qemu-spapr/monitor.c:586
 /home/greg/Work/qemu/qemu-spapr/monitor.c:4125
 argv=<optimized out>, envp=<optimized out>) at
 /home/greg/Work/qemu/qemu-spapr/vl.c:4795

Completion strings are not persistent accross completions (why would
they?). They are allocated under readline_completion(), which already
takes care of freeing them before returning.

Maybe all completion related bits should be moved out of ReadLineState
to a dedicated structure ?

In the meantime, let's drop the offending lines from readline_free()
to fix the crash.

Signed-off-by: Greg Kurz <[email protected]>
Message-Id: <151627206353.4505.4602428849861610759[email protected]>
Fixes: e5dc1a6c6c43
Signed-off-by: Paolo Bonzini <[email protected]>
7 years agochardev: fix incorrect unref of source
Peter Xu [Thu, 18 Jan 2018 05:20:49 +0000 (13:20 +0800)]
chardev: fix incorrect unref of source

glib reported error when pty chardev used:

$ ./qemu-system-x86_64 -chardev pty,id=foo -device isa-serial,chardev=foo
qemu-system-x86_64: -chardev pty,id=foo: char device redirected to /dev/pts/2 (label foo)
(qemu-system-x86_64:27885): GLib-CRITICAL **: g_source_unref: assertion 'source != NULL' failed
(qemu-system-x86_64:27885): GLib-CRITICAL **: g_source_unref: assertion 'source != NULL' failed

This patch fixes that.

Fixes: 2c716ba150 ("chardev: introduce qemu_chr_timeout_add_ms()")
CC: Paolo Bonzini <[email protected]>
Reported-by: Marc-André Lureau <[email protected]>
Signed-off-by: Peter Xu <[email protected]>
Message-Id: <20180118052049[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
7 years agoscsi-generic: Simplify error handling code
Fam Zheng [Thu, 18 Jan 2018 02:52:45 +0000 (10:52 +0800)]
scsi-generic: Simplify error handling code

Coverity doesn't like the ignored return value introduced in
9d3b155186c278 (hw/block: Fix the return type), and other callers are
converted already in ceff3e1f01.

This one was added lately in d9bcd6f7f23a and missed the train. Do it
now.

Signed-off-by: Fam Zheng <[email protected]>
Message-Id: <20180118025245[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
7 years agomemory: set ioeventfd_update_pending after address_space_update_ioeventfds
linzhecheng [Sun, 14 Jan 2018 12:55:19 +0000 (20:55 +0800)]
memory: set ioeventfd_update_pending after address_space_update_ioeventfds

We should set ioeventfd_update_pending same as memory_region_update_pending.

Signed-off-by: linzhecheng <[email protected]>
Message-Id: <1515934519[email protected]>
Cc: [email protected]
Fixes: ade9c1aac5292ff698fa550adebe794c37d86cc9
Signed-off-by: Paolo Bonzini <[email protected]>
7 years agoqemu: improve hugepage allocation failure message
Marcelo Tosatti [Mon, 15 Jan 2018 20:17:01 +0000 (18:17 -0200)]
qemu: improve hugepage allocation failure message

Improve hugepage allocation failure message, indicating
what is happening to the user.

Signed-off-by: Marcelo Tosatti <[email protected]>
Message-Id: <20180115201700[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
7 years agokvm: Add kvm_set_user_memory tracepoint
Alexey Kardashevskiy [Fri, 15 Dec 2017 05:23:26 +0000 (16:23 +1100)]
kvm: Add kvm_set_user_memory tracepoint

This adds a tracepoint to trace the KVM_SET_USER_MEMORY_REGION ioctl
parameters which is quite useful for debugging VFIO memory regions
being actually registered with KVM.

Signed-off-by: Alexey Kardashevskiy <[email protected]>
Message-Id: <20171215052326[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
7 years agoqdev: use device_class_set_parent_realize/unrealize/reset()
Philippe Mathieu-Daudé [Sun, 14 Jan 2018 02:04:12 +0000 (23:04 -0300)]
qdev: use device_class_set_parent_realize/unrealize/reset()

changes generated using the following Coccinelle patch:

  @@
  type DeviceParentClass;
  DeviceParentClass *pc;
  DeviceClass *dc;
  identifier parent_fn;
  identifier child_fn;
  @@
  (
  +device_class_set_parent_realize(dc, child_fn, &pc->parent_fn);
  -pc->parent_fn = dc->realize;
  ...
  -dc->realize = child_fn;
  |
  +device_class_set_parent_unrealize(dc, child_fn, &pc->parent_fn);
  -pc->parent_fn = dc->unrealize;
  ...
  -dc->unrealize = child_fn;
  |
  +device_class_set_parent_reset(dc, child_fn, &pc->parent_fn);
  -pc->parent_fn = dc->reset;
  ...
  -dc->reset = child_fn;
  )

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20180114020412[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Acked-by: David Gibson <[email protected]>
Acked-by: Cornelia Huck <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
7 years agoqdev: add helpers to be more explicit when using abstract QOM parent functions
Philippe Mathieu-Daudé [Sun, 14 Jan 2018 02:04:11 +0000 (23:04 -0300)]
qdev: add helpers to be more explicit when using abstract QOM parent functions

QOM API learning curve is quite hard, in particular when devices inherit from
abstract parent.
To be more explicit about when a device class change the parent hooks, add few
helpers hoping a device class_init() will be easier to understand.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20180114020412[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
7 years agoqdev: rename typedef qdev_resetfn() -> DeviceReset()
Philippe Mathieu-Daudé [Sun, 14 Jan 2018 02:04:10 +0000 (23:04 -0300)]
qdev: rename typedef qdev_resetfn() -> DeviceReset()

following the DeviceRealize and DeviceUnrealize typedefs,
this unify a bit the new QOM API.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20180114020412[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
7 years agomemory: update comments and fix some typos
Jay Zhou [Thu, 4 Jan 2018 05:29:48 +0000 (13:29 +0800)]
memory: update comments and fix some typos

Signed-off-by: Jay Zhou <[email protected]>
Message-Id: <1515043788[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2018-02-03-1' into...
Peter Maydell [Mon, 5 Feb 2018 09:31:37 +0000 (09:31 +0000)]
Merge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2018-02-03-1' into staging

Merge tpm 2018/02/03 v1

# gpg: Signature made Sat 03 Feb 2018 14:02:35 GMT
# gpg:                using RSA key 75AD65802A0B4211
# gpg: Good signature from "Stefan Berger <[email protected]>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: B818 B9CA DF90 89C2 D5CE  C66B 75AD 6580 2A0B 4211

* remotes/stefanberger/tags/pull-tpm-2018-02-03-1:
  tpm: tis: move one-line function into caller
  MAINTAINERS: add pointer to tpm-next repository
  tpm: wrap stX_be_p in tpm_cmd_set_XYZ functions
  tpm: Split off tpm_crb_reset function

Signed-off-by: Peter Maydell <[email protected]>
7 years agoroms/seabios-hppa: Update submodule and image
Richard Henderson [Sun, 4 Feb 2018 22:08:37 +0000 (14:08 -0800)]
roms/seabios-hppa: Update submodule and image

Signed-off-by: Richard Henderson <[email protected]>
7 years agotests: Enable boot-serial-test for hppa
Richard Henderson [Sun, 4 Feb 2018 06:46:15 +0000 (22:46 -0800)]
tests: Enable boot-serial-test for hppa

Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
7 years agohw/hppa: Use qemu_log_mask instead of fprintf to stderr
Richard Henderson [Sun, 4 Feb 2018 06:41:41 +0000 (22:41 -0800)]
hw/hppa: Use qemu_log_mask instead of fprintf to stderr

Reviewed-by: Alex Bennée <[email protected]>
Reported-by: Thomas Huth <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
7 years agotpm: tis: move one-line function into caller
Stefan Berger [Fri, 2 Feb 2018 13:39:18 +0000 (08:39 -0500)]
tpm: tis: move one-line function into caller

Signed-off-by: Stefan Berger <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
7 years agoMAINTAINERS: add pointer to tpm-next repository
Stefan Berger [Fri, 2 Feb 2018 11:51:38 +0000 (06:51 -0500)]
MAINTAINERS: add pointer to tpm-next repository

Signed-off-by: Stefan Berger <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
7 years agotpm: wrap stX_be_p in tpm_cmd_set_XYZ functions
Stefan Berger [Thu, 1 Feb 2018 23:05:10 +0000 (18:05 -0500)]
tpm: wrap stX_be_p in tpm_cmd_set_XYZ functions

Wrap the calls to stl_be_p and stw_be_p in tpm_cmd_set_XYZ functions
that are similar to existing getters.

Signed-off-by: Stefan Berger <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
7 years agotpm: Split off tpm_crb_reset function
Stefan Berger [Thu, 1 Feb 2018 22:55:50 +0000 (17:55 -0500)]
tpm: Split off tpm_crb_reset function

Split off the tpm_crb_reset function part from tpm_crb_realize
that we need to run every time the machine resets.

Also register our reset function with the system since TYPE_DEVICE
seems to not get a reset otherwise.

Signed-off-by: Stefan Berger <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/kraxel/tags/ui-20180202-pull-request' into...
Peter Maydell [Fri, 2 Feb 2018 18:54:11 +0000 (18:54 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20180202-pull-request' into staging

ui: use QIONetListener in vnc, bugfixes for sdl1 and vnc.

# gpg: Signature made Fri 02 Feb 2018 07:17:36 GMT
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>"
# gpg:                 aka "Gerd Hoffmann <[email protected]>"
# gpg:                 aka "Gerd Hoffmann (private) <[email protected]>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/ui-20180202-pull-request:
  ui: correctly advance output buffer when writing SASL data
  ui: convert VNC server to QIONetListener
  ui: fix mixup between qnum and qcode in SDL1 key handling

Signed-off-by: Peter Maydell <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/kraxel/tags/vga-20180202-pull-request' into...
Peter Maydell [Fri, 2 Feb 2018 17:24:00 +0000 (17:24 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/vga-20180202-pull-request' into staging

virtio-gpu: disallow vIOMMU

# gpg: Signature made Fri 02 Feb 2018 08:31:52 GMT
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>"
# gpg:                 aka "Gerd Hoffmann <[email protected]>"
# gpg:                 aka "Gerd Hoffmann (private) <[email protected]>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/vga-20180202-pull-request:
  virtio-gpu: disallow vIOMMU

Signed-off-by: Peter Maydell <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/gkurz/tags/for-upstream' into staging
Peter Maydell [Fri, 2 Feb 2018 16:26:41 +0000 (16:26 +0000)]
Merge remote-tracking branch 'remotes/gkurz/tags/for-upstream' into staging

This series is mostly about 9p request cancellation. It fixes a
long standing bug (read "specification violation") where the server
would send an invalid response when the client has cancelled an
in-flight request. This was causing annoying spurious EINTR returns
in linux. The fix comes with some related testing in QTEST.

Other patches are code cleanup and improvements.

# gpg: Signature made Fri 02 Feb 2018 10:16:03 GMT
# gpg:                using RSA key 71D4D5E5822F73D6
# gpg: Good signature from "Greg Kurz <[email protected]>"
# gpg:                 aka "Gregory Kurz <[email protected]>"
# gpg:                 aka "[jpeg image of size 3330]"
# Primary key fingerprint: B482 8BAF 9431 40CE F2A3  4910 71D4 D5E5 822F 73D6

* remotes/gkurz/tags/for-upstream:
  tests/virtio-9p: explicitly handle potential integer overflows
  tests: virtio-9p: add FLUSH operation test
  libqos/virtio: return length written into used descriptor
  tests: virtio-9p: add WRITE operation test
  tests: virtio-9p: add LOPEN operation test
  tests: virtio-9p: use the synth backend
  tests: virtio-9p: wait for completion in the test code
  tests: virtio-9p: move request tag to the test functions
  9pfs: Correctly handle cancelled requests
  9pfs: drop v9fs_register_transport()

Signed-off-by: Peter Maydell <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/kraxel/tags/audio-20180202-pull-request' into...
Peter Maydell [Fri, 2 Feb 2018 15:33:57 +0000 (15:33 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/audio-20180202-pull-request' into staging

audio: two small fixes.

# gpg: Signature made Fri 02 Feb 2018 07:49:20 GMT
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>"
# gpg:                 aka "Gerd Hoffmann <[email protected]>"
# gpg:                 aka "Gerd Hoffmann (private) <[email protected]>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/audio-20180202-pull-request:
  hw/audio/sb16.c: change dolog() to qemu_log_mask()
  hw/audio/wm8750: move WM8750 declarations from i2c/i2c.h to audio/wm8750.h

Signed-off-by: Peter Maydell <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/cminyard/tags/for-release-20180201' into staging
Peter Maydell [Fri, 2 Feb 2018 14:10:13 +0000 (14:10 +0000)]
Merge remote-tracking branch 'remotes/cminyard/tags/for-release-20180201' into staging

Lots of litte miscellaneous fixes for the IPMI code, plus
add me as the IPMI maintainer.

# gpg: Signature made Thu 01 Feb 2018 18:44:55 GMT
# gpg:                using RSA key 61F38C90919BFF81
# gpg: Good signature from "Corey Minyard <[email protected]>"
# gpg:                 aka "Corey Minyard <[email protected]>"
# gpg:                 aka "Corey Minyard <[email protected]>"
# gpg:                 aka "Corey Minyard <[email protected]>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: FD0D 5CE6 7CE0 F59A 6688  2686 61F3 8C90 919B FF81

* remotes/cminyard/tags/for-release-20180201:
  ipmi: Allow BMC device properties to be set
  ipmi: disable IRQ and ATN on an external disconnect
  ipmi: Fix macro issues
  ipmi: Add the platform event message command
  ipmi: Don't set the timestamp on add events that don't have it
  ipmi: Fix SEL get/set time commands
  Add maintainer for the IPMI code

Signed-off-by: Peter Maydell <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/elmarco/tags/dump-pull-request' into staging
Peter Maydell [Fri, 2 Feb 2018 10:57:50 +0000 (10:57 +0000)]
Merge remote-tracking branch 'remotes/elmarco/tags/dump-pull-request' into staging

# gpg: Signature made Thu 01 Feb 2018 11:15:42 GMT
# gpg:                using RSA key DAE8E10975969CE5
# gpg: Good signature from "Marc-André Lureau <[email protected]>"
# gpg:                 aka "Marc-André Lureau <[email protected]>"
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* remotes/elmarco/tags/dump-pull-request:
  dump-guest-memory.py: skip vmcoreinfo section if not available

Signed-off-by: Peter Maydell <[email protected]>
7 years agotests/virtio-9p: explicitly handle potential integer overflows
Greg Kurz [Thu, 1 Feb 2018 20:21:28 +0000 (21:21 +0100)]
tests/virtio-9p: explicitly handle potential integer overflows

Signed-off-by: Greg Kurz <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
7 years agotests: virtio-9p: add FLUSH operation test
Greg Kurz [Thu, 1 Feb 2018 20:21:28 +0000 (21:21 +0100)]
tests: virtio-9p: add FLUSH operation test

The idea is to send a victim request that will possibly block in the
server and to send a flush request to cancel the victim request.

This patch adds two test to verifiy that:
- the server does not reply to a victim request that was actually
  cancelled
- the server replies to the flush request after replying to the
  victim request if it could not cancel it

9p request cancellation reference:

http://man.cat-v.org/plan_9/5/flush

Signed-off-by: Greg Kurz <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
(groug, change the test to only write a single byte to avoid
        any alignment or endianess consideration)

7 years agolibqos/virtio: return length written into used descriptor
Greg Kurz [Thu, 1 Feb 2018 20:21:28 +0000 (21:21 +0100)]
libqos/virtio: return length written into used descriptor

When a 9p request is flushed (ie, cancelled) by the guest, the device
is expected to simply mark the request as used, without sending a 9p
reply (ie, without writing anything into the used buffer).

To be able to test this, we need access to the length written by the
device into the used descriptor. This patch adds a uint32_t * argument
to qvirtqueue_get_buf() and qvirtio_wait_used_elem() for this purpose.

All existing users are updated accordingly.

Signed-off-by: Greg Kurz <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging
Peter Maydell [Fri, 2 Feb 2018 09:53:15 +0000 (09:53 +0000)]
Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging

# gpg: Signature made Thu 01 Feb 2018 04:05:22 GMT
# gpg:                using RSA key BDBE7B27C0DE3057
# gpg: Good signature from "Jeffrey Cody <[email protected]>"
# gpg:                 aka "Jeffrey Cody <[email protected]>"
# gpg:                 aka "Jeffrey Cody <[email protected]>"
# Primary key fingerprint: 9957 4B4D 3474 90E7 9D98  D624 BDBE 7B27 C0DE 3057

* remotes/cody/tags/block-pull-request:
  iotests: Make 200 run on tmpfs
  block/ssh: fix possible segmentation fault when .desc is not null-terminated

Signed-off-by: Peter Maydell <[email protected]>
7 years agovirtio-gpu: disallow vIOMMU
Peter Xu [Wed, 31 Jan 2018 04:04:01 +0000 (12:04 +0800)]
virtio-gpu: disallow vIOMMU

virtio-gpu has special code path that bypassed vIOMMU protection.  So
for now let's disable iommu_platform for the device until we fully
support that (if needed).

After the patch, both virtio-vga and virtio-gpu won't allow to boot with
iommu_platform parameter set.

CC: Gerd Hoffmann <[email protected]>
Signed-off-by: Peter Xu <[email protected]>
Message-id: 20180131040401[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
7 years agohw/audio/sb16.c: change dolog() to qemu_log_mask()
John Arbuckle [Thu, 1 Feb 2018 17:27:44 +0000 (12:27 -0500)]
hw/audio/sb16.c: change dolog() to qemu_log_mask()

Changes all the occurrances of dolog() to qemu_log_mask().

Signed-off-by: John Arbuckle <[email protected]>
Message-id: 20180201172744[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
7 years agohw/audio/wm8750: move WM8750 declarations from i2c/i2c.h to audio/wm8750.h
Philippe Mathieu-Daudé [Tue, 19 Sep 2017 12:30:53 +0000 (09:30 -0300)]
hw/audio/wm8750: move WM8750 declarations from i2c/i2c.h to audio/wm8750.h

while here use TYPE_WM8750 and declare a data_req_cb() typedef.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20170919123053[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
7 years agoui: correctly advance output buffer when writing SASL data
Daniel P. Berrangé [Thu, 1 Feb 2018 15:58:41 +0000 (15:58 +0000)]
ui: correctly advance output buffer when writing SASL data

In this previous commit:

  commit 8f61f1c5a6bc06438a1172efa80bc7606594fa07
  Author: Daniel P. Berrange <[email protected]>
  Date:   Mon Dec 18 19:12:20 2017 +0000

    ui: track how much decoded data we consumed when doing SASL encoding

I attempted to fix a flaw with tracking how much data had actually been
processed when encoding with SASL. With that flaw, the VNC server could
mistakenly discard queued data that had not been sent.

The fix was not quite right though, because it merely decremented the
vs->output.offset value. This is effectively discarding data from the
end of the pending output buffer. We actually need to discard data from
the start of the pending output buffer. We also want to free memory that
is no longer required. The correct way to handle this is to use the
buffer_advance() helper method instead of directly manipulating the
offset value.

Reported-by: Laszlo Ersek <[email protected]>
Signed-off-by: Daniel P. Berrangé <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Message-id: 20180201155841[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
7 years agoui: convert VNC server to QIONetListener
Daniel P. Berrange [Thu, 1 Feb 2018 16:45:14 +0000 (16:45 +0000)]
ui: convert VNC server to QIONetListener

The VNC server already has the ability to listen on multiple sockets.
Converting it to use the QIONetListener APIs though, will reduce the
amount of code in the VNC server and improve the clarity of what is
left.

Signed-off-by: Daniel P. Berrange <[email protected]>
Message-id: 20180201164514[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
7 years agoui: fix mixup between qnum and qcode in SDL1 key handling
Daniel P. Berrangé [Thu, 1 Feb 2018 18:00:33 +0000 (18:00 +0000)]
ui: fix mixup between qnum and qcode in SDL1 key handling

The previous commit:

  commit 2ec78706d188df7d3dab43d07b19b05ef7800a44
  Author: Daniel P. Berrange <[email protected]>
  Date:   Wed Jan 17 16:47:15 2018 +0000

    ui: convert GTK and SDL1 frontends to keycodemapdb

changed the x_keymap.c keymap so that its target was qcodes instead of
qnums. It updated the GTK frontend to take account of this change, but
forgot to update the SDL1 frontend. Thus the SDL frontend was getting
qcodes but dispatching them as if they were qnums. IOW, keyboard input
was completely hosed with SDL1. Since the keyboard layout tables are
still all based on qnums, it is easier to just keep SDL1 using qnums as
it will be deleted in a few releases time.

Reported-by: BALATON Zoltan <[email protected]>
Signed-off-by: Daniel P. Berrangé <[email protected]>
Tested-by: BALATON Zoltan <[email protected]>
Message-id: 20180201180033[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
7 years agotests: virtio-9p: add WRITE operation test
Greg Kurz [Thu, 1 Feb 2018 20:21:28 +0000 (21:21 +0100)]
tests: virtio-9p: add WRITE operation test

Trivial test of a successful write.

Signed-off-by: Greg Kurz <[email protected]>
(groug, handle potential overflow when computing request size,
        add missing g_free(buf),
        backend handles one written byte at a time to validate
        the server doesn't do short-reads)
Reviewed-by: Stefan Hajnoczi <[email protected]>
7 years agotests: virtio-9p: add LOPEN operation test
Greg Kurz [Thu, 1 Feb 2018 20:21:28 +0000 (21:21 +0100)]
tests: virtio-9p: add LOPEN operation test

Trivial test of a successful open.

Signed-off-by: Greg Kurz <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
7 years agotests: virtio-9p: use the synth backend
Greg Kurz [Thu, 1 Feb 2018 20:21:27 +0000 (21:21 +0100)]
tests: virtio-9p: use the synth backend

The purpose of virtio-9p-test is to test the virtio-9p device, especially
the 9p server state machine. We don't really care what fsdev backend we're
using. Moreover, if we want to be able to test the flush request or a
device reset with in-flights I/O, it is close to impossible to achieve
with a physical backend because we cannot ask it reliably to put an I/O
on hold at a specific point in time.

Fortunately, we can do that with the synthetic backend, which allows to
register callbacks on read/write accesses to a specific file. This will
be used by a later patch to test the 9P flush request.

The walk request test is converted to using the synth backend.

Signed-off-by: Greg Kurz <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
7 years agotests: virtio-9p: wait for completion in the test code
Greg Kurz [Thu, 1 Feb 2018 20:21:27 +0000 (21:21 +0100)]
tests: virtio-9p: wait for completion in the test code

In order to test request cancellation, we will need to send multiple
requests and wait for the associated replies. Since we poll the ISR
to know if a request completed, we may have several replies to parse
when we detect ISR was set to 1.

This patch moves the waiting out of the reply parsing path, up into
the functional tests.

Signed-off-by: Greg Kurz <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
7 years agotests: virtio-9p: move request tag to the test functions
Greg Kurz [Thu, 1 Feb 2018 20:21:27 +0000 (21:21 +0100)]
tests: virtio-9p: move request tag to the test functions

It doesn't really makes sense to hide the request tag from the test
functions. It prevents to test the 9p server behavior when passed
a wrong tag (ie, still in use or different from P9_NOTAG for a
version request). Also the spec says that a tag is reusable as soon
as the corresponding request was replied or flushed: no need to
always increment tags like we do now. And finaly, an upcoming test
of the flush command will need to manipulate tags explicitely.

This simply changes all request functions to have a tag argument.
Except for the version request which needs P9_NOTAG, all other
tests can pass 0 since they wait for the reply before sending
another request.

Signed-off-by: Greg Kurz <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
7 years ago9pfs: Correctly handle cancelled requests
Keno Fischer [Thu, 1 Feb 2018 20:21:27 +0000 (21:21 +0100)]
9pfs: Correctly handle cancelled requests

# Background

I was investigating spurious non-deterministic EINTR returns from
various 9p file system operations in a Linux guest served from the
qemu 9p server.

 ## EINTR, ERESTARTSYS and the linux kernel

When a signal arrives that the Linux kernel needs to deliver to user-space
while a given thread is blocked (in the 9p case waiting for a reply to its
request in 9p_client_rpc -> wait_event_interruptible), it asks whatever
driver is currently running to abort its current operation (in the 9p case
causing the submission of a TFLUSH message) and return to user space.
In these situations, the error message reported is generally ERESTARTSYS.
If the userspace processes specified SA_RESTART, this means that the
system call will get restarted upon completion of the signal handler
delivery (assuming the signal handler doesn't modify the process state
in complicated ways not relevant here). If SA_RESTART is not specified,
ERESTARTSYS gets translated to EINTR and user space is expected to handle
the restart itself.

 ## The 9p TFLUSH command

The 9p TFLUSH commands requests that the server abort an ongoing operation.
The man page [1] specifies:

```
If it recognizes oldtag as the tag of a pending transaction, it should
abort any pending response and discard that tag.
[...]
When the client sends a Tflush, it must wait to receive the corresponding
Rflush before reusing oldtag for subsequent messages. If a response to the
flushed request is received before the Rflush, the client must honor the
response as if it had not been flushed, since the completed request may
signify a state change in the server
```

In particular, this means that the server must not send a reply with the
orignal tag in response to the cancellation request, because the client is
obligated to interpret such a reply as a coincidental reply to the original
request.

 # The bug

When qemu receives a TFlush request, it sets the `cancelled` flag on the
relevant pdu. This flag is periodically checked, e.g. in
`v9fs_co_name_to_path`, and if set, the operation is aborted and the error
is set to EINTR. However, the server then violates the spec, by returning
to the client an Rerror response, rather than discarding the message
entirely. As a result, the client is required to assume that said Rerror
response is a result of the original request, not a result of the
cancellation and thus passes the EINTR error back to user space.
This is not the worst thing it could do, however as discussed above, the
correct error code would have been ERESTARTSYS, such that user space
programs with SA_RESTART set get correctly restarted upon completion of
the signal handler.
Instead, such programs get spurious EINTR results that they were not
expecting to handle.

It should be noted that there are plenty of user space programs that do not
set SA_RESTART and do not correctly handle EINTR either. However, that is
then a userspace bug. It should also be noted that this bug has been
mitigated by a recent commit to the Linux kernel [2], which essentially
prevents the kernel from sending Tflush requests unless the process is about
to die (in which case the process likely doesn't care about the response).
Nevertheless, for older kernels and to comply with the spec, I believe this
change is beneficial.

 # Implementation

The fix is fairly simple, just skipping notification of a reply if
the pdu was previously cancelled. We do however, also notify the transport
layer that we're doing this, so it can clean up any resources it may be
holding. I also added a new trace event to distinguish
operations that caused an error reply from those that were cancelled.

One complication is that we only omit sending the message on EINTR errors in
order to avoid confusing the rest of the code (which may assume that a
client knows about a fid if it sucessfully passed it off to pud_complete
without checking for cancellation status). This does mean that if the server
acts upon the cancellation flag, it always needs to set err to EINTR. I
believe this is true of the current code.

[1] https://9fans.github.io/plan9port/man/man9/flush.html
[2] https://github.com/torvalds/linux/commit/9523feac272ccad2ad8186ba4fcc891

Signed-off-by: Keno Fischer <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
[groug, send a zero-sized reply instead of detaching the buffer]
Signed-off-by: Greg Kurz <[email protected]>
Acked-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Stefano Stabellini <[email protected]>
7 years ago9pfs: drop v9fs_register_transport()
Greg Kurz [Thu, 1 Feb 2018 20:21:27 +0000 (21:21 +0100)]
9pfs: drop v9fs_register_transport()

No good reasons to do this outside of v9fs_device_realize_common().

Signed-off-by: Greg Kurz <[email protected]>
Reviewed-by: Stefano Stabellini <[email protected]>
7 years agodump-guest-memory.py: skip vmcoreinfo section if not available
Marc-André Lureau [Wed, 31 Jan 2018 10:37:24 +0000 (11:37 +0100)]
dump-guest-memory.py: skip vmcoreinfo section if not available

On some architectures, qemu doesn't support vmcoreinfo device,
and dump-guest-memory fails:

(gdb) dump-guest-memory /tmp/vmcore  ppc64-le
guest RAM blocks:
target_start     target_end       host_addr        message count
---------------- ---------------- ---------------- ------- -----
0000000000000000 0000000200000000 00003ffd86980000 added       1
0000200080000000 0000200080800000 00003ffd86170000 added       2
Python Exception <class 'gdb.error'> No symbol "vmcoreinfo_realize" in current context.:
Error occurred in Python command: No symbol "vmcoreinfo_realize" in current context.

Check that vmcoreinfo_realize symbol exists before evaluating an
expression with it.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
7 years agoiotests: Make 200 run on tmpfs
Max Reitz [Wed, 17 Jan 2018 13:50:15 +0000 (14:50 +0100)]
iotests: Make 200 run on tmpfs

200 currently fails on tmpfs because it sets cache=none.  However,
without that (and aio=native), the test still works now and it fails
before Jeff's series (on fc7dbc119e0852a70dc9fa68bb41a318e49e4cd6).  So
we can probably remove the aio=native safely, and replace cache=none by
cache=$CACHEMODE.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Jeff Cody <[email protected]>
Message-id: 20180117135015[email protected]
Signed-off-by: Jeff Cody <[email protected]>
7 years agoblock/ssh: fix possible segmentation fault when .desc is not null-terminated
Murilo Opsfelder Araujo [Fri, 5 Jan 2018 14:44:40 +0000 (12:44 -0200)]
block/ssh: fix possible segmentation fault when .desc is not null-terminated

This patch prevents a possible segmentation fault when .desc members are checked
against NULL.

The ssh_runtime_opts was added by commit
8a6a80896d6af03b8ee0c17cdf37219eca2588a7 ("block/ssh: Use QemuOpts for runtime
options").

This fix was inspired by
http://lists.nongnu.org/archive/html/qemu-devel/2018-01/msg00883.html.

Fixes: 8a6a80896d6af03b8ee0c17cdf37219eca2588a7 ("block/ssh: Use QemuOpts for runtime options")
Cc: Max Reitz <[email protected]>
Cc: Eric Blake <[email protected]>
Signed-off-by: Murilo Opsfelder Araujo <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Jeff Cody <[email protected]>
Signed-off-by: Jeff Cody <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/rth/tags/pull-hppa-20180131' into staging
Peter Maydell [Wed, 31 Jan 2018 15:50:29 +0000 (15:50 +0000)]
Merge remote-tracking branch 'remotes/rth/tags/pull-hppa-20180131' into staging

Implement hppa-softmmu

# gpg: Signature made Wed 31 Jan 2018 14:19:06 GMT
# gpg:                using RSA key 0x64DF38E8AF7E215F
# gpg: Good signature from "Richard Henderson <[email protected]>"
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* remotes/rth/tags/pull-hppa-20180131: (43 commits)
  target/hppa: Implement PROBE for system mode
  target/hppa: Fix 32-bit operand masks for 0E FCVT
  hw/hppa: Add MAINTAINERS entry
  pc-bios: Add hppa-firmware.img and git submodule
  hw/hppa: Implement DINO system board
  target/hppa: Enable MTTCG
  target/hppa: Implement STWA
  target/hppa: Implement a pause instruction
  target/hppa: Implement LDSID for system mode
  target/hppa: Fix comment
  target/hppa: Increase number of temp regs
  target/hppa: Only use EXCP_DTLB_MISS
  target/hppa: Implement B,GATE insn
  target/hppa: Add migration for the cpu
  target/hppa: Add system registers to gdbstub
  target/hppa: Optimize for flat addressing space
  target/hppa: Implement halt and reset instructions
  target/hppa: Implement SYNCDMA insn
  target/hppa: Implement LCI
  target/hppa: Implement LPA
  ...

Signed-off-by: Peter Maydell <[email protected]>
7 years agotarget/hppa: Implement PROBE for system mode
Richard Henderson [Wed, 24 Jan 2018 23:03:25 +0000 (15:03 -0800)]
target/hppa: Implement PROBE for system mode

Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/hppa: Fix 32-bit operand masks for 0E FCVT
Richard Henderson [Wed, 24 Jan 2018 22:24:53 +0000 (14:24 -0800)]
target/hppa: Fix 32-bit operand masks for 0E FCVT

We masked the wrong bits, which prevented some of the
32-bit R registers.  E.g. "fcnvxf,sgl,sgl fr22R,fr6R".

Signed-off-by: Richard Henderson <[email protected]>
7 years agohw/hppa: Add MAINTAINERS entry
Richard Henderson [Sun, 21 Jan 2018 22:05:03 +0000 (14:05 -0800)]
hw/hppa: Add MAINTAINERS entry

Signed-off-by: Richard Henderson <[email protected]>
7 years agopc-bios: Add hppa-firmware.img and git submodule
Richard Henderson [Sun, 21 Jan 2018 21:04:45 +0000 (13:04 -0800)]
pc-bios: Add hppa-firmware.img and git submodule

Signed-off-by: Richard Henderson <[email protected]>
7 years agohw/hppa: Implement DINO system board
Helge Deller [Sun, 8 Oct 2017 20:47:27 +0000 (16:47 -0400)]
hw/hppa: Implement DINO system board

Now that we have the prerequisites in target/hppa/,
implement the hardware for a PA7100LC.

This also enables build for hppa-softmmu.

Signed-off-by: Helge Deller <[email protected]>
[rth: Since it is all new code, squashed all branch development
withing hw/hppa/ to a single patch.]
Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/hppa: Enable MTTCG
Richard Henderson [Sun, 7 Jan 2018 00:02:27 +0000 (16:02 -0800)]
target/hppa: Enable MTTCG

Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/hppa: Implement STWA
Richard Henderson [Sat, 6 Jan 2018 23:30:45 +0000 (15:30 -0800)]
target/hppa: Implement STWA

Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/hppa: Implement a pause instruction
Richard Henderson [Fri, 5 Jan 2018 00:49:29 +0000 (16:49 -0800)]
target/hppa: Implement a pause instruction

This is an extension to the base ISA, but we can use this in
the kernel idle loop to reduce the host cpu time consumed.

Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/hppa: Implement LDSID for system mode
Helge Deller [Tue, 2 Jan 2018 20:31:45 +0000 (21:31 +0100)]
target/hppa: Implement LDSID for system mode

Signed-off-by: Helge Deller <[email protected]>
Message-Id: <20180102203145[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/hppa: Fix comment
Helge Deller [Tue, 12 Dec 2017 21:23:19 +0000 (22:23 +0100)]
target/hppa: Fix comment

Signed-off-by: Helge Deller <[email protected]>
Message-Id: <20171212212319[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/hppa: Increase number of temp regs
Richard Henderson [Wed, 1 Nov 2017 12:03:09 +0000 (05:03 -0700)]
target/hppa: Increase number of temp regs

HP-UX 10.20 CD contains "add r0, r0, r27" in a delay slot,
which uses at least 5 temps.

Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/hppa: Only use EXCP_DTLB_MISS
Richard Henderson [Fri, 29 Dec 2017 03:26:52 +0000 (19:26 -0800)]
target/hppa: Only use EXCP_DTLB_MISS

Unknown why this works, but if we return EXCP_ITLB_MISS we
will triple-fault the first userland instruction fetch.
Is it something to do with having a combined I/DTLB?

Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/hppa: Implement B,GATE insn
Richard Henderson [Fri, 15 Dec 2017 20:37:26 +0000 (14:37 -0600)]
target/hppa: Implement B,GATE insn

Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/hppa: Add migration for the cpu
Richard Henderson [Mon, 20 Nov 2017 10:06:04 +0000 (11:06 +0100)]
target/hppa: Add migration for the cpu

Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/hppa: Add system registers to gdbstub
Richard Henderson [Tue, 7 Nov 2017 04:42:14 +0000 (05:42 +0100)]
target/hppa: Add system registers to gdbstub

Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/hppa: Optimize for flat addressing space
Richard Henderson [Mon, 6 Nov 2017 20:10:33 +0000 (21:10 +0100)]
target/hppa: Optimize for flat addressing space

Linux sets sr4-sr7 all to the same value, which means that we
need not do any runtime computation to find out what space to
use in forming the GVA.

Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/hppa: Implement halt and reset instructions
Helge Deller [Fri, 29 Dec 2017 06:04:57 +0000 (22:04 -0800)]
target/hppa: Implement halt and reset instructions

Real hardware would use an external device to control the power.
But for the moment let's invent instructions in reserved space,
to be used by our custom firmware.

Signed-off-by: Helge Deller <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
7 years agoipmi: Allow BMC device properties to be set
Corey Minyard [Mon, 28 Aug 2017 17:48:44 +0000 (12:48 -0500)]
ipmi: Allow BMC device properties to be set

Signed-off-by: Corey Minyard <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
7 years agoipmi: disable IRQ and ATN on an external disconnect
Corey Minyard [Tue, 19 Sep 2017 20:19:26 +0000 (15:19 -0500)]
ipmi: disable IRQ and ATN on an external disconnect

Otherwise there's no way to clear them without an external command,
and it could lock the OS in the VM if they were stuck.

Signed-off-by: Corey Minyard <[email protected]>
7 years agoipmi: Fix macro issues
Corey Minyard [Thu, 22 Dec 2016 14:22:11 +0000 (08:22 -0600)]
ipmi: Fix macro issues

Macro parameters should almost always have () around them when used.
llvm reported an error on this.

Remove redundant parenthesis and put parenthesis around the entire
macros with assignments in case they are used in an expression.

The macros were doing ((v) & 1) for a binary input, but that only works
if v == 0 or if v & 1.  Changed to !!(v) so they work for all values.

Remove some unused macros.

Reported in https://bugs.launchpad.net/bugs/1651167

An audit of these changes found no semantic changes; this is just
cleanups for proper style and to avoid a compiler warning.

Signed-off-by: Corey Minyard <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
7 years agoipmi: Add the platform event message command
Corey Minyard [Sat, 19 Aug 2017 01:17:48 +0000 (20:17 -0500)]
ipmi: Add the platform event message command

This lets an event be added to the SEL as if a sensor had generated
it.  The OpenIPMI driver uses it for storing panic event information.

Signed-off-by: Corey Minyard <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
7 years agoipmi: Don't set the timestamp on add events that don't have it
Corey Minyard [Sat, 19 Aug 2017 01:15:02 +0000 (20:15 -0500)]
ipmi: Don't set the timestamp on add events that don't have it

According to the spec, from section "32.3 OEM SEL Record - Type
E0h-FFh", event types from 0x0e to 0xff do not have a timestamp.
So don't set it when adding those types.  This required putting
the timestamp in a temporary buffer, since it's still required
to set the last addition time.

Signed-off-by: Corey Minyard <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
This page took 0.092571 seconds and 4 git commands to generate.