Commit Graph

42708 Commits

Author SHA1 Message Date
Pavel Fedin a3567ba1e6 hostmem: Ignore ENOSYS while setting MPOL_DEFAULT
Currently hostmem backend fails if CONFIG_NUMA is enabled in QEMU
(the default) but NUMA is not supported by the kernel. This makes
it impossible to use ivshmem in such configurations.

This patch fixes the problem by ignoring ENOSYS error if policy is set to
MPOL_DEFAULT. This way the code behaves in the same way as if CONFIG_NUMA
was not defined. qemu will still fail if the user specifies some other
policy, so that the user knows it.

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2015-11-23 10:43:38 -02:00
John Clarke 644da9b39e tcg: Fix highwater check
A simple typo in the variable to use when comparing vs the highwater mark.
Reports are that qemu can in fact segfault occasionally due to this mistake.

Signed-off-by: John Clarke <johnc@kirriwa.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
2015-11-23 13:16:05 +01:00
Peter Maydell 541abd10a0 Update version for v2.5.0-rc1 release
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-20 17:43:46 +00:00
Peter Lieven f348daf3d5 tests: fix cdrom_pio_impl in ide-test
The check for the cleared BSY flag has to be performed
before each data transfer and not just before the
first one.

Commit 5f81724d revealed this glitch as the BSY flag
was not set in ATAPI PIO transfers before.

While at it fix the descriptions and add a comment before
the nested for loop that transfers the data.

Signed-off-by: Peter Lieven <pl@kamp.de>
Message-id: 1448029742-19771-1-git-send-email-pl@kamp.de
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-20 17:37:06 +00:00
Peter Maydell 28c3e6ee72 QOM infrastructure fixes and device conversions
* Fix for properties on objects > 4 GiB
 * Performance improvements for QOM property handling
 * Assertion cleanups
 * MAINTAINERS additions
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJWTd1wAAoJEPou0S0+fgE/v4oQAKdUcb8kDg8cb1rfjNHOGSxh
 GLrBnpCE22ePtugMJqyGRE/bM2cMrXk/NLMGy1hXeNt+46zl6eUadZSV4UCjrq8q
 I9S5/DuGpwc7NT5zw5/ZTx7b9rzCjwpvyq17Ljwme5QbKZvC86OiaZ5OjD7HZdYO
 wY1vXuDoJXuj0r8hp6uS/mkfXx7R6O3bsmnOaz1yxSZqs0gi1r9En6Y/aoOCgz1V
 bc09iWIAer0U71E9C+kinWwqBBx/PjhrkKxBGMmFEtf3O7Kd8irXpZPoafpRkgsJ
 mvvUaiHFapJaXjjsSlknRfdspXdhwrrYhoCPso8vwEDEWMB03th2eBcau2rsfFXj
 nHPAGwjxKETSQHD+/EbtCL+y94IkSbkdf1qF+TWnCiAHIF/yvoMbjRy5+7I/bsbC
 Mp+qzjP+09E/qSclbeBH/EA/4ukjF2UbDGDh17/019aEpDVt016PKjoRhAWgbOJR
 QKumj8y7+UQMvKo1jkqcOVf7pFTkKXeAsVvWjtA089X9iEczJQo6lrTxmtvLZ7K6
 PehJPZFlm7hLTEykq+xZmgQAGrhx2MdQbbEgEDM5flGPRViypmihgRzFWIAT6rBY
 WBEFRohRuHwTARDcmyP9MWeR5/hAlH3kD3O0qCYNbCZgQroXBW6bHQ913rerfwXh
 uatso/iKOJ6YOlc7scPU
 =/IfF
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' into staging

QOM infrastructure fixes and device conversions

* Fix for properties on objects > 4 GiB
* Performance improvements for QOM property handling
* Assertion cleanups
* MAINTAINERS additions

# gpg: Signature made Thu 19 Nov 2015 14:32:16 GMT using RSA key ID 3E7E013F
# gpg: Good signature from "Andreas Färber <afaerber@suse.de>"
# gpg:                 aka "Andreas Färber <afaerber@suse.com>"

* remotes/afaerber/tags/qom-devices-for-peter:
  MAINTAINERS: Add check-qom-{interface,proplist} to QOM
  qom: Clean up assertions to display values on failure
  qom: Replace object property list with GHashTable
  qom: Add a test case for complex property finalization
  net: Convert net filter code to use object property iterators
  ppc: Convert spapr code to use object property iterators
  vl: Convert machine help code to use object property iterators
  qmp: Convert QMP code to use object property iterators
  qom: Introduce ObjectPropertyIterator struct for iteration
  qdev: Change Property::offset field to ptrdiff_t type

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-19 17:54:46 +00:00
Peter Maydell 348c32709f vhost, pc: fixes for 2.5
Fixes all over the place.
 
 This also re-enables a test we disabled in 2.5 cycle
 now that there's a way not to get a warning from it.
 
 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJWTc5PAAoJECgfDbjSjVRpCJEH/jh1CeWCG7zRBXelWK2F5Cgr
 ls+V1sCX7NvkfCa3cDZI8imGjYQUr6EiXtqxPArEVMjmUOUzEHPkOx3ICPpfMU7o
 RCVNPELav6VBhGDf3mcIVjlDDN9Syhd90xdgaD8dbeSA0UJFHRTdobNlYpYwiRmp
 OAASUawEWLGA5cG+W6MBFWiPQWChpNRK3yK3RVduL71TIe4heuHBez4qTB2QKYvF
 KM2nRvpkBY21frXJQqWPlCJ6jsdjI/Fl2xR1t4C9qv0TKcB9FESMmH3Jff2bwMQM
 8OSnTIRqYaqT6kJkk3Kns8a+porJMnn69OwBRehLmLW/rmx9HQrR2Ey7bYtgd0Y=
 =CrrY
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

vhost, pc: fixes for 2.5

Fixes all over the place.

This also re-enables a test we disabled in 2.5 cycle
now that there's a way not to get a warning from it.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

# gpg: Signature made Thu 19 Nov 2015 13:27:43 GMT using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"

* remotes/mst/tags/for_upstream:
  exec: silence hugetlbfs warning under qtest
  tests: re-enable vhost-user-test
  acpi: fix buffer overrun on migration
  vhost-user: fix log size
  vhost-user: ignore qemu-only features
  specs/vhost-user: fix spec to match reality
  tests/vhost-user-bridge: implement logging of dirty pages
  i440fx: print an error message if user tries to enable iommu
  q35: Check propery to determine if iommu is set
  vhost-user: start/stop all rings
  vhost-user: print original request on error
  vhost-user-test: support VHOST_USER_SET_VRING_ENABLE
  vhost-user: update spec description
  vhost: don't send RESET_OWNER at stop
  vhost: let SET_VRING_ENABLE message depends on protocol feature

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-19 16:26:08 +00:00
Peter Maydell c601a244a4 target-arm queue:
* add missing condexec updates when emulating architectural breakpoints
    and coprocessor access checks in Thumb translation (could in theory
    cause problems when these happened inside a Thumb IT block and an
    exception was taken)
  * arm_gic: correctly restore nested IRQ priority
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJWTc7BAAoJEDwlJe0UNgzeiMQP/idTURZycJQcn4TPIOtBKM6b
 t6TfYdrG7fBqwqjyb97V93Zg4zgt54CiW5W00G9Oh5cxmglZISWI+Jq8MvJL3BWw
 dEJk1lXbL67XIqIW/bOSIpZkVpYUxzZXipZ0J/WKPE+hXKGCRIshntTpwRbg4NMB
 JARHQ83TOXqMGft6AwsgzKadHiPSgqhqIJ1A+wMB4guzIha0ttrcKli7+psy5K/C
 nQlKf+7GJZHOkoK7BM8QsH/Qf1oyTr+16miAOiHvZmg9hnGDIZ7J8tpV5fR3Un9Q
 uWgwBzZyUzIYE7pnlkc6aVDPRv0ALoykaIJmfLcAmpHej6AnSNiJ2/tBFQWQ25U5
 ekPfi46aRwq1mPDUxoat3itWbrMMa2Cph5b4EOpSb59X38DaDgVIBRHM0G8MywGr
 BCmzwe9UYBxeRfwpBToHBqokI26oCb8GvYONyJ3KtORmPgKQ9RJUw7dnMhSf5eWR
 CXaI1+ArF7gVoBszNYEgo3iavg9xIWNG1PxFcCPvzLP4pMXGUDcxeXrENRiRJaBr
 yUzjBl+Elo0f2QuEYaECQrEFJW672vleFmjz14AW/mcajxd/5a6x+RQk+82oog5o
 tnUY54nlb02h0nV5qLEnR7wzaIVr4GcY5QZNNJN0k2/drdZyivHlXCUbSSaD54+K
 anJFjhBYYKAM0A9wDE7h
 =nAO5
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20151119' into staging

target-arm queue:
 * add missing condexec updates when emulating architectural breakpoints
   and coprocessor access checks in Thumb translation (could in theory
   cause problems when these happened inside a Thumb IT block and an
   exception was taken)
 * arm_gic: correctly restore nested IRQ priority

# gpg: Signature made Thu 19 Nov 2015 13:29:37 GMT using RSA key ID 14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>"
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>"

* remotes/pmaydell/tags/pull-target-arm-20151119:
  target-arm: Update condexec before arch BP check in AA32 translation
  target-arm: Update condexec before CP access check in AA32 translation
  hw/arm_gic: Correctly restore nested irq priority

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-19 15:56:51 +00:00
Peter Maydell 80fda8f609 migration/next for 20151119
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJWTa+zAAoJEPSH7xhYctcjImIQAM3Jzy8BikDV7DnQeOjzkd6l
 UCqVH5CPegUwiQvwx8qjVzc/xANg79zzLUwc3wxjC6v725dLHuVNZk7PyNNWl3jQ
 fHEvtgA0m2a4kSpJ4VcHgh/Rs93qKMvxc/hmjUn2R5JftfLj6zHLQOrjNncXmURc
 BmRY8lBOFe12nizTyK4yFMesC7Zfru9XYA/NRduX1TUYxaSHz3s/yUw+hTfv6+Po
 HYYOa/5yhFDCtik3475FDwQiRcCRdXqniMFT8E3Med0qgGrUcy9+8uODxw7O4F40
 AV25b7kyE3BdOoCBSL6cKGhpwfwgvuAYvV6Dcf6pXt/LMEWL6s6+Xcv8LPRkTFTV
 O8uXXcH8LY9WSHw5SyBOZSO1Ecv+tQ7eJxv6MyzMcbHU46C0zByq5uiWEWdaHBor
 u4msuJYaqT0YKn6Oni2FHtzMsiqBBxr+QyvpR9GXKDAOXDNEMa81s8KHp9Wt9r7M
 FUePhEs7rfTSnwh1ib0QAkNZDHUDrRmh3gF1O01RnkFTw02nrhsMBopRZwNO0roX
 j50BlocQNJf897lXS39QWicYXPaybEunZqchAfQ1tMIB7xptCQmMTDIlJbd5RlQm
 B7UEVd5alyBqwtdzuAqH9RmRou0+3qUR43pduJzA6wNGcp7PTwtlWx87oDFfhS6u
 f/7Rvf8ZWpRUNFBZuyzk
 =Xyfj
 -----END PGP SIGNATURE-----

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

migration/next for 20151119

# gpg: Signature made Thu 19 Nov 2015 11:17:07 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/20151119:
  migration: normalize locking in migration/savevm.c
  migration: implement bdrv_all_find_vmstate_bs helper
  migration: reorder processing in hmp_savevm
  snapshot: create bdrv_all_create_snapshot helper
  migration: drop find_vmstate_bs check in hmp_delvm
  snapshot: create bdrv_all_find_snapshot helper
  migration: factor our snapshottability check in load_vmstate
  snapshot: create bdrv_all_goto_snapshot helper
  snapshot: create bdrv_all_delete_snapshot helper
  snapshot: return error code from bdrv_snapshot_delete_by_id_or_name
  snapshot: create helper to test that block drivers supports snapshots
  Unneeded NULL check
  migration: Dead assignment of current_time
  Set last_sent_block

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-19 15:05:06 +00:00
Andreas Färber 9f4aa7cef2 MAINTAINERS: Add check-qom-{interface,proplist} to QOM
Add the QOM unit tests to the QOM maintenance area so that maintainers
get CC'ed on changes and to document QOM test coverage.

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2015-11-19 15:15:40 +01:00
Andreas Färber 8438a13543 qom: Clean up assertions to display values on failure
Instead of using g_assert() for integer comparisons, use
g_assert_cmpint() so that we can see the respective values.

While at it, fix one stray indentation.

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2015-11-19 15:15:33 +01:00
Pavel Fedin b604a854e8 qom: Replace object property list with GHashTable
ARM GICv3 systems with large number of CPUs create lots of IRQ pins. Since
every pin is represented as a property, number of these properties becomes
very large. Every property add first makes sure there's no duplicates.
Traversing the list becomes very slow, therefore QEMU initialization takes
significant time (several seconds for e. g. 16 CPUs).

This patch replaces list with GHashTable, making lookup very fast. The only
drawback is that object_child_foreach() and object_child_foreach_recursive()
cannot add or remove properties during traversal, since GHashTableIter does
not have modify-safe version. However, the code seems not to modify objects
via these functions.

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Tested-by: Pavel Fedin <p.fedin@samsung.com>
[AF: Fixed object_property_del_{all,child}() issues;
     g_hash_table_contains() -> g_hash_table_lookup(), suggested by Daniel]
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2015-11-19 15:00:15 +01:00
Marc-André Lureau 1c7ba94a18 exec: silence hugetlbfs warning under qtest
vhost-user-test prints a warning. A test should not need to run on
hugetlbfs, let's silence the warning under qtest. The
condition can't check on qtest_enabled() since vhost-user-test actually
doesn't use qtest accel. However, qtest_driver() can be used, if
qtest_init() is called early enough. For that reason, move chardev and
qtest initialization early.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-11-19 15:26:05 +02:00
Marc-André Lureau 421f4448ce tests: re-enable vhost-user-test
Commit 7fe34ca9c2 actually disabled vhost-user-test altogether,
since CONFIG_VHOST_NET is a per-target config variable.

tests/vhost-user-test is already x86/x64 softmmu specific test, in order
to enable it correctly, kvm & vhost-net are also conditions. To check
that, set CONFIG_VHOST_NET_TEST_$target when kvm is also enabled.

Since "check-qtest-x86_64-y = $(check-qtest-i386-y)", avoid duplication
when both x86 & x64 are enabled.

Other targets than x86 aren't enabled yet, and is intentionally left as
a future improvement, since I can't easily test those.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-11-19 15:26:05 +02:00
Michael S. Tsirkin d9a3b33d2c acpi: fix buffer overrun on migration
ich calls acpi_gpe_init with length ICH9_PMIO_GPE0_LEN so
ICH9_PMIO_GPE0_LEN/2 bytes are allocated, but then the full
ICH9_PMIO_GPE0_LEN bytes are migrated.

As a quick work-around, allocate twice the memory.
We'll probably want to tweak code to avoid
migrating the extra ICH9_PMIO_GPE0_LEN/2 bytes,
but that is a bit trickier to do without breaking
migration compatibility.

Tested-by: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Reported-by: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-11-19 15:26:00 +02:00
Sergey Fedorov ce8a1b5449 target-arm: Update condexec before arch BP check in AA32 translation
Architectural breakpoint check could raise an exceptions, thus condexec
bits should be updated before calling gen_helper_check_breakpoints().

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Message-id: 1447767527-21268-3-git-send-email-serge.fdrv@gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-19 12:51:08 +00:00
Sergey Fedorov 43bfa4a100 target-arm: Update condexec before CP access check in AA32 translation
Coprocessor access instructions are allowed inside IT block.
gen_helper_access_check_cp_reg() can raise an exceptions thus condexec
bits should be updated before.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Message-id: 1447767527-21268-2-git-send-email-serge.fdrv@gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-19 12:11:42 +00:00
François Baldassari a859595791 hw/arm_gic: Correctly restore nested irq priority
Upon activating an interrupt, set the corresponding priority bit in the
APR/NSAPR registers without touching the currently set bits. In the event
of nested interrupts, the GIC will then have the information it needs to
restore the priority of the pre-empted interrupt once the higher priority
interrupt finishes execution.

Signed-off-by: François Baldassari <francois@pebble.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-19 12:09:52 +00:00
Denis V. Lunev 79b3c12ac5 migration: normalize locking in migration/savevm.c
basically all bdrv_* operations must be called under aio_context_acquire
except ones with bdrv_all prefix.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
CC: Juan Quintela <quintela@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
2015-11-19 11:50:00 +01:00
Denis V. Lunev 7cb1448149 migration: implement bdrv_all_find_vmstate_bs helper
The patch also ensures proper locking for the operation.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
2015-11-19 11:50:00 +01:00
Denis V. Lunev 0b46160521 migration: reorder processing in hmp_savevm
State deletion can be performed on running VM which reduces VM downtime
This approach looks a bit more natural.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
2015-11-19 11:50:00 +01:00
Denis V. Lunev a9085f9b55 snapshot: create bdrv_all_create_snapshot helper
to create snapshot for all loaded block drivers.

The patch also ensures proper locking.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
2015-11-19 11:50:00 +01:00
Denis V. Lunev c6258b04f1 migration: drop find_vmstate_bs check in hmp_delvm
There is no much sense to do the check and write warning.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
2015-11-19 11:50:00 +01:00
Denis V. Lunev 723ccda1a0 snapshot: create bdrv_all_find_snapshot helper
to check that snapshot is available for all loaded block drivers.
The check bs != bs1 in hmp_info_snapshots is an optimization. The check
for availability of this snapshot will return always true as the list
of snapshots was collected from that image.

The patch also ensures proper locking.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
CC: Stefan Hajnoczi <stefanha@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
2015-11-19 11:50:00 +01:00
Denis V. Lunev 849f96e2f7 migration: factor our snapshottability check in load_vmstate
We should check that all inserted and not read-only images support
snapshotting. This could be made using already invented helper
bdrv_all_can_snapshot().

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
CC: Stefan Hajnoczi <stefanha@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
2015-11-19 11:50:00 +01:00
Denis V. Lunev 4c1cdbaad0 snapshot: create bdrv_all_goto_snapshot helper
to switch to snapshot on all loaded block drivers.

The patch also ensures proper locking.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
2015-11-19 11:50:00 +01:00
Denis V. Lunev 9b00ea376d snapshot: create bdrv_all_delete_snapshot helper
to delete snapshots from all loaded block drivers.

The patch also ensures proper locking.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
2015-11-19 11:50:00 +01:00
Denis V. Lunev 25af925fff snapshot: return error code from bdrv_snapshot_delete_by_id_or_name
this will make code better in the next patch

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
2015-11-19 11:50:00 +01:00
Denis V. Lunev e9ff957ac2 snapshot: create helper to test that block drivers supports snapshots
The patch enforces proper locking for this operation.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
2015-11-19 11:50:00 +01:00
Dr. David Alan Gilbert 5df5416e63 Unneeded NULL check
The check is unneccesary, we read the value at the start of the
thread, use it, and never change it.  The value is checked to be
non-NULL before thread creation.

Spotted by coverity, CID 1339211

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
2015-11-19 11:49:53 +01:00
Dr. David Alan Gilbert 95a7788b2f migration: Dead assignment of current_time
I set current_time before the postcopy test but never use it;
(I think this was from the original version where it was time based).
Spotted by coverity, CID 1339208

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
2015-11-19 11:49:53 +01:00
Dr. David Alan Gilbert 84e7b80a05 Set last_sent_block
In a82d593b61 I accidentally removed the setting of
last_sent_block,  put it back.

Symptoms:
  Multithreaded compression only uses one thread.
  Migration is a bit less efficient since it won't use 'cont' flags.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Fixes: a82d593b61
Signed-off-by: Juan Quintela <quintela@redhat.com>
2015-11-19 11:49:53 +01:00
Daniel P. Berrange 8c4d156c18 qom: Add a test case for complex property finalization
Devices have some quite complex object child/link relationships
which place some requirements on the object_property_del_all()
function to consider that properties can be modified while
being iterated over.

This extends the QOM property test case to replicate the
device like structure and expose any potential bugs in the
object_property_del_all() function.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2015-11-18 21:13:49 +01:00
Daniel P. Berrange 456fb0bfe0 net: Convert net filter code to use object property iterators
Stop directly accessing the Object::properties field data
structure and instead use the formal object property iterator
APIs. This insulates the code from future data structure
changes in the Object struct.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Tested-by: Pavel Fedin <p.fedin@samsung.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2015-11-18 21:13:49 +01:00
Daniel P. Berrange 9a842f7d3c ppc: Convert spapr code to use object property iterators
Stop directly accessing the Object::properties field data
structure and instead use the formal object property iterator
APIs. This insulates the code from future data structure
changes in the Object struct.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Tested-by: Pavel Fedin <p.fedin@samsung.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2015-11-18 21:13:49 +01:00
Daniel P. Berrange 2465bc564d vl: Convert machine help code to use object property iterators
Stop directly accessing the Object::properties field data
structure and instead use the formal object property iterator
APIs. This insulates the code from future data structure
changes in the Object struct.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Tested-by: Pavel Fedin <p.fedin@samsung.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2015-11-18 21:13:48 +01:00
Daniel P. Berrange 1b30c094dc qmp: Convert QMP code to use object property iterators
Stop directly accessing the Object::properties field data
structure and instead use the formal object property iterator
APIs. This insulates the code from future data structure
changes in the Object struct.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Tested-by: Pavel Fedin <p.fedin@samsung.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2015-11-18 21:13:48 +01:00
Daniel P. Berrange a00c948241 qom: Introduce ObjectPropertyIterator struct for iteration
Some users of QOM need to be able to iterate over properties
defined against an object instance. Currently they are just
directly using the QTAIL macros against the object properties
data structure.

This is bad because it exposes them to changes in the data
structure used to store properties, as well as changes in
functionality such as ability to register properties against
the class.

This provides an ObjectPropertyIterator struct which will
insulate the callers from the particular data structure
used to store properties. It can be used thus

  ObjectProperty *prop;
  ObjectPropertyIterator *iter;

  iter = object_property_iter_init(obj);
  while ((prop = object_property_iter_next(iter))) {
      ... do something with prop ...
  }
  object_property_iter_free(iter);

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Tested-by: Pavel Fedin <p.fedin@samsung.com>
[AF: Fixed examples, style cleanups]
Signed-off-by: Andreas Färber <afaerber@suse.de>
2015-11-18 21:13:38 +01:00
Ildar Isaev 3b6ca4022d qdev: Change Property::offset field to ptrdiff_t type
Property::offset field is calculated as a diff between two pointers:

  arrayprop->prop.offset = eltptr - (void *)dev;

If offset is declared as int, this subtraction can cause type overflow,
thus leading to failure of the subsequent assertion:

  assert(qdev_get_prop_ptr(dev, &arrayprop->prop) == eltptr);

So ptrdiff_t should be used instead.

Signed-off-by: Ildar Isaev <ild@inbox.ru>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2015-11-18 21:11:55 +01:00
Peter Maydell 8f28030903 Block layer patches
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJWTJkgAAoJEH8JsnLIjy/Ws8sP/0eeTsbuaYcMbyh5/G7ORqAk
 l1IjEgpKs2d9+QwZACPOcb72m2S5mhXxEQ1LvMK3qNd+GhlTgDTD9Kxiyiqw3m+D
 5EBA/wcIJUyZFgTJmWfpURmHaw1JUAUGcli6ag1HxA7lKcUG+qgl7b2EE73UwfJ8
 zyCYT8PBUm4mUFua77LTNxwCjiU+lG1r0b8BzeOgaxwj4UaUgmZiq5X6t2luznBH
 H1NEmiRi0TUZbIeQaUCrgdqHFMoPmkXIWPdXMWHVEeiB/Q2eBsX2jrR4STseW39d
 FDrjTil3+1CoLuTW1dwHbEdvqcJN9GFc2bf+vLR797WURiENUvpIP8X1ijNtnMym
 Tv1DwuW4Vd8/MPwDIrswWF0iTPLGCfLLc6xBzUKecMxInS7JiyfrYgN1uVpI55Vw
 LdLzX2UtsCExsehZL+DnMG9p5XuEtvmodE2pkQ/nznwMIhvKUm2l3voPch8CeuSI
 SJ/RFgDwED3zPDcl55brS3TdkJfLUCbjeUEObEh6L9qtEtAXbwNh2BIMXk1ZodRT
 9CvMxZN4fr4g1a9SVVtf1yyrhptPZ3U1v2gyESbQLO192etqyo/g1OPFGze/NyFn
 uX4kOfarwl8LyWMh59nYt7WEhRPvkXEmIcT2Z6hJUQI8v6ghm9rjy5sL6JONa+uO
 44YdbaFXZqDoARv8Qu6H
 =4VZP
 -----END PGP SIGNATURE-----

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

Block layer patches

# gpg: Signature made Wed 18 Nov 2015 15:28:32 GMT using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"

* remotes/kevin/tags/for-upstream:
  block: Call external_snapshot_clean after blockdev-snapshot
  blockdev: Add missing bdrv_unref() in drive-backup
  iotests: fix race in 030
  nand: fix address overflow

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-18 17:07:24 +00:00
Michael S. Tsirkin 48854f57ce vhost-user: fix log size
commit 2b8819c6ee
("vhost-user: modify SET_LOG_BASE to pass mmap size and offset")
passes log size in units of 4 byte chunks instead of the
expected size in bytes.

Fix this up.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-11-18 18:49:27 +02:00
Michael S. Tsirkin 72018d1e19 vhost-user: ignore qemu-only features
Some features (such as ctrl vq) are supported
by qemu without need to communicate with the
backend.

Drop them from the feature mask so we set them
unconditionally.

Reported-by: Victor Kaplansky <vkaplans@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-11-18 18:49:12 +02:00
Peter Maydell 7199c89d8c Pull qcrypto fixes 2015/11/18 v1
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJWTJzHAAoJEL6G67QVEE/fB/AP/0KsXZRVD8oqhT+8lUjuCmUw
 EZvNOn4zG1xiQxmrls2fAoo/AzrjDt0MApxUljvfvI7z3hlmVGKv/i9d3vid15El
 5HmJTubNWEJ7pdFtd678J+3TMnXwageWEFUUEVttGTL59ztCiB7vnjWlLntMypyb
 vOxFgWnkBfp93NK8+5Cs5aCZcuRoCkt2okdcNFthjRNbQwiLaWzj/qWyw6CIycAb
 LNU3qma696392A+jAl3sIk4REXbUkdjp1j1cfuil+O7WJwzZHhXHkuEHttIqZlA/
 2TsevfWEkszF5V9NNQ9ScJHgHBRCdgABQ+GkWlDYgm1T6EN16fdVPYcfzMxd5jpB
 mbP+yvDxV7/eDufAuZcOQpzyyP4z3aC+rwPoPt69lZFwLdnap7HBVLYlOUwY+zHv
 DAret/W32u2iFbIOv7ET4tGh7ynBNIX5mbS9TK4mfQQwbrCXokiypxuymLzXEfOS
 3fit0F/sqaXBmetsr121OEhD0hrWwv8kHsBbcIgyNO5J05wwFwEN6L0zjIyizt/E
 w8aNA9cU8VksgLXrlUb9oZOuLzP+AN6RGHZUFwsY39QPY9aXipyHyKPc/q5oQ2lM
 tUVgfPCvaXNAG1Dh7tfQ8mCzvPkXogGKxAF676XrAto3qmx1eVQeUO1IEAChAEPN
 nXt4N5DeKrCVIqN/ZVGV
 =NS6A
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/berrange/tags/qcrypto-fixes-20151118-1' into staging

Pull qcrypto fixes 2015/11/18 v1

# gpg: Signature made Wed 18 Nov 2015 15:44:07 GMT using RSA key ID 15104FDF
# gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>"
# gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>"

* remotes/berrange/tags/qcrypto-fixes-20151118-1:
  crypto: avoid passing NULL to access() syscall
  crypto: fix leaks in TLS x509 helper functions
  crypto: fix mistaken setting of Error in success code path
  crypto: fix leak of gnutls_dh_params_t data on credential unload

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-18 16:27:15 +00:00
Daniel P. Berrange 08cb175a24 crypto: avoid passing NULL to access() syscall
The qcrypto_tls_creds_x509_sanity_check() checks whether
certs exist by calling access(). It is valid for this
method to be invoked with certfile==NULL though, since
for client credentials the cert is optional. This caused
it to call access(NULL), which happens to be harmless on
current Linux, but should none the less be avoided.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-18 15:42:26 +00:00
Kevin Wolf ca4fa82fe6 One block patch for qemu 2.5-rc1.
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQEcBAABCAAGBQJWTJjDAAoJEDuxQgLoOKytLkwH/3s1eD2BVC57+ytjJRWJ/GpU
 BhX2arGIIHak+CN+O3UpgNcnoyeVGWwM+ClKgCpXd5X1dlFOR1nrhrZVLYPPF6XV
 uMYkMdV8b3Cm1FZzNPnVU9ex4M5MUoypTXC54w4hxL2olIVehS2iodzpOt4JccUT
 vHxZ94IeIet870lTliwRcsNGyxYk4tK8a4y0sKUkc432diA0ENAFKNDcdhFPNXWa
 x/azxb79ZJm09PAwq1ujXb355uxsq2SYa10T3FYWAHaZFeBocewvRKKuj8OsPLUN
 /hbI/DGrpRJfayxCR2uy7v0tXLRd/i4ydZkaxx7Zdag3SXgrMk799axtED9AJNc=
 =7GGL
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'mreitz/tags/pull-block-for-kevin-2015-11-18' into queue-block

One block patch for qemu 2.5-rc1.

# gpg: Signature made Wed Nov 18 16:26:59 2015 CET using RSA key ID E838ACAD
# gpg: Good signature from "Max Reitz <mreitz@redhat.com>"

* mreitz/tags/pull-block-for-kevin-2015-11-18:
  block: Call external_snapshot_clean after blockdev-snapshot

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-11-18 16:27:44 +01:00
Alberto Garcia 4ad6f3db7d block: Call external_snapshot_clean after blockdev-snapshot
Otherwise the AioContext will never be released.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-id: 1447419624-21918-1-git-send-email-berto@igalia.com
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
2015-11-18 16:26:15 +01:00
Max Reitz 0702d3d88c blockdev: Add missing bdrv_unref() in drive-backup
All error paths after a successful bdrv_open() of target_bs should
contain a bdrv_unref(target_bs). This one did not yet, so add it.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-11-18 16:05:56 +01:00
Daniel P. Berrange 7b35030eed crypto: fix leaks in TLS x509 helper functions
The test_tls_get_ipaddr() method forgot to free the returned data
from getaddrinfo().

The test_tls_write_cert_chain() method forgot to free the allocated
buffer holding the certificate data after writing it out to a file.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-18 14:56:58 +00:00
Daniel P. Berrange 6ef8cd7a41 crypto: fix mistaken setting of Error in success code path
The qcrypto_tls_session_check_certificate() method was setting
an Error even when the ACL check suceeded. This didn't affect
the callers detection of errors because they relied on the
function return status, but this did cause a memory leak since
the caller would not free an Error they did not expect to be
set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-18 14:56:58 +00:00
Daniel P. Berrange 61b9251a3a crypto: fix leak of gnutls_dh_params_t data on credential unload
The QCryptoTLSCredsX509 object was not free'ing the allocated
gnutls_dh_params_t data when unloading the credentials

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-18 14:56:58 +00:00
John Snow 01809194a0 iotests: fix race in 030
the stop_test case tests that we can resume a block-stream
command after it has stopped/paused due to error. We cannot
always reliably query it before it finishes after resume, though,
so make this a conditional.

The important thing is that we are still testing that it has stopped,
and that it finishes successfully after we send a resume command.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-11-18 15:54:15 +01:00