Commit Graph

42099 Commits

Author SHA1 Message Date
Thomas Huth b21de19992 hw/display/tcx: Remove superfluous OBJECT() typecasts
The tcx_initfn() function is already supplied with an
Object *obj pointer, so there is no need to cast the
state pointer back to an Object pointer all over the
place. And while we're at it, also remove the superfluous
"return;" statement in this function.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2015-11-06 15:42:38 +03:00
Kevin Wolf 5accecb3a6 gdbstub: Fix buffer overflows in gdb_handle_packet()
Some places in gdb_handle_packet() can get an arbitrary length (most
times directly from the client) and either didn't check it at all or
checked against the wrong value, potentially causing buffer overflows.

Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2015-11-06 15:42:37 +03:00
Marc-André Lureau 3c15d3a450 hw/acpi/aml-build: remove useless glib version check
2.22 is the minimum version required

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2015-11-06 15:42:37 +03:00
Peter Maydell 9319738080 So here it is, let's see what happens.
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQEcBAABCAAGBQJWPHM6AAoJEL/70l94x66DK5YIAJTNthYWL8eNhQ1iek6CLlV+
 etVXm3JDmkV0zOfYVHLBb44VLZ6I1ocas+57F/kmz7SKpMLiI6bMXRxhTSkiO4D+
 3N36cWQf3fq+P0DmxuikMlYGz8V6QQ5PQE2xJKV0ZIWAkiqInxilkN3qt81sNR+A
 A9Ohom3sc0eGHyYJcVDK4krbnNSAZjIB2yMWperw61x+GYAhxjA02HPUgB32KK6q
 KrdnKmnRu9Cw6y4wTCbbDITJztPexZYsX2DOJh30wC0eNcE+MZ7J2im8Frpxe+Ml
 C8MUuvSqLOyeu9tUfrXGzd6kMtEKrmU+fh2nNbxJbtfowDjkW2jcIEgC0UjkGE4=
 =BF1q
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream-replay' into staging

So here it is, let's see what happens.

# gpg: Signature made Fri 06 Nov 2015 09:30:34 GMT using RSA key ID 78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"

* remotes/bonzini/tags/for-upstream-replay:
  replay: recording of the user input
  replay: command line options
  replay: replay blockers for devices
  replay: initialization and deinitialization
  replay: ptimer
  bottom halves: introduce bh call function
  replay: checkpoints
  icount: improve counting for record/replay
  replay: shutdown event
  replay: recording and replaying clock ticks
  replay: asynchronous events infrastructure
  replay: interrupts and exceptions
  cpu: replay instructions sequence
  cpu-exec: allow temporary disabling icount
  replay: introduce icount event
  replay: introduce mutex to protect the replay log
  replay: internal functions for replay log
  replay: global variables and function stubs

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-06 11:31:40 +00:00
Stefan Hajnoczi 3aa88b3129 configure: add missing --disable-modules option
According to ./configure all options should have both --enable-foo and
--disable-foo:

  # Always add --enable-foo and --disable-foo command line args.
  # Distributions want to ensure that several features are compiled in, and it
  # is impossible without a --enable-foo that exits if a feature is not found.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-id: 1446473183-24250-1-git-send-email-stefanha@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-06 11:07:14 +00:00
Peter Maydell 5744181323 X86 queue, 2015-11-05
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJWO6+DAAoJECgHk2+YTcWmsjUQAKY4n/D+79oru7d3k/ZdL4Bj
 qP3Ghahy6IV1xzCTh92HbKjYYI/2TYAasXE9riNAf2gadfQYFmgbm4dIbav1Dz8D
 p2oTLX2d6h0QMJYn3IODdpXm0+7ixJ024R2yHidn1MtGPBRfpk1O5vvdnu5u8JMW
 ocIOtxmjsUwPk1e49ylpJ6fTXnhqeO4A41OeSjN9h/mUIg5YTe4T6yyyxdhg/jvL
 BdCQVu+xxFSlerfeEKVD8yoUzr7Q/wA8Hmy0HQMXlrvWVlyvM8ZfXrP5scgfIJTm
 4f5CjIk8BnyC1lSAYSqRMWl0jGDOGKiAz9dqrT+b9r7dvby1Kj0Q4wNuK7ilA0tZ
 DPCFNeJjGspJopPNEIUe4n7OQY2ReTHLDy+SKVj5mf4ISrHW/Kk+UxWHA+YT0p49
 E6Udv5J748RwPHX6/mmj3clPsJG/GniKK9awoccO+wInwuBBJekjs/s7vyU6rC8N
 yUsFU132iY8EBvVlcw6B4hAFc0z1ONkgtq//DR1d92VdTfB9ZCegsv7G9PnyZjRQ
 9iPPwnn0Vr9Yof7giqdbHkXyDm2AuZUDs4CGj884BgfVkbA7OnEzWTBMrHxBcxIR
 vbWEi3FVXRwLTd+l7LRfMqum9UIsBmqB57D297nasSIVaIKMfn3pqxbmWN1SbCzW
 GPTSaCYftfRBDuqIruHi
 =j5K5
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-request' into staging

X86 queue, 2015-11-05

# gpg: Signature made Thu 05 Nov 2015 19:35:31 GMT using RSA key ID 984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"

* remotes/ehabkost/tags/x86-pull-request:
  target-i386: Enable clflushopt/clwb/pcommit instructions
  target-i386: Remove POPCNT from qemu64 and qemu32 CPU models
  target-i386: Remove ABM from qemu64 CPU model
  target-i386: Remove SSE4a from qemu64 CPU model
  target-i386: Set "check=off" by default on pc-*-2.4 and older

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-06 10:10:15 +00:00
Pavel Dovgalyuk ee312992a3 replay: recording of the user input
This records user input (keyboard and mouse events) in record mode and replays
these input events in replay mode.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150917162524.8676.11696.stgit@PASHA-ISP.def.inno>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
2015-11-06 10:16:03 +01:00
Pavel Dovgalyuk 4c27b85972 replay: command line options
This patch introduces command line options for enabling recording or replaying
virtual machine behavior. These options are added to icount command line
parameter. They include 'rr' which switches between record and replay
and 'rrfile' for specifying the filename for replay log.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150917162518.8676.70792.stgit@PASHA-ISP.def.inno>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
2015-11-06 10:16:03 +01:00
Pavel Dovgalyuk 0194749ac4 replay: replay blockers for devices
Some devices are not supported by record/replay subsystem.
This patch introduces replay blocker which denies starting record/replay
if such devices are included into the configuration.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150917162512.8676.11367.stgit@PASHA-ISP.def.inno>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
2015-11-06 10:16:03 +01:00
Pavel Dovgalyuk 7615936ebf replay: initialization and deinitialization
This patch introduces the functions for enabling the record/replay and for
freeing the resources when simulator closes.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150917162507.8676.90232.stgit@PASHA-ISP.def.inno>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
2015-11-06 10:16:03 +01:00
Pavel Dovgalyuk 8a354bd935 replay: ptimer
This patch adds deterministic replay for hardware periodic countdown timers.
ptimer uses bottom halves layer to execute such an asynchronous callback.
We put this callback into the replay queue instead of bottom halves one.
When checkpoint is met by main loop thread, the replay queue is processed
and callback is executed. Binding callback moment to one of the checkpoints
makes it deterministic.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150917162456.8676.83366.stgit@PASHA-ISP.def.inno>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
2015-11-06 10:16:03 +01:00
Pavel Dovgalyuk df281b80b9 bottom halves: introduce bh call function
This patch introduces aio_bh_call function. It is used to execute
bottom halves as callbacks without adding them to the queue.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150917162450.8676.56980.stgit@PASHA-ISP.def.inno>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
2015-11-06 10:16:03 +01:00
Pavel Dovgalyuk 8bd7f71d79 replay: checkpoints
This patch introduces checkpoints that synchronize cpu thread and iothread.
When checkpoint is met in the code all asynchronous events from the queue
are executed.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150917162444.8676.52916.stgit@PASHA-ISP.def.inno>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
2015-11-06 10:16:03 +01:00
Pavel Dovgalyuk efab87cf79 icount: improve counting for record/replay
icount_warp_rt function is called by qemu_clock_warp and as
callback of icount_warp timer. This patch adds call to qemu_clock_warp
into main_loop_wait function, because icount warp may be missed
in record/replay mode, when CPU is sleeping.
This patch also disables of calling this function by timer, because
it is not needed after making modifications of main_loop_wait.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150917162439.8676.38290.stgit@PASHA-ISP.def.inno>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
2015-11-06 10:16:02 +01:00
Pavel Dovgalyuk b60c48a701 replay: shutdown event
This patch records and replays simulator shutdown event.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150917162433.8676.32262.stgit@PASHA-ISP.def.inno>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
2015-11-06 10:16:02 +01:00
Pavel Dovgalyuk 8eda206e09 replay: recording and replaying clock ticks
Clock ticks are considered as the sources of non-deterministic data for
virtual machine. This patch implements saving the clock values when they
are acquired (virtual, host clock).
When replaying the execution corresponding values are read from log and
transfered to the module, which wants to read the values.
Such a design required the clock polling to be synchronized. Sometimes
it is not true - e.g. when timeouts for timer lists are checked. In this case
we use a cached value of the clock, passing it to the client code.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150917162427.8676.36558.stgit@PASHA-ISP.def.inno>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
2015-11-06 10:16:02 +01:00
Pavel Dovgalyuk c0c071d052 replay: asynchronous events infrastructure
This patch adds module for saving and replaying asynchronous events.
These events include network packets, keyboard and mouse input,
USB packets, thread pool and bottom halves callbacks.
All events are stored in the queue to be processed at synchronization points
such as beginning of TB execution, or checkpoint in the iothread.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150917162422.8676.88696.stgit@PASHA-ISP.def.inno>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
2015-11-06 10:16:02 +01:00
Pavel Dovgalyuk 6f0609697f replay: interrupts and exceptions
This patch includes modifications of common cpu files. All interrupts and
exceptions occured during recording are written into the replay log.
These events allow correct replaying the execution by kicking cpu thread
when one of these events is found in the log.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150917162416.8676.57647.stgit@PASHA-ISP.def.inno>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-11-06 10:16:00 +01:00
Xiao Guangrong f7fda28094 target-i386: Enable clflushopt/clwb/pcommit instructions
These instructions are used by NVDIMM drivers and the specification is
located at:
https://software.intel.com/sites/default/files/managed/0d/53/319433-022.pdf

There instructions are available on Skylake Server.

Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2015-11-05 17:35:04 -02:00
Eduardo Habkost 6aa91e4a02 target-i386: Remove POPCNT from qemu64 and qemu32 CPU models
POPCNT is not available on Penryn and older and on Opteron_G2 and older,
and we want to make the default CPU runnable in most hosts, so it won't
be enabled by default in KVM mode.

We should eventually have all features supported by TCG enabled by
default in TCG mode, but as we don't have a good mechanism today to
ensure we have different defaults in KVM and TCG mode, disable POPCNT in
the qemu64 and qemu32 CPU models entirely.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2015-11-05 16:27:59 -02:00
Eduardo Habkost 711956722c target-i386: Remove ABM from qemu64 CPU model
ABM is not available on Sandy Bridge and older, and we want to make the
default CPU runnable in most hosts, so it won't be enabled by default in
KVM mode.

We should eventually have all features supported by TCG enabled by
default in TCG mode, but as we don't have a good mechanism today to
ensure we have different defaults in KVM and TCG mode, disable ABM in
the qemu64 CPU model entirely.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2015-11-05 16:27:59 -02:00
Eduardo Habkost 0909ad24b2 target-i386: Remove SSE4a from qemu64 CPU model
SSE4a is not available in any Intel CPU, and we want to make the default
CPU runnable in most hosts, so it doesn't make sense to enable it by
default in KVM mode.

We should eventually have all features supported by TCG enabled by
default in TCG mode, but as we don't have a good mechanism today to
ensure we have different defaults in KVM and TCG mode, disable SSE4a in
the qemu64 CPU model entirely.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2015-11-05 16:27:59 -02:00
Eduardo Habkost 3e68482224 target-i386: Set "check=off" by default on pc-*-2.4 and older
The default CPU model (qemu64) have some issues today: it enables some
features (ABM and SSE4a) that are not present in many host CPUs. That
means many hosts (but not all of them) had those features silently
disabled in the default configuration in QEMU 2.4 and older.

With the new "check=on" default, this causes warnings to be printed in
the default configuration, because of the lack of SSE4A on all Intel
hosts, and the lack of ABM on Sandy Bridge and older hosts:

  $ qemu-system-x86_64 -machine pc,accel=kvm
  warning: host doesn't support requested feature: CPUID.80000001H:ECX.abm [bit 5]
  warning: host doesn't support requested feature: CPUID.80000001H:ECX.sse4a [bit 6]

Those issues will be fixed in pc-*-2.5 and newer. But as we can't change
the guest ABI in pc-*-2.4, disable "check" mode by default in pc-*-2.4
and older so we don't print spurious warnings.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2015-11-05 16:27:59 -02:00
Peter Maydell 496c1b19fa * Guest ABI fixes for PC machines (hw_version)
* Fixes for recent Perl
 * John Snow's configure fixes
 * file-backed RAM improvements (Igor, Pavel)
 * -Werror=clobbered fixes (Stefan)
 * Kill -d ioport
 * Fix qemu-system-s390x
 * Performance improvement for kvmclock migration
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQEcBAABAgAGBQJWO1zDAAoJEL/70l94x66DXRgH/ArIMi9MGU2Vxi6wNFG9hKUl
 Cl13IS8VO0ui6R/0F1BFGK90WYxfM5ZsVLPnTdk4OeapY6eKnw0O44VE0GqDZKFa
 k3B9qzQLGPLZV75cd8WP+ZHDbPcIgPecr8Jz3/w18rYIcGZQ6GF45xgdJ0hnYQ4j
 bQdEiseZyuPyeBU+f6cyNeD/nct4CehJWFwK+WwPc8C96tUIpVSJWwsiOf6NWvda
 KgSs1fCInw9e1//qCWWPxojEvTTW/JdmAOHyh9JTEpUezlXrDrRa5bDwng1VkVHM
 SZZ8H30GZmp/r9UH32TAlnxWvnRunE+uQVTyl3EAS6J7M+K+7fx2voBYSrN4dEY=
 =vr8Z
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

* Guest ABI fixes for PC machines (hw_version)
* Fixes for recent Perl
* John Snow's configure fixes
* file-backed RAM improvements (Igor, Pavel)
* -Werror=clobbered fixes (Stefan)
* Kill -d ioport
* Fix qemu-system-s390x
* Performance improvement for kvmclock migration

# gpg: Signature made Thu 05 Nov 2015 13:42:27 GMT using RSA key ID 78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"

* remotes/bonzini/tags/for-upstream:
  iscsi: Translate scsi sense into error code
  Revert "Introduce cpu_clean_all_dirty"
  kvmclock: add a new function to update env->tsc.
  configure: disable FORTIFY_SOURCE under clang
  backends/hostmem-file: Allow to specify full pathname for backing file
  configure: disallow ccache during compile tests
  cpu-exec: Fix compiler warning (-Werror=clobbered)
  memory: call begin, log_start and commit when registering a new listener
  megasas: Use qemu_hw_version() instead of QEMU_VERSION
  osdep: Rename qemu_{get, set}_version() to qemu_{, set_}hw_version()
  pc: Set hw_version on all machine classes
  qemu-log: remove -d ioport
  ioport: do not use CPU_LOG_IOPORT
  target-i386: fix pcmpxstrx equal-ordered (strstr) mode
  scripts/text2pod.pl: Escape left brace
  file_ram_alloc: propagate error to caller instead of terminating QEMU

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-05 14:31:24 +00:00
Fam Zheng e01dd3da5c iscsi: Translate scsi sense into error code
Previously we return -EIO blindly when anything goes wrong. Add a helper
function to parse sense fields and try to make the return code more
meaningful.

This also fixes the default werror configuration (enospc) when we're
using qcow2 on an iscsi lun. The old -EIO not being treated as out of
space error failed to trigger vm stop.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <1446699609-11376-1-git-send-email-famz@redhat.com>
[libiscsi 1.9 compatibility - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-11-05 14:42:19 +01:00
Pavel Dovgalyuk 8b42704441 cpu: replay instructions sequence
This patch adds calls to replay functions into the icount setup block.
In record mode number of executed instructions is written to the log.
In replay mode number of istructions to execute is taken from the replay log.
When replayed instructions counter is expired qemu_notify_event()
function is called to wake up the iothread.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150917162405.8676.31890.stgit@PASHA-ISP.def.inno>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-11-05 12:19:09 +01:00
Pavel Dovgalyuk 56c0269a9e cpu-exec: allow temporary disabling icount
This patch is required for deterministic replay to generate an exception
by trying executing an instruction without changing icount.
It adds new flag to TB for disabling icount while translating it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150917162359.8676.77011.stgit@PASHA-ISP.def.inno>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-11-05 12:19:09 +01:00
Pavel Dovgalyuk 26bc60ac82 replay: introduce icount event
This patch adds icount event to the replay subsystem. This event corresponds
to execution of several instructions and used to synchronize input events
in the replay phase.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150917162354.8676.31351.stgit@PASHA-ISP.def.inno>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-11-05 12:19:09 +01:00
Pavel Dovgalyuk c16861ef1b replay: introduce mutex to protect the replay log
This mutex will protect read/write operations for replay log.
Using mutex is necessary because most of the events consist of
several fields stored in the log. The mutex will help to avoid races.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150917162348.8676.8628.stgit@PASHA-ISP.def.inno>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-11-05 12:19:09 +01:00
Pavel Dovgalyuk c92079f45f replay: internal functions for replay log
This patch adds functions to perform read and write operations
with replay log.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150917162342.8676.29445.stgit@PASHA-ISP.def.inno>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-11-05 12:19:09 +01:00
Pavel Dovgalyuk d73abd6dcc replay: global variables and function stubs
This patch adds global variables, defines, function declarations,
and function stubs for deterministic VM replay used by external modules.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150917162337.8676.41538.stgit@PASHA-ISP.def.inno>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-11-05 12:19:08 +01:00
Peter Maydell 8835b9df3b qemu-ga patch queue
* fix file handle cleanup on w32
 * use non-blocking mode for file handles on w32 to avoid
   hangs on guest-file-read/guest-file-write to pipes
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJWOl4wAAoJEDNTyc7xCLWEwoEH/3ODu7EZIhUpz471fwFNOKaQ
 2E6DBnbyRKZ07/5bgVRH2Pvb3i+JZ51sqZzbxkV3OqN6tgYeTR32oBLtA4ZRrRo/
 lEwpOUfkc+nLlqQNc7RittQVGIE5DHs/O4PUQWe5+H3TvkezAZZep+HcBLlE1ECZ
 0HXg5fudO6LNJS2zRAw9bELEGYsixYu4+AfmsC6GamrWaU2pIFNE9wlKmRKCQh1N
 D0uJBk1JtjWOsU3hpTDYkr/fFSvn6e1euaE8JYyAU+pj5VLnsU7Sb1t5ERkONswF
 D/JfXG53r045cIiF2mCXPTWFScbp5kxRcyyRiX+LsAFTj2sZ84VLE6yFShYgnfA=
 =+vjx
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2015-11-04-tag' into staging

qemu-ga patch queue

* fix file handle cleanup on w32
* use non-blocking mode for file handles on w32 to avoid
  hangs on guest-file-read/guest-file-write to pipes

# gpg: Signature made Wed 04 Nov 2015 19:36:16 GMT using RSA key ID F108B584
# gpg: Good signature from "Michael Roth <flukshun@gmail.com>"
# gpg:                 aka "Michael Roth <mdroth@utexas.edu>"
# gpg:                 aka "Michael Roth <mdroth@linux.vnet.ibm.com>"

* remotes/mdroth/tags/qga-pull-2015-11-04-tag:
  qga: set file descriptor in qmp_guest_file_open non-blocking on Win32
  qga: fixed CloseHandle in qmp_guest_file_open
  qga: drop hand-made guest_file_toggle_flags helper

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-05 10:52:35 +00:00
Liang Li 6388acc853 Revert "Introduce cpu_clean_all_dirty"
This reverts commit de9d61e83d.

Now 'cpu_clean_all_dirty' is useless, we can revert the related code.

Conflicts:
	include/sysemu/kvm.h

Signed-off-by: Liang Li <liang.z.li@intel.com>
Message-Id: <1446695464-27116-3-git-send-email-liang.z.li@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-11-05 11:28:23 +01:00
Liang Li 0fd7e098db kvmclock: add a new function to update env->tsc.
The commit 317b0a6d8 fixed an issue which caused by the outdated
env->tsc value, but the fix lead to 'cpu_synchronize_all_states()'
called twice during live migration. The 'cpu_synchronize_all_states()'
takes about 130us for a VM which has 4 vcpus, it's a bit expensive.

Synchronize the whole CPU context just for updating env->tsc is too
wasting, this patch use a new function to update the env->tsc.
Comparing to 'cpu_synchronize_all_states()', it only takes about 20us.

Signed-off-by: Liang Li <liang.z.li@intel.com>
Message-Id: <1446695464-27116-2-git-send-email-liang.z.li@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-11-05 11:28:10 +01:00
John Snow b553a04280 configure: disable FORTIFY_SOURCE under clang
Some versions of clang may have difficulty compiling glibc headers when
-D_FORTIFY_SOURCE is used. For example, Clang++ 3.5.0-9.fc22 cannot
compile glibc's stdio headers when -D_FORTIFY_SOURCE=2 is used. This
manifests currently as build failures with clang and any arm target.

According to LLVM dev Richard Smith, clang does not target or support
FORTIFY_SOURCE + glibc, and it should not be relied on.
"It's still an unsupported combination, and while it might compile, some
of the checks are unlikely to work because they require a frontend
inliner to be useful"

See: http://lists.llvm.org/pipermail/cfe-dev/2015-November/045846.html

Conclusion: disable fortify-source if we appear to be using clang instead
of testing for compile success or failure, which may be incidental or not
indicative of proper support of the feature.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <1446583422-10153-1-git-send-email-jsnow@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-11-05 11:28:02 +01:00
Peter Maydell 6c5f30cad2 migration/next for 20151104
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJWOf3fAAoJEPSH7xhYctcj5goQAJagmD9MCCVkuXaLVIwBYaMv
 CFca3xTfWjhkbucirF1X2cmhAbAlzzTDj/NxDyjIaIepBs1k4nrW6rfvAeZ0H5wM
 mLAzb041rnlpibg2p5976nir+9rh0N8y2DvLQfA7daCtc557SJMzG5v1lADVLTuu
 1gNI93jFQ2i+Mmm78RPRizCOBKSmspMnvoEMJ2SaI8UKbBNTUYnPyROswdO/qyOL
 YrEHFAFp1k6XswGkDr9Tzi2RcfdjdbFjLlWOVm0nTWS9ZuB06LPZr19GffE8gNmu
 Hqsj09Ou18uZOzgyiqzarhVIdLJJhFPlBNV454cA2vA7jvwdoJbdmxR//0dUs2Bn
 59lFqJzN1Z0VElY2WtNSXkNg6oTROfXCQFCEOfESzlu+FGXEO2AuvppUQJJq2cK8
 xN3XoJifZzGKK1FNryBPrzr/7x/B3L8Q2KoAKdvvlrGw/7m8Kf5eZI3J4YU9BdV5
 KuTcNz7MLoVS2fYX4Z3pos3XRb1rtIJS6XavmwkXQhy8uJUiW0XQBCLTWI9Ymg1d
 sYny4gO2vEk0p1N/KfP/irv1cpBJFGk3lisX99QvUvOKTsJ6s7zxOkifRrBJku58
 kRSu/+xuquEDUsjI9u0UC4Vx1ybT/Y9oMcAVztoyHwjH6BrVTIg11yqKS5dl7q1Q
 upIf7kxSP6FHdh+sOPGF
 =eOCY
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20151104' into staging

migration/next for 20151104

# gpg: Signature made Wed 04 Nov 2015 12:45:19 GMT using RSA key ID 5872D723
# gpg: Good signature from "Juan Quintela <quintela@redhat.com>"
# gpg:                 aka "Juan Quintela <quintela@trasno.org>"

* remotes/juanquintela/tags/migration/20151104:
  migration: fix analyze-migration.py script
  migration: code clean up
  migration: rename cancel to cleanup in SaveVMHandles
  migration: rename qemu_savevm_state_cancel
  migration: defer migration_end & blk_mig_cleanup

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-05 10:10:57 +00:00
Peter Maydell 2b5a79f1d9 vl.c: Error message rework
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWOHMSAAoJEDhwtADrkYZTF3sQALtMGAB2Iz7+BG0HEUKdIFYO
 l0Yg4F7v8BEFtv2yDRw55yiORk8/G5QQufSE1PNtWJFinD9InivTyScMkR3UF/6I
 YNFCLksilCIJEd+YxjDc+XXEmnkqxy5uslB+7jz70RHkmkhWXGfj+Jl0dlA6X7NA
 v8ugw01tDGWZen8I1SU/S8qAtGkk75+Id48TNLWR5JqjKD8yvk8L0xgdCgjmNW7F
 ms19zNOiIX5JQa9VU3CVMUvXVTkmGEWUhKYdSVHVJU6A2zmwPeN05EgYq9P/OX3P
 S81g5hgKSamuD2ddMPpTNm+F4OsZwPIliXSn7eUz2eUNIs4qA+yv2B5SzoiCIJzz
 Zpf91xavzg3fSONqjhW8Erkq0rZsMrzoKcPQO0uwjRr7Y9Frll91wogtg44pOC3Z
 HxhKhXEz3/K5GYkpudbBN7Dk3zzQFlSEosgJa0PyC37mJ90Bh72PMqR4L8IJR1jn
 V08ElsC6CKnr9xGtO7t+RfSEeLzlilK0XGsfAvlXmYhIwyACjetgKaTAsHRgLzTD
 Yc2dEVtjC5vIe3pdX4QS2L0qQ6VJ7MMPWAfGSgn1pVhQlkvn2bOr5EppfjQBhiPd
 MkJlLgXLA+VtFO8UovnZpPNO7m4xS64UQqlenkRVQ4Ul2vL0A09uXmxZQwfKNFSJ
 OeXgTnloxHQZBjARXM6z
 =FYSa
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2015-11-03' into staging

vl.c: Error message rework

# gpg: Signature made Tue 03 Nov 2015 08:40:50 GMT using RSA key ID EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"

* remotes/armbru/tags/pull-error-2015-11-03:
  vl.c: Use "%s support is disabled" error messages consistently
  vl.c: Improve warnings on use of deprecated options
  vl.c: Touch up error messages
  vl.c: Remove unnecessary uppercase in error messages
  vl.c: Use "warning:" prefix consistently on warnings
  vl.c: Remove periods and exclamation points from error messages
  vl.c: Replace fprintf(stderr) with error_report()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-04 18:20:31 +00:00
Pavel Fedin 8d31d6b65a backends/hostmem-file: Allow to specify full pathname for backing file
This allows to explicitly specify file name to use with the backend. This
is important when using it together with ivshmem in order to make it backed
by hugetlbfs. By default filename is autogenerated using mkstemp(), and the
file is unlink()ed after creation, effectively making it anonymous. This is
not very useful with ivshmem because it ends up in a memory which cannot be
accessed by something else.

Distinction between directory and file name is done by stat() check. If an
existing directory is given, the code keeps old behavior. Otherwise it
creates or opens a file with the given pathname.

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Tested-by: Igor Skalkin <i.skalkin@samsung.com>
Message-Id: <004301d11166$9672fe30$c358fa90$@samsung.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-11-04 15:56:05 +01:00
John Snow 5e4dfd3d4e configure: disallow ccache during compile tests
If the user is using ccache during the configuration step,
it may interfere with some of the configuration tests,
particularly the "Is ccache interfering with macro analysis" step,
which is a bit of a poetic problem.

1) Disallow ccache from reading from the cache during configure,
   but don't disable it entirely to allow us to see if it causes other
   problems.

2) Force off CCACHE_CPP2 during the ccache test to get a deterministic
   answer over whether or not we need to enable that feature later.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <1446055000-29150-1-git-send-email-jsnow@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-11-04 15:56:04 +01:00
Stefan Weil 0448f5f8b8 cpu-exec: Fix compiler warning (-Werror=clobbered)
Reloading of local variables after sigsetjmp is only needed for some
buggy compilers.

The code which should reload these variables causes compiler warnings
with gcc 4.7 when compiler optimizations are enabled:

cpu-exec.c:204:15: error:
 variable ‘cpu’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
cpu-exec.c:207:15: error:
 variable ‘cc’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
cpu-exec.c:202:28: error:
 argument ‘env’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]

Now this code is only used for compilers which need it
(and gcc 4.5.x, x > 0 which does not need it but won't give warnings).

There were bug reports for clang and gcc 4.5.0, while gcc 4.5.1
was reported to work fine without the reload code. For clang it
is not clear which versions are affected, so simply keep the status quo
for all clang compilations. This can be improved later.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Message-Id: <1443266606-21400-1-git-send-email-sw@weilnetz.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-11-04 15:56:04 +01:00
Paolo Bonzini 680a4783dc memory: call begin, log_start and commit when registering a new listener
This ensures that cpu_reload_memory_map() is called as soon as
tcg_cpu_address_space_init() is called, and before cpu->memory_dispatch
is used.  qemu-system-s390x never changes the address spaces after
tcg_cpu_address_space_init() is called, and thus tcg_commit() is never
called.  This causes a SIGSEGV.

Because memory_map_init() will now call mem_commit(), we have to
initialize io_mem_* before address_space_memory and friends.

Reported-by: Philipp Kern <pkern@debian.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Fixes: 0a1c71cec6
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-11-04 15:56:01 +01:00
Eduardo Habkost 69fbd0ea25 megasas: Use qemu_hw_version() instead of QEMU_VERSION
Guest visible data shouldn't change with a simple QEMU upgrade, so use
qemu_hw_version() to ensure it won't change (as long as the machine
class being used has hw_version set).

Cc: Hannes Reinecke <hare@suse.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-block@nongnu.org
Reviewed-by: Hannes Reinecke <hare@suse.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <1446233769-7892-4-git-send-email-ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-11-04 15:02:31 +01:00
Eduardo Habkost 35c2c8dc8c osdep: Rename qemu_{get, set}_version() to qemu_{, set_}hw_version()
This makes the purpose of the function clearer: it is not about the
version of QEMU that's running, but the version string exposed in the
emulated hardware.

Cc: Andrzej Zaborowski <balrogg@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: John Snow <jsnow@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <1446233769-7892-3-git-send-email-ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-11-04 15:02:31 +01:00
Eduardo Habkost de796d93f5 pc: Set hw_version on all machine classes
In 2012, QEMU had a bug where it exposed QEMU version information to the
guest, meaning a QEMU upgrade would expose different hardware to the
guest OS even if the same machine-type is being used.

The bug was fixed by commit 93bfef4c6e, on
all machines up to pc-1.0. But we kept introducing the same bug on all
newer machines since then. That means we are breaking guest ABI every
time QEMU was upgraded.

Fix this by setting the hw_version on all PC machines, making sure the
hardware won't change when upgrading QEMU.

Note that QEMU_VERSION was "1.0" in QEMU 1.0, but starting on QEMU
1.1.0, it started following the "x.y.0" pattern. We have to follow it,
to make sure we use the right QEMU_VERSION string from each QEMU
release.

The 2.5 machine classes could have hw_version unset, because the default
value for qemu_get_version() is QEMU_VERSION. But I decided to set it
explicitly to QEMU_VERSION so we don't forget to update it to "2.5.0"
after we release 2.5.0 and create a 2.6 machine class.

Reported-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <1446233769-7892-2-git-send-email-ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-11-04 15:02:30 +01:00
Paolo Bonzini ddcc8e9d51 qemu-log: remove -d ioport
It was disabled at compile-time, and is now replaced by tracepoints.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-11-04 15:02:30 +01:00
Paolo Bonzini 6f94b7d97f ioport: do not use CPU_LOG_IOPORT
These messages are disabled by default; a perfect usecase for tracepoints,
which in fact already exist.  Add the missing information to them and
stop using qemu_log_mask.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-11-04 15:02:30 +01:00
Paolo Bonzini 54c54f8b56 target-i386: fix pcmpxstrx equal-ordered (strstr) mode
In this mode, referring an invalid element of the source forces the
result to false (table 4-7, last column) but referring an invalid
element of the destination forces the result to true, so the outer
loop should still be run even if some elements of the destination
will be invalid.  They will be avoided in the inner loop, which
correctly bounds "i" to validd, but they will still contribute to a
positive outcome of the search.

This fixes tst_strstr in glibc 2.17.

Reported-by: Florian Weimer <fweimer@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-11-04 15:02:30 +01:00
Olga Krishtal fb68777312 qga: set file descriptor in qmp_guest_file_open non-blocking on Win32
Set fd non-blocking to avoid common use cases (like reading from a
named pipe) from hanging the agent. This was missed in the original
code.

The patch introduces qemu_set_handle_nonoblocking, the local analog
of qemu_set_nonblock for HANDLES.
The usage of handles in qemu_set_non/block is impossible, because for
win32 there is a difference between file discriptors and file handles,
and all file ops are made via Win32 api.

Signed-off-by: Olga Krishtal <okrishtal@parallels.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Michael Roth <mdroth@linux.vnet.ibm.com>
CC: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-11-04 07:37:56 -06:00
Olga Krishtal c87d0964ef qga: fixed CloseHandle in qmp_guest_file_open
CloseHandle use HANDLE as an argument, but not *HANDLE

Signed-off-by: Olga Krishtal <okrishtal@parallels.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
CC: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-11-04 07:37:56 -06:00
Denis V. Lunev 125053965b qga: drop hand-made guest_file_toggle_flags helper
We'd better use generic qemu_set_nonblock directly.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Yuri Pudgorodskiy <yur@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
CC: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-11-04 07:37:56 -06:00