1. 17 5月, 2019 27 次提交
  2. 16 5月, 2019 2 次提交
    • P
      Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20190510' into staging · d8276573
      Peter Maydell 提交于
      Add CPUClass::tlb_fill.
      Improve tlb_vaddr_to_host for use by ARM SVE no-fault loads.
      
      # gpg: Signature made Fri 10 May 2019 19:48:37 BST
      # gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
      # gpg:                issuer "richard.henderson@linaro.org"
      # gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [full]
      # Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F
      
      * remotes/rth/tags/pull-tcg-20190510: (27 commits)
        tcg: Use tlb_fill probe from tlb_vaddr_to_host
        tcg: Remove CPUClass::handle_mmu_fault
        tcg: Use CPUClass::tlb_fill in cputlb.c
        target/xtensa: Convert to CPUClass::tlb_fill
        target/unicore32: Convert to CPUClass::tlb_fill
        target/tricore: Convert to CPUClass::tlb_fill
        target/tilegx: Convert to CPUClass::tlb_fill
        target/sparc: Convert to CPUClass::tlb_fill
        target/sh4: Convert to CPUClass::tlb_fill
        target/s390x: Convert to CPUClass::tlb_fill
        target/riscv: Convert to CPUClass::tlb_fill
        target/ppc: Convert to CPUClass::tlb_fill
        target/openrisc: Convert to CPUClass::tlb_fill
        target/nios2: Convert to CPUClass::tlb_fill
        target/moxie: Convert to CPUClass::tlb_fill
        target/mips: Convert to CPUClass::tlb_fill
        target/mips: Tidy control flow in mips_cpu_handle_mmu_fault
        target/mips: Pass a valid error to raise_mmu_exception for user-only
        target/microblaze: Convert to CPUClass::tlb_fill
        target/m68k: Convert to CPUClass::tlb_fill
        ...
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      d8276573
    • P
      Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20190514b' into staging · c1497fba
      Peter Maydell 提交于
      Migration pull 2019-05-14
      
      Small fixes/cleanups
      One HMP/monitor fix
      
      # gpg: Signature made Tue 14 May 2019 19:03:53 BST
      # gpg:                using RSA key 45F5C71B4A0CB7FB977A9FA90516331EBC5BFDE7
      # gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>" [full]
      # Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7
      
      * remotes/dgilbert/tags/pull-migration-20190514b:
        monitor: Call mon_get_cpu() only once at hmp_gva2gpa()
        migration/ram.c: fix typos in comments
        migration: Fix use-after-free during process exit
        migration/savevm: wrap into qemu_loadvm_state_header()
        migration/savevm: load_header before load_setup
        migration/savevm: remove duplicate check of migration_is_blocked
        migration: update comments of migration bitmap
        migration/ram.c: start of migration_bitmap_sync_range is always 0
        qemu-option.hx: Update missed parameter for colo-compare
        migration/colo.h: Remove obsolete codes
        migration/colo.c: Remove redundant input parameter
        migration: savevm: fix error code with migration blockers
        vmstate: check subsection_found is enough
        migration: remove not used field xfer_limit
        migration: not necessary to check ops again
        migration: comment VMSTATE_UNUSED*() properly
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      c1497fba
  3. 15 5月, 2019 11 次提交
    • E
      monitor: Call mon_get_cpu() only once at hmp_gva2gpa() · 9d3250d5
      Eduardo Habkost 提交于
      hmp_gva2gpa() calls mon_get_cpu() twice, which is unnecessary.
      Not an actual bug, but this is reported as a defect by Coverity
      Scan (CID 1401346).
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      Message-Id: <20190510185620.15757-1-ehabkost@redhat.com>
      Reviewed-by: NRichard Henderson <richard.henderson@linaro.org>
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      9d3250d5
    • W
      migration/ram.c: fix typos in comments · a5f7b1a6
      Wei Yang 提交于
      Signed-off-by: NWei Yang <richardw.yang@linux.intel.com>
      Message-Id: <20190510233729.15554-1-richardw.yang@linux.intel.com>
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      a5f7b1a6
    • Y
      migration: Fix use-after-free during process exit · fd392cfa
      Yury Kotov 提交于
      It fixes heap-use-after-free which was found by clang's ASAN.
      
      Control flow of this use-after-free:
      main_thread:
          * Got SIGTERM and completes main loop
          * Calls migration_shutdown
            - migrate_fd_cancel (so, migration_thread begins to complete)
            - object_unref(OBJECT(current_migration));
      
      migration_thread:
          * migration_iteration_finish -> schedule cleanup bh
          * object_unref(OBJECT(s)); (Now, current_migration is freed)
          * exits
      
      main_thread:
          * Calls vm_shutdown -> drain bdrvs -> main loop
            -> cleanup_bh -> use after free
      
      If you want to reproduce, these couple of sleeps will help:
      vl.c:4613:
           migration_shutdown();
      +    sleep(2);
      migration.c:3269:
      +    sleep(1);
           trace_migration_thread_after_loop();
           migration_iteration_finish(s);
      
      Original output:
      qemu-system-x86_64: terminating on signal 15 from pid 31980 (<unknown process>)
      =================================================================
      ==31958==ERROR: AddressSanitizer: heap-use-after-free on address 0x61900001d210
        at pc 0x555558a535ca bp 0x7fffffffb190 sp 0x7fffffffb188
      READ of size 8 at 0x61900001d210 thread T0 (qemu-vm-0)
          #0 0x555558a535c9 in migrate_fd_cleanup migration/migration.c:1502:23
          #1 0x5555594fde0a in aio_bh_call util/async.c:90:5
          #2 0x5555594fe522 in aio_bh_poll util/async.c:118:13
          #3 0x555559524783 in aio_poll util/aio-posix.c:725:17
          #4 0x555559504fb3 in aio_wait_bh_oneshot util/aio-wait.c:71:5
          #5 0x5555573bddf6 in virtio_blk_data_plane_stop
            hw/block/dataplane/virtio-blk.c:282:5
          #6 0x5555589d5c09 in virtio_bus_stop_ioeventfd hw/virtio/virtio-bus.c:246:9
          #7 0x5555589e9917 in virtio_pci_stop_ioeventfd hw/virtio/virtio-pci.c:287:5
          #8 0x5555589e22bf in virtio_pci_vmstate_change hw/virtio/virtio-pci.c:1072:9
          #9 0x555557628931 in virtio_vmstate_change hw/virtio/virtio.c:2257:9
          #10 0x555557c36713 in vm_state_notify vl.c:1605:9
          #11 0x55555716ef53 in do_vm_stop cpus.c:1074:9
          #12 0x55555716eeff in vm_shutdown cpus.c:1092:12
          #13 0x555557c4283e in main vl.c:4617:5
          #14 0x7fffdfdb482f in __libc_start_main
            (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
          #15 0x555556ecb118 in _start (x86_64-softmmu/qemu-system-x86_64+0x1977118)
      
      0x61900001d210 is located 144 bytes inside of 952-byte region
        [0x61900001d180,0x61900001d538)
      freed by thread T6 (live_migration) here:
          #0 0x555556f76782 in __interceptor_free
            /tmp/final/llvm.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:124:3
          #1 0x555558d5fa94 in object_finalize qom/object.c:618:9
          #2 0x555558d57651 in object_unref qom/object.c:1068:9
          #3 0x555558a55588 in migration_thread migration/migration.c:3272:5
          #4 0x5555595393f2 in qemu_thread_start util/qemu-thread-posix.c:502:9
          #5 0x7fffe057f6b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9)
      
      previously allocated by thread T0 (qemu-vm-0) here:
          #0 0x555556f76b03 in __interceptor_malloc
            /tmp/final/llvm.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:146:3
          #1 0x7ffff6ee37b8 in g_malloc (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4f7b8)
          #2 0x555558d58031 in object_new qom/object.c:640:12
          #3 0x555558a31f21 in migration_object_init migration/migration.c:139:25
          #4 0x555557c41398 in main vl.c:4320:5
          #5 0x7fffdfdb482f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
      
      Thread T6 (live_migration) created by T0 (qemu-vm-0) here:
          #0 0x555556f5f0dd in pthread_create
            /tmp/final/llvm.src/projects/compiler-rt/lib/asan/asan_interceptors.cc:210:3
          #1 0x555559538cf9 in qemu_thread_create util/qemu-thread-posix.c:539:11
          #2 0x555558a53304 in migrate_fd_connect migration/migration.c:3332:5
          #3 0x555558a72bd8 in migration_channel_connect migration/channel.c:92:5
          #4 0x555558a6ef87 in exec_start_outgoing_migration migration/exec.c:42:5
          #5 0x555558a4f3c2 in qmp_migrate migration/migration.c:1922:9
          #6 0x555558bb4f6a in qmp_marshal_migrate qapi/qapi-commands-migration.c:607:5
          #7 0x555559363738 in do_qmp_dispatch qapi/qmp-dispatch.c:131:5
          #8 0x555559362a15 in qmp_dispatch qapi/qmp-dispatch.c:174:11
          #9 0x5555571bac15 in monitor_qmp_dispatch monitor.c:4124:11
          #10 0x55555719a22d in monitor_qmp_bh_dispatcher monitor.c:4207:9
          #11 0x5555594fde0a in aio_bh_call util/async.c:90:5
          #12 0x5555594fe522 in aio_bh_poll util/async.c:118:13
          #13 0x5555595201e0 in aio_dispatch util/aio-posix.c:460:5
          #14 0x555559503553 in aio_ctx_dispatch util/async.c:261:5
          #15 0x7ffff6ede196 in g_main_context_dispatch
            (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4a196)
      
      SUMMARY: AddressSanitizer: heap-use-after-free migration/migration.c:1502:23
        in migrate_fd_cleanup
      Shadow bytes around the buggy address:
        0x0c327fffb9f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c327fffba00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c327fffba10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c327fffba20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c327fffba30: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
      =>0x0c327fffba40: fd fd[fd]fd fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c327fffba50: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c327fffba60: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c327fffba70: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c327fffba80: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c327fffba90: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
      Shadow byte legend (one shadow byte represents 8 application bytes):
        Addressable: 00
        Partially addressable: 01 02 03 04 05 06 07
        Heap left redzone: fa
        Freed heap region: fd
        Stack left redzone: f1
        Stack mid redzone: f2
        Stack right redzone: f3
        Stack after return: f5
        Stack use after scope: f8
        Global redzone: f9
        Global init order: f6
        Poisoned by user: f7
        Container overflow: fc
        Array cookie: ac
        Intra object redzone: bb
        ASan internal: fe
        Left alloca redzone: ca
        Right alloca redzone: cb
        Shadow gap: cc
      ==31958==ABORTING
      Signed-off-by: NYury Kotov <yury-kotov@yandex-team.ru>
      Message-Id: <20190408113343.2370-1-yury-kotov@yandex-team.ru>
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
        Fixed up comment formatting
      fd392cfa
    • W
      migration/savevm: wrap into qemu_loadvm_state_header() · 16015d32
      Wei Yang 提交于
      On source side, we have qemu_savevm_state_header() to send related data,
      while on the receiving side those steps are scattered in
      qemu_loadvm_state().
      
      This patch wrap those related steps into qemu_loadvm_state_header() to
      make it friendly to read.
      Signed-off-by: NWei Yang <richardw.yang@linux.intel.com>
      Message-Id: <20190424004700.12766-5-richardw.yang@linux.intel.com>
      Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      16015d32
    • W
      migration/savevm: load_header before load_setup · 9e14b849
      Wei Yang 提交于
      In migration_thread() and qemu_savevm_state(), we savevm_state in
      following sequence:
      
          qemu_savevm_state_header(f);
          qemu_savevm_state_setup(f);
      
      Then it would be more proper to loadvm_state in the save sequence.
      Signed-off-by: NWei Yang <richardw.yang@linux.intel.com>
      Message-Id: <20190424004700.12766-4-richardw.yang@linux.intel.com>
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      9e14b849
    • W
      migration/savevm: remove duplicate check of migration_is_blocked · 5351e69a
      Wei Yang 提交于
      Current call flow of save_snapshot is:
      
        save_snapshot
          migration_is_blocked
            qemu_savevm_state
              migration_is_blocked
      
      Since qemu_savevm_state is only called in save_snapshot, this means
      migration_is_blocked has been already checked.
      Signed-off-by: NWei Yang <richardw.yang@linux.intel.com>
      Message-Id: <20190424004700.12766-2-richardw.yang@linux.intel.com>
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      5351e69a
    • Y
      migration: update comments of migration bitmap · 4633456c
      Yi Wang 提交于
      Since the ram bitmap and the unsent bitmap are split by RAMBlock
      in commit 6b6712ef, it's better to update the comments about them.
      Signed-off-by: NYi Wang <wang.yi59@zte.com.cn>
      Message-Id: <1555311089-18610-1-git-send-email-wang.yi59@zte.com.cn>
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      4633456c
    • W
      migration/ram.c: start of migration_bitmap_sync_range is always 0 · bf212979
      Wei Yang 提交于
      We can eliminate to pass 0.
      Signed-off-by: NWei Yang <richardw.yang@linux.intel.com>
      Message-Id: <20190430034412.12935-2-richardw.yang@linux.intel.com>
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      bf212979
    • Z
      qemu-option.hx: Update missed parameter for colo-compare · 5aede7f4
      Zhang Chen 提交于
      We missed the iothread related args in this file.
      This patch is used to fix this issue.
      Signed-off-by: NZhang Chen <chen.zhang@intel.com>
      Message-Id: <20190426090730.2691-4-chen.zhang@intel.com>
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      5aede7f4
    • Z
      migration/colo.h: Remove obsolete codes · 9c16abcb
      Zhang Chen 提交于
      Signed-off-by: NZhang Chen <chen.zhang@intel.com>
      Message-Id: <20190426090730.2691-3-chen.zhang@intel.com>
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      9c16abcb
    • Z
      migration/colo.c: Remove redundant input parameter · c0913d1d
      Zhang Chen 提交于
      The colo_do_failover no need the input parameter.
      Signed-off-by: NZhang Chen <chen.zhang@intel.com>
      Message-Id: <20190426090730.2691-2-chen.zhang@intel.com>
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      c0913d1d