migration queue
[Qemu-devel] [PULL 3/7] migration: Stop postcopy fault thread before notifying
In reply to Dr. David Alan Gilbert (git)From: Ilya Maximets <[email protected]>
POSTCOPY_NOTIFY_INBOUND_END handlers will remove userfault fds from the postcopy_remote_fds array which could be still in use by the fault thread. Let's stop the thread before notification to avoid possible accessing wrong memory.
Message-Id: <[email protected]>
--- migration/postcopy-ram.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
migration/postcopy-ram.c +6 -5
@@ -533,6 +533,12 @@ int postcopy_ram_incoming_cleanup(MigrationIncomingState *mis)if (mis->have_fault_thread) {Error *local_err =NULL ; +/* Let the fault thread quit */ +atomic_set (&mis->fault_thread_quit,1 ); +postcopy_fault_thread_notify (mis); +trace_postcopy_ram_incoming_cleanup_join (); +qemu_thread_join (&mis->fault_thread); +if (postcopy_notify (POSTCOPY_NOTIFY_INBOUND_END , &local_err)) {error_report_err (local_err);return -1 ;
@@ -541,11 +547,6 @@ int postcopy_ram_incoming_cleanup(MigrationIncomingState *mis)if (qemu_ram_foreach_migratable_block (cleanup_range, mis)) {return -1 ; } -/* Let the fault thread quit */ -atomic_set (&mis->fault_thread_quit,1 ); -postcopy_fault_thread_notify (mis); -trace_postcopy_ram_incoming_cleanup_join (); -qemu_thread_join (&mis->fault_thread);trace_postcopy_ram_incoming_cleanup_closeuf ();close (mis->userfault_fd);
Signature · 1 line
2.19.0
[Qemu-devel] [PULL 4/7] vhost-user: Fix userfaultfd leak
In reply to Dr. David Alan Gilbert (git)From: Ilya Maximets <[email protected]>
'fd' received from the vhost side is never freed. Also, everything (including 'postcopy_listen' state) should be cleaned up on vhost cleanup.
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 7 +++++++ 1 file changed, 7 insertions(+)
hw/virtio/vhost-user.c +7 -0
@@ -1291,6 +1291,7 @@ static int vhost_user_postcopy_end(struct vhost_dev *dev, Error **errp)return ret; }postcopy_unregister_shared_ufd (&u->postcopy_fd); +close (u->postcopy_fd.fd); u->postcopy_fd.handler =NULL ;trace_vhost_user_postcopy_end_exit ();
@@ -1430,6 +1431,12 @@ static int vhost_user_backend_cleanup(struct vhost_dev *dev)postcopy_remove_notifier (&u->postcopy_notifier); u->postcopy_notifier.notify =NULL ; } + u->postcopy_listen = false; +if (u->postcopy_fd.handler) { +postcopy_unregister_shared_ufd (&u->postcopy_fd); +close (u->postcopy_fd.fd); + u->postcopy_fd.handler =NULL ; + }if (u->slave_fd >=0 ) {qemu_set_fd_handler (u->slave_fd,NULL ,NULL ,NULL );close (u->slave_fd);
Signature · 1 line
2.19.0
[Qemu-devel] [PULL 5/7] vhost-user: Don't ask for reply on postcopy mem table set
In reply to Dr. David Alan Gilbert (git)From: Ilya Maximets <[email protected]>
According to documentation, NEED_REPLY_MASK should not be set for VHOST_USER_SET_MEM_TABLE request in postcopy mode. This restriction was mistakenly applied to 'reply_supported' variable, which is local and used only for non-postcopy case.
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
hw/virtio/vhost-user.c +1 -12
@@ -374,8 +374,6 @@ static int vhost_user_set_mem_table_postcopy(struct vhost_dev *dev,int fds[VHOST_MEMORY_MAX_NREGIONS ];int i, fd;size_t fd_num =0 ; -bool reply_supported =virtio_has_feature (dev->protocol_features, -VHOST_USER_PROTOCOL_F_REPLY_ACK );VhostUserMsg msg_reply;int region_i, msg_i;
@@ -384,10 +382,6 @@ static int vhost_user_set_mem_table_postcopy(struct vhost_dev *dev, .hdr.flags = VHOST_USER_VERSION, }; -if (reply_supported) { - msg.hdr.flags |=VHOST_USER_NEED_REPLY_MASK ; - } -if (u->region_rb_len < dev->mem->nregions) { u->region_rb = g_renew(RAMBlock*, u->region_rb, dev->mem->nregions); u->region_rb_offset = g_renew(ram_addr_t, u->region_rb_offset,
@@ -503,10 +497,6 @@ static int vhost_user_set_mem_table_postcopy(struct vhost_dev *dev,return -1 ; } -if (reply_supported) { -return process_message_reply (dev, &msg); - } -return 0 ; }
@@ -519,8 +509,7 @@ static int vhost_user_set_mem_table(struct vhost_dev *dev,size_t fd_num =0 ;bool do_postcopy = u->postcopy_listen && u->postcopy_fd.handler;bool reply_supported =virtio_has_feature (dev->protocol_features, -VHOST_USER_PROTOCOL_F_REPLY_ACK ) && - !do_postcopy; +VHOST_USER_PROTOCOL_F_REPLY_ACK );if (do_postcopy) {/* Postcopy has enough differences that it's best done in it's own
Signature · 1 line
2.19.0
From: "Dr. David Alan Gilbert" <[email protected]>
The following changes since commit 75e50c80e051423a6f55a34ee4a1eec842444a5b:
Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2018-10-10' into staging (2018-10-11 10:43:37 +0100)
are available in the Git repository at:
git://github.com/dagrh/qemu.git tags/pull-migration-20181011a
for you to fetch changes up to 36bd9e3c8b049cb9124e04ed8bf8f9451d63de03:
migration-test: Only generate a single target architecture (2018-10-11 19:58:26 +0100)
----------------------------------------------------------------
Migration pull 2018-10-11
With one bonus HMP/PCI fix from Denis.
----------------------------------------------------------------
Denis V. Lunev (1):
qmp, hmp: make subsystem/system-vendor identities optional
Ilya Maximets (3):
migration: Stop postcopy fault thread before notifying
vhost-user: Fix userfaultfd leak
vhost-user: Don't ask for reply on postcopy mem table set
Juan Quintela (1):
migration-test: Only generate a single target architecture
Thomas Huth (1):
tests/migration: Enable the migration test on s390x, too
Wei Huang (1):
tests: Add migration test for aarch64
hmp.c | 6 +- hw/pci/pci.c | 13 +- hw/virtio/vhost-user.c | 20 ++- migration/postcopy-ram.c | 11 +- qapi/misc.json | 4 +- tests/Makefile.include | 2 + tests/migration-test.c | 51 ++++++- tests/migration/Makefile | 25 ++-- tests/migration/aarch64/Makefile | 18 +++ tests/migration/aarch64/a-b-kernel.S | 75 +++++++++++ tests/migration/aarch64/a-b-kernel.h | 18 +++ tests/migration/migration-test.h | 13 ++ tests/migration/s390x/Makefile | 24 ++++ tests/migration/s390x/a-b-bios.c | 36 +++++ tests/migration/s390x/a-b-bios.h | 253 +++++++++++++++++++++++++++++++++++ 15 files changed, 531 insertions(+), 38 deletions(-) create mode 100644 tests/migration/aarch64/Makefile create mode 100644 tests/migration/aarch64/a-b-kernel.S create mode 100644 tests/migration/aarch64/a-b-kernel.h create mode 100644 tests/migration/s390x/Makefile create mode 100644 tests/migration/s390x/a-b-bios.c create mode 100644 tests/migration/s390x/a-b-bios.h
[Qemu-devel] [PULL 6/7] qmp, hmp: make subsystem/system-vendor identities optional
From: "Denis V. Lunev" <[email protected]>
According to PCI specification, subsystem id and subsystem vendor id are present only in type 0 and type 2 headers (at different offsets), but not in type 1 headers.
Thus we should make this data optional in struct PciDeviceId and skip reporting them via HMP if the information is not available.
Additional (wrong information) about PCI bridges (Type1 devices) has been added in 5383a705 and fortunately not released. This patch fixes that problem. The problem was spotted by Markus.
Message-Id: <[email protected]>
--- hmp.c | 6 ++++-- hw/pci/pci.c | 13 ++++++++++--- qapi/misc.json | 4 ++-- 3 files changed, 16 insertions(+), 7 deletions(-)
hmp.c +4 -2
@@ -837,8 +837,10 @@ static void hmp_info_pci_device(Monitor *mon, const PciDeviceInfo *dev)monitor_printf (mon,": PCI device %04" PRIx64":%04" PRIx64"\n" , dev->id->vendor, dev->id->device); -monitor_printf (mon," PCI subsystem %04" PRIx64":%04" PRIx64"\n" , - dev->id->subsystem_vendor, dev->id->subsystem); +if (dev->id->has_subsystem_vendor && dev->id->has_subsystem) { +monitor_printf (mon," PCI subsystem %04" PRIx64":%04" PRIx64"\n" , + dev->id->subsystem_vendor, dev->id->subsystem); + }if (dev->has_irq) {monitor_printf (mon," IRQ %" PRId64".\n" , dev->irq);
hw/pci/pci.c +10 -3
@@ -1737,9 +1737,6 @@ static PciDeviceInfo *qmp_query_pci_device(PCIDevice *dev, PCIBus *bus, info->id =g_new0 (PciDeviceId,1 ); info->id->vendor =pci_get_word (dev->config +PCI_VENDOR_ID ); info->id->device =pci_get_word (dev->config +PCI_DEVICE_ID ); - info->id->subsystem =pci_get_word (dev->config +PCI_SUBSYSTEM_ID ); - info->id->subsystem_vendor = -pci_get_word (dev->config +PCI_SUBSYSTEM_VENDOR_ID ); info->regions =qmp_query_pci_regions (dev); info->qdev_id =g_strdup (dev->qdev.id ? dev->qdev.id :"" );
@@ -1752,6 +1749,16 @@ static PciDeviceInfo *qmp_query_pci_device(PCIDevice *dev, PCIBus *bus,if (type ==PCI_HEADER_TYPE_BRIDGE ) { info->has_pci_bridge = true; info->pci_bridge =qmp_query_pci_bridge (dev, bus, bus_num); + }else if (type ==PCI_HEADER_TYPE_NORMAL ) { + info->id->has_subsystem = info->id->has_subsystem_vendor = true; + info->id->subsystem =pci_get_word (dev->config +PCI_SUBSYSTEM_ID ); + info->id->subsystem_vendor = +pci_get_word (dev->config +PCI_SUBSYSTEM_VENDOR_ID ); + }else if (type ==PCI_HEADER_TYPE_CARDBUS ) { + info->id->has_subsystem = info->id->has_subsystem_vendor = true; + info->id->subsystem =pci_get_word (dev->config +PCI_CB_SUBSYSTEM_ID ); + info->id->subsystem_vendor = +pci_get_word (dev->config +PCI_CB_SUBSYSTEM_VENDOR_ID ); }return info;
qapi/misc.json +2 -2
@@ -839,8 +839,8 @@ # Since: 2.4 ## { 'struct': 'PciDeviceId', - 'data': {'device': 'int', 'vendor': 'int', 'subsystem': 'int', - 'subsystem-vendor': 'int'} } + 'data': {'device': 'int', 'vendor': 'int', '*subsystem': 'int', + '*subsystem-vendor': 'int'} } ## # @PciDeviceInfo:
Signature · 1 line
2.19.0
[Qemu-devel] [PULL 1/7] tests: Add migration test for aarch64
In reply to Dr. David Alan Gilbert (git)From: Wei Huang <[email protected]>
This patch adds migration test support for aarch64. The test code, which implements the same functionality as x86, is booted as a kernel in qemu. Here are the design choices we make for aarch64:
* We choose this -kernel approach because aarch64 QEMU doesn't provide a built-in fw like x86 does. So instead of relying on a boot loader, we use -kernel approach for aarch64.
* The serial output is sent to PL011 directly.
* The physical memory base for mach-virt machine is 0x40000000. We change the start_address and end_address for aarch64.
In addition to providing the binary, this patch also includes the source code and the build script in tests/migration/aarch64. So users can change the source and/or re-compile the binary as they wish.
Message-Id: <[email protected]>
--- tests/Makefile.include | 1 + tests/migration-test.c | 27 ++++++++-- tests/migration/Makefile | 2 +- tests/migration/aarch64/Makefile | 18 +++++++ tests/migration/aarch64/a-b-kernel.S | 75 ++++++++++++++++++++++++++++ tests/migration/aarch64/a-b-kernel.h | 18 +++++++ tests/migration/migration-test.h | 9 ++++ 7 files changed, 145 insertions(+), 5 deletions(-) create mode 100644 tests/migration/aarch64/Makefile create mode 100644 tests/migration/aarch64/a-b-kernel.S create mode 100644 tests/migration/aarch64/a-b-kernel.h
tests/Makefile.include +1 -0
@@ -402,6 +402,7 @@ check-qtest-arm-y += tests/hexloader-test$(EXESUF) check-qtest-aarch64-y = tests/numa-test$(EXESUF) check-qtest-aarch64-$(CONFIG_SDHCI) += tests/sdhci-test$(EXESUF) check-qtest-aarch64-y += tests/boot-serial-test$(EXESUF) +check-qtest-aarch64-y += tests/migration-test$(EXESUF) check-qtest-microblazeel-y = $(check-qtest-microblaze-y)
tests/migration-test.c +23 -4
@@ -86,12 +86,13 @@ static const char *tmpfs;* repeatedly. It outputs a 'B' at a fixed rate while it's still running. */ #include "tests/migration/i386/a-b-bootblock.h" +#include "tests/migration/aarch64/a-b-kernel.h" -static void init_bootfile_x86 (const char *bootpath) +static void init_bootfile (const char *bootpath,void *content) {FILE *bootfile =fopen (bootpath,"wb" ); - g_assert_cmpint(fwrite(x86_bootsect, 512, 1, bootfile), ==, 1); + g_assert_cmpint(fwrite(content, 512, 1, bootfile), ==, 1);fclose (bootfile); }
@@ -428,7 +429,7 @@ static int test_migrate_start(QTestState **from, QTestState **to, got_stop = false;if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { -init_bootfile_x86 (bootpath); +init_bootfile (bootpath, x86_bootsect); cmd_src =g_strdup_printf ("-machine accel=%s -m 150M" " -name source,debug-threads=on" " -serial file:%s/src_serial"
@@ -459,6 +460,24 @@ static int test_migrate_start(QTestState **from, QTestState **to, start_address =PPC_TEST_MEM_START ; end_address =PPC_TEST_MEM_END ; + }else if (strcmp (arch,"aarch64" ) ==0 ) { +init_bootfile (bootpath, aarch64_kernel); + cmd_src =g_strdup_printf ("-machine virt,accel=%s,gic-version=max " +"-name vmsource,debug-threads=on -cpu max " +"-m 150M -serial file:%s/src_serial " +"-kernel %s " , + accel, tmpfs, bootpath); + cmd_dst =g_strdup_printf ("-machine virt,accel=%s,gic-version=max " +"-name vmdest,debug-threads=on -cpu max " +"-m 150M -serial file:%s/dest_serial " +"-kernel %s " +"-incoming %s " , + accel, tmpfs, bootpath, uri); + + start_address =ARM_TEST_MEM_START ; + end_address =ARM_TEST_MEM_END ; + +g_assert (sizeof (aarch64_kernel) <=ARM_TEST_MAX_KERNEL_SIZE ); }else {g_assert_not_reached (); }
@@ -545,7 +564,7 @@ static void test_deprecated(void) {QTestState *from; - from =qtest_start ("" ); + from =qtest_start ("-machine none" );deprecated_set_downtime (from,0.12345 );deprecated_set_speed (from,12345 );
tests/migration/Makefile +1 -1
@@ -5,7 +5,7 @@ # See the COPYING file in the top-level directory. # -TARGET_LIST = i386 +TARGET_LIST = i386 aarch64 SRC_PATH = ../..
tests/migration/aarch64/Makefile new file +18 -0
@@ -0,0 +1,18 @@ +# To specify cross compiler prefix, use CROSS_PREFIX= +# $ make CROSS_PREFIX=aarch64-linux-gnu- + +.PHONY: all clean +all: a-b-kernel.h + +a-b-kernel.h: aarch64.kernel + echo "$$__note" > $@ + xxd -i $< | sed -e 's/.*int.*//' >> $@ + +aarch64.kernel: aarch64.elf + $(CROSS_PREFIX)objcopy -O binary $< $@ + +aarch64.elf: a-b-kernel.S + $(CROSS_PREFIX)gcc -o $@ -nostdlib -Wl,--build-id=none $< + +clean: + $(RM) *.kernel *.elf
tests/migration/aarch64/a-b-kernel.S new file +75 -0
75 lines not on this page · raw message
tests/migration/aarch64/a-b-kernel.h new file +18 -0
@@ -0,0 +1,18 @@ +/* This file is automatically generated from the assembly file in +* tests/migration/aarch64. Edit that file and then run "make all" +* inside tests/migration to update, and then remember to send both +* the header and the assembler differences in your patch submission. +*/ +unsigned char aarch64_kernel[] = { +0x00 ,0x10 ,0x38 ,0xd5 ,0x00 ,0xf8 ,0x7f ,0x92 ,0x00 ,0x10 ,0x18 ,0xd5 , +0xdf ,0x3f ,0x03 ,0xd5 ,0x00 ,0x02 ,0xa8 ,0xd2 ,0x01 ,0xc8 ,0xa8 ,0xd2 , +0x23 ,0x08 ,0x80 ,0x52 ,0x02 ,0x20 ,0xa1 ,0xd2 ,0x43 ,0x00 ,0x00 ,0x39 , +0x03 ,0x00 ,0x80 ,0x52 ,0xe4 ,0x03 ,0x00 ,0xaa ,0x83 ,0x00 ,0x00 ,0x39 , +0x84 ,0x04 ,0x40 ,0x91 ,0x9f ,0x00 ,0x01 ,0xeb ,0xad ,0xff ,0xff ,0x54 , +0x05 ,0x00 ,0x80 ,0x52 ,0xe4 ,0x03 ,0x00 ,0xaa ,0x83 ,0x00 ,0x40 ,0x39 , +0x63 ,0x04 ,0x00 ,0x11 ,0x63 ,0x1c ,0x00 ,0x12 ,0x83 ,0x00 ,0x00 ,0x39 , +0x24 ,0x7e ,0x0b ,0xd5 ,0x84 ,0x04 ,0x40 ,0x91 ,0x9f ,0x00 ,0x01 ,0xeb , +0x2b ,0xff ,0xff ,0x54 ,0xa5 ,0x04 ,0x00 ,0x11 ,0xa5 ,0x1c ,0x00 ,0x12 , +0xbf ,0x00 ,0x00 ,0x71 ,0x81 ,0xfe ,0xff ,0x54 ,0x43 ,0x08 ,0x80 ,0x52 , +0x43 ,0x00 ,0x00 ,0x39 ,0xf1 ,0xff ,0xff ,0x17 +};
tests/migration/migration-test.h +9 -0
@@ -18,4 +18,13 @@#define PPC_TEST_MEM_START (1 * 1024 * 1024)#define PPC_TEST_MEM_END (100 * 1024 * 1024) +/* ARM */ +#define ARM_TEST_MEM_START (0x40000000 + 1 * 1024 * 1024) +#define ARM_TEST_MEM_END (0x40000000 + 100 * 1024 * 1024) +#define ARM_MACH_VIRT_UART 0x09000000 +/* AArch64 kernel load address is 0x40080000, and the test memory starts at +* 0x40100000. So the maximum allowable kernel size is 512KB. +*/ +#define ARM_TEST_MAX_KERNEL_SIZE (512 * 1024) +#endif /* _TEST_MIGRATION_H_ */
Signature · 1 line
2.19.0
[Qemu-devel] [PULL 2/7] tests/migration: Enable the migration test on s390x, too
In reply to Dr. David Alan Gilbert (git)From: Thomas Huth <[email protected]>
We can re-use the s390-ccw bios code to implement a small firmware for a s390x guest which prints out the "A" and "B" characters and modifies the memory, as required for the migration test.
Message-Id: <[email protected]>
Fixed up Makefile since the aarch patch sneaked in first
--- tests/Makefile.include | 1 + tests/migration-test.c | 24 +++ tests/migration/Makefile | 2 +- tests/migration/migration-test.h | 4 + tests/migration/s390x/Makefile | 24 +++ tests/migration/s390x/a-b-bios.c | 36 +++++ tests/migration/s390x/a-b-bios.h | 253 +++++++++++++++++++++++++++++++ 7 files changed, 343 insertions(+), 1 deletion(-) create mode 100644 tests/migration/s390x/Makefile create mode 100644 tests/migration/s390x/a-b-bios.c create mode 100644 tests/migration/s390x/a-b-bios.h
tests/Makefile.include +1 -0
@@ -416,6 +416,7 @@ check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-redirector$(EXESUF) check-qtest-s390x-y += tests/drive_del-test$(EXESUF) check-qtest-s390x-y += tests/virtio-ccw-test$(EXESUF) check-qtest-s390x-y += tests/cpu-plug-test$(EXESUF) +check-qtest-s390x-y += tests/migration-test$(EXESUF) check-qtest-generic-y += tests/machine-none-test$(EXESUF) check-qtest-generic-y += tests/qom-test$(EXESUF)
tests/migration-test.c +24 -0
@@ -96,6 +96,17 @@ static void init_bootfile(const char *bootpath, void *content)fclose (bootfile); } +#include "tests/migration/s390x/a-b-bios.h" + +static void init_bootfile_s390x (const char *bootpath) +{ +FILE *bootfile =fopen (bootpath,"wb" ); +size_t len =sizeof (s390x_elf); + + g_assert_cmpint(fwrite(s390x_elf, len, 1, bootfile), ==, 1); +fclose (bootfile); +} +/* * Wait for some output in the serial output file, * we get an 'A' followed by an endless string of 'B's
@@ -443,6 +454,19 @@ static int test_migrate_start(QTestState **from, QTestState **to, accel, tmpfs, bootpath, uri); start_address =X86_TEST_MEM_START ; end_address =X86_TEST_MEM_END ; + }else if (g_str_equal (arch,"s390x" )) { +init_bootfile_s390x (bootpath); + cmd_src =g_strdup_printf ("-machine accel=%s -m 128M" +" -name source,debug-threads=on" +" -serial file:%s/src_serial -bios %s" , + accel, tmpfs, bootpath); + cmd_dst =g_strdup_printf ("-machine accel=%s -m 128M" +" -name target,debug-threads=on" +" -serial file:%s/dest_serial -bios %s" +" -incoming %s" , + accel, tmpfs, bootpath, uri); + start_address =S390_TEST_MEM_START ; + end_address =S390_TEST_MEM_END ; }else if (strcmp (arch,"ppc64" ) ==0 ) { cmd_src =g_strdup_printf ("-machine accel=%s -m 256M -nodefaults" " -name source,debug-threads=on"
tests/migration/Makefile +1 -1
@@ -5,7 +5,7 @@ # See the COPYING file in the top-level directory. # -TARGET_LIST = i386 aarch64 +TARGET_LIST = i386 aarch64 s390x SRC_PATH = ../..
tests/migration/migration-test.h +4 -0
@@ -14,6 +14,10 @@#define X86_TEST_MEM_START (1 * 1024 * 1024)#define X86_TEST_MEM_END (100 * 1024 * 1024) +/* S390 */ +#define S390_TEST_MEM_START (1 * 1024 * 1024) +#define S390_TEST_MEM_END (100 * 1024 * 1024) +/* PPC */ #define PPC_TEST_MEM_START (1 * 1024 * 1024)#define PPC_TEST_MEM_END (100 * 1024 * 1024)
tests/migration/s390x/Makefile new file +24 -0
@@ -0,0 +1,24 @@ +# To specify cross compiler prefix, use CROSS_PREFIX= +# $ make CROSS_PREFIX=s390x-linux-gnu- + +.PHONY: all clean +all: a-b-bios.h +fwdir=../../../pc-bios/s390-ccw + +CFLAGS+=-ffreestanding -fno-delete-null-pointer-checks -fPIE -Os \ + -msoft-float -march=z900 -fno-asynchronous-unwind-tables -Wl,-pie \ + -Wl,--build-id=none -nostdlib + +a-b-bios.h: s390x.elf + echo "$$__note" > header.tmp + xxd -i $< | sed -e 's/.*int.*//' >> header.tmp + mv header.tmp $@ + +# We use common-page-size=16 to avoid big padding in the ELF file +s390x.elf: a-b-bios.c + $(CROSS_PREFIX)gcc $(CFLAGS) -I$(fwdir) $(fwdir)/start.S \ + $(fwdir)/sclp.c -Wl,-zcommon-page-size=16 -o $@ $< + $(CROSS_PREFIX)strip $@ + +clean: + @rm -rf *.elf *.o
tests/migration/s390x/a-b-bios.c new file +36 -0
@@ -0,0 +1,36 @@ +/* +* S390 guest code used in migration tests +* +* Copyright 2018 Thomas Huth, Red Hat Inc. +* +* This code is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +*/ + +#define LOADPARM_LEN 8/* Needed for sclp.h */ + +#include <libc.h> +#include <s390-ccw.h> +#include <sclp.h> + +char stack[0x8000] __attribute__((aligned(4096))); + +#define START_ADDRESS (1024 * 1024) +#define END_ADDRESS (100 * 1024 * 1024) + +void main (void ) +{ +unsigned long addr; + +sclp_setup (); +sclp_print ("A" ); + +while (1 ) { +for (addr =START_ADDRESS ; addr <END_ADDRESS ; addr +=4096 ) { + *(volatile char *)addr +=1 ;/* Change pages */ + } +sclp_print ("B" ); + } +}
tests/migration/s390x/a-b-bios.h new file +253 -0
253 lines not on this page · raw message
Signature · 1 line
2.19.0
[Qemu-devel] [PULL 7/7] migration-test: Only generate a single target architecture
In reply to Dr. David Alan Gilbert (git)From: Juan Quintela <[email protected]>
Several changes:
- We only allow generate header "inside" the tree. Why? Because we need to connit the result, so it makes no sense to generate them on the build dir.
- We only generate a single target each time. Getting all the cross-compilers correctly is an impossible task. So know you do:
make -C tests/migration $target (native)
make CROSS_PREFIX=foo- -C tests/migratiion $target (cross)
And you are done.
- If we are building out of tree, we have no data about if we are cross-compile or whatever. So instead of guess what is happening, just do what I pointed on previous point.
Message-Id: <[email protected]>
--- tests/migration/Makefile | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
tests/migration/Makefile +14 -9
@@ -9,6 +9,19 @@ TARGET_LIST = i386 aarch64 s390x SRC_PATH = ../.. +.PHONY: help $(TARGET_LIST) +help: + @echo "Create migration guest includes. We generate a binary." + @echo "And then convert that binary to an include file that can be" + @echo "run in a guest." + @echo "Possible operations are:" + @echo + @echo " $(MAKE) clean Remove all intermediate files" + @echo " $(MAKE) target Generate for that target" + @echo " $(MAKE) CROSS_PREFIX=... target" + @echo " Cross-compile than target" + @echo " Possible targets are: $(TARGET_LIST)" + override define __note /* This file is automatically generated from the assembly file in * tests/migration/$@. Edit that file and then run "make all"
@@ -18,16 +31,8 @@ override define __note endef export __note -find-arch-cross-cc = $(lastword $(shell grep -h "CROSS_CC_GUEST=" $(wildcard $(SRC_PATH)/$(patsubst i386,*86*,$(1))-softmmu/config-target.mak) /dev/null)) -parse-cross-prefix = $(subst gcc,,$(patsubst cc,gcc,$(patsubst CROSS_CC_GUEST="%",%,$(call find-arch-cross-cc,$(1))))) -gen-cross-prefix = $(patsubst %-,CROSS_PREFIX=%-,$(call parse-cross-prefix,$(1))) - -.PHONY: all $(TARGET_LIST) - -all: $(TARGET_LIST) - $(TARGET_LIST): - $(MAKE) -C $@ $(call gen-cross-prefix,$@) + $(MAKE) CROSS_PREFIX=$(CROSS_PREFIX) -C $@ clean: for target in $(TARGET_LIST); do \
Signature · 1 line
2.19.0
Peter Maydell
AppliedQuoted 28 lines · Dr. David Alan Gilbert (git)
From: "Dr. David Alan Gilbert" <[email protected]>
The following changes since commit
75e50c80e051423a6f55a34ee4a1eec842444a5b:Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2018-10-10' into staging (2018-10-11 10:43:37 +0100)
are available in the Git repository at:
git://github.com/dagrh/qemu.gittags/pull-migration-20181011afor you to fetch changes up to
36bd9e3c8b049cb9124e04ed8bf8f9451d63de03:migration-test: Only generate a single target architecture (2018-10-11 19:58:26 +0100)
----------------------------------------------------------------
Migration pull 2018-10-11With one bonus HMP/PCI fix from Denis.
----------------------------------------------------------------
Denis V. Lunev (1):
qmp, hmp: make subsystem/system-vendor identities optionalIlya Maximets (3):
migration: Stop postcopy fault thread before notifying
vhost-user: Fix userfaultfd leak
vhost-user: Don't ask for reply on postcopy mem table set
Quoted 8 lines
Juan Quintela (1):
migration-test: Only generate a single target architectureThomas Huth (1):
tests/migration: Enable the migration test on s390x, tooWei Huang (1):
tests: Add migration test for aarch64
Applied, thanks.
-- PMM
Re: [Qemu-devel] [PULL 2/7] tests/migration: Enable the migration test on s390x, too
In reply to Dr. David Alan Gilbert (git)Quoted 6 lines · Dr. David Alan Gilbert (git)
From: Thomas Huth <[email protected]>
We can re-use the s390-ccw bios code to implement a small firmware for a s390x guest which prints out the "A" and "B" characters and modifies the memory, as required for the migration test.
Quoted 8 lines
[quintela: Converted the compile script to Makefile rules]Signed-off-by Juan Quintela <[email protected]>Signed-off-by Thomas Huth <[email protected]>Message-Id: <[email protected]>
Reviewed-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Dr. David Alan Gilbert <[email protected]>Fixed up
Makefilesince the aarch patch sneaked in first
I suspect this test is giving me intermittent hangs. I've seen the hangs in different machines, but when they're lightly loaded the hang happens more frequently.
To reproduce:
$ ./configure --target-list=s390x-softmmu $ make clean && make $ for i in $(seq 0 150); do echo $i && make -j check-qtest || break; done
It usually ends up hanging before 50 runs. When the hang happens, I see two qemu-system-s390x processes with:
-serial file:/tmp/migration-test-0FZErQ/dest_serial
as an argument, among others. That means the migration test is the one hanging, correct?
Attaching with gdb just shows the TCG thread waiting for work in qemu_tcg_rr_wait_io_event.
Can anyone reproduce this? Otherwise, let me know what other info I could provide.
Thanks,
Emilio
Re: [Qemu-devel] [PULL 2/7] tests/migration: Enable the migration test on s390x, too
Quoted 26 lines · Emilio G. Cota
Quoted 6 lines · Dr. David Alan Gilbert (git)
From: Thomas Huth <[email protected]>
We can re-use the s390-ccw bios code to implement a small firmware for a s390x guest which prints out the "A" and "B" characters and modifies the memory, as required for the migration test.
Quoted 8 lines
[quintela: Converted the compile script to Makefile rules]Signed-off-by Juan Quintela <[email protected]>Signed-off-by Thomas Huth <[email protected]>Message-Id: <[email protected]>
Reviewed-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Dr. David Alan Gilbert <[email protected]>Fixed up
Makefilesince the aarch patch sneaked in firstI suspect this test is giving me intermittent hangs. I've seen the hangs in different machines, but when they're lightly loaded the hang happens more frequently.
To reproduce:
$ ./configure --target-list=s390x-softmmu $ make clean && make $ for i in $(seq 0 150); do echo $i && make -j check-qtest || break; done
Quoted 7 lines
It usually ends up hanging before 50 runs. When the hang happens, I see two qemu-system-s390x processes with:
-serial file:/tmp/migration-test-0FZErQ/dest_serial
as an argument, among others. That means the migration test is the one hanging, correct?
Can you also reproduce it directly by only running the migration test alone, just to be sure? I.e. run something like this in a loop:
QTEST_QEMU_BINARY="s390x-softmmu/qemu-system-s390x" tests/migration-test
Thanks,
Thomas
Re: [Qemu-devel] [PULL 2/7] tests/migration: Enable the migration test on s390x, too
In reply to Emilio G. CotaQuoted 31 lines · Emilio G. Cota
Quoted 6 lines · Dr. David Alan Gilbert (git)
From: Thomas Huth <[email protected]>
We can re-use the s390-ccw bios code to implement a small firmware for a s390x guest which prints out the "A" and "B" characters and modifies the memory, as required for the migration test.
Quoted 8 lines
[quintela: Converted the compile script to Makefile rules]Signed-off-by Juan Quintela <[email protected]>Signed-off-by Thomas Huth <[email protected]>Message-Id: <[email protected]>
Reviewed-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Dr. David Alan Gilbert <[email protected]>Fixed up
Makefilesince the aarch patch sneaked in firstI suspect this test is giving me intermittent hangs. I've seen the hangs in different machines, but when they're lightly loaded the hang happens more frequently.
To reproduce:
$ ./configure --target-list=s390x-softmmu $ make clean && make $ for i in $(seq 0 150); do echo $i && make -j check-qtest || break; doneIt usually ends up hanging before 50 runs. When the hang happens, I see two qemu-system-s390x processes with:
-serial file:/tmp/migration-test-0FZErQ/dest_serial
Quoted 8 lines
as an argument, among others. That means the migration test is the one hanging, correct?
Attaching with gdb just shows the TCG thread waiting for work in
qemu_tcg_rr_wait_io_event.Can anyone reproduce this? Otherwise, let me know what other info I could provide.
I've finally been able to reproduce it - seems like it only happens here when the host is under heavy load.
... not sure whether I've got time to debug this before KVM forum, so if it bugs you, feel free to send a patch to disable the test in tests/Makefile.include for s390x again.
Thomas
Re: [Qemu-devel] [PULL 2/7] tests/migration: Enable the migration test on s390x, too
Quoted 10 lines · Thomas Huth
Quoted 2 lines · Emilio G. Cota
Can anyone reproduce this? Otherwise, let me know what other info I could provide.
I've finally been able to reproduce it - seems like it only happens here when the host is under heavy load.
... not sure whether I've got time to debug this before KVM forum, so if it bugs you, feel free to send a patch to disable the test in tests/Makefile.include for s390x again.
Glad you could reproduce! I'll disable the test locally for now.
Thanks,
Emilio
Re: [Qemu-devel] [PULL 2/7] tests/migration: Enable the migration test on s390x, too
Quoted 7 lines · Emilio G. Cota
Quoted 6 lines · Thomas Huth
Quoted 2 lines · Emilio G. Cota
Can anyone reproduce this? Otherwise, let me know what other info I could provide.
I've finally been able to reproduce it - seems like it only happens here when the host is under heavy load.
Given that it only happens under heavy load, could the failure be caused by migration thresholds defined in migrate_postcopy_prepare()? You can play with "max-bandwidth", "downtime-limit" and others to see if it helps.
Quoted 11 lines
Quoted 4 lines
... not sure whether I've got time to debug this before KVM forum, so if it bugs you, feel free to send a patch to disable the test in tests/Makefile.include for s390x again.
Glad you could reproduce! I'll disable the test locally for now.
Thanks,
Emilio
Re: [Qemu-devel] [PULL 2/7] tests/migration: Enable the migration test on s390x, too
Quoted 8 lines · Wei Huang
Quoted 5 lines · Emilio G. Cota
Quoted 4 lines · Thomas Huth
Quoted 2 lines · Emilio G. Cota
Can anyone reproduce this? Otherwise, let me know what other info I could provide.
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
I've finally been able to reproduce it - seems like it only happens here when the host is under heavy load.
Given that it only happens under heavy load, could the failure be caused by migration thresholds defined in
migrate_postcopy_prepare()? You can play with "max-bandwidth", "downtime-limit" and others to see if it helps.
David suggested on IRC yesterday that this problem might be the same as with the ppc64 migration test: It does not work with TCG, only with KVM.
I've now done some tests, and indeed, I can not reproduce the problem when running with KVM on a s390x host. But as soon as I disable the kvm kernel module and run the test with TCG there, the problem occurs again.
So I think I'll send a patch to disable this test with TCG for now. Once the problem with TCG has been solved, we can enable it again.
Thomas