Skip to content
Snippets Groups Projects
  1. Aug 28, 2020
  2. Aug 27, 2020
  3. Aug 21, 2020
  4. Jul 27, 2020
  5. Jul 17, 2020
  6. Jul 13, 2020
    • Liao Pingfang's avatar
      migration/migration.c: Remove superfluous breaks · eb9bd46f
      Liao Pingfang authored
      
      Remove superfluous breaks, as there is a "return" before them.
      
      Signed-off-by: default avatarLiao Pingfang <liao.pingfang@zte.com.cn>
      Signed-off-by: default avatarYi Wang <wang.yi59@zte.com.cn>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Reviewed-by: default avatarJuan Quintela <quintela@redhat.com>
      Reviewed-by: default avatarThomas Huth <thuth@redhat.com>
      Signed-off-by: default avatarJuan Quintela <quintela@redhat.com>
      eb9bd46f
    • Denis V. Lunev's avatar
      migration/savevm: respect qemu_fclose() error code in save_snapshot() · 66270a47
      Denis V. Lunev authored
      
      qemu_fclose() could return error, f.e. if bdrv_co_flush() will return
      the error.
      
      This validation will become more important once we will start waiting of
      asynchronous IO operations, started from bdrv_write_vmstate(), which are
      coming soon.
      
      Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
      Reviewed-by: default avatar"Dr. David Alan Gilbert" <dgilbert@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Reviewed-by: default avatarJuan Quintela <quintela@redhat.com>
      CC: Kevin Wolf <kwolf@redhat.com>
      CC: Max Reitz <mreitz@redhat.com>
      CC: Stefan Hajnoczi <stefanha@redhat.com>
      CC: Fam Zheng <fam@euphon.net>
      CC: Juan Quintela <quintela@redhat.com>
      CC: Denis Plotnikov <dplotnikov@virtuozzo.com>
      Signed-off-by: default avatarJuan Quintela <quintela@redhat.com>
      66270a47
    • Zheng Chuan's avatar
      migration: fix memory leak in qmp_migrate_set_parameters · 9728ebfb
      Zheng Chuan authored
      
      "tmp.tls_hostname" and "tmp.tls_creds" allocated by migrate_params_test_apply()
      is forgot to free at the end of qmp_migrate_set_parameters(). Fix that.
      
      The leak stack:
      Direct leak of 2 byte(s) in 2 object(s) allocated from:
         #0 0xffffb597c20b in __interceptor_malloc (/usr/lib64/libasan.so.4+0xd320b)
         #1 0xffffb52dcb1b in g_malloc (/usr/lib64/libglib-2.0.so.0+0x58b1b)
         #2 0xffffb52f8143 in g_strdup (/usr/lib64/libglib-2.0.so.0+0x74143)
         #3 0xaaaac52447fb in migrate_params_test_apply (/usr/src/debug/qemu-4.1.0/migration/migration.c:1377)
         #4 0xaaaac52fdca7 in qmp_migrate_set_parameters (/usr/src/debug/qemu-4.1.0/qapi/qapi-commands-migration.c:192)
         #5 0xaaaac551d543 in qmp_dispatch (/usr/src/debug/qemu-4.1.0/qapi/qmp-dispatch.c:165)
         #6 0xaaaac52a0a8f in qmp_dispatch (/usr/src/debug/qemu-4.1.0/monitor/qmp.c:125)
         #7 0xaaaac52a1c7f in monitor_qmp_dispatch (/usr/src/debug/qemu-4.1.0/monitor/qmp.c:214)
         #8 0xaaaac55cb0cf in aio_bh_call (/usr/src/debug/qemu-4.1.0/util/async.c:117)
         #9 0xaaaac55d4543 in aio_bh_poll (/usr/src/debug/qemu-4.1.0/util/aio-posix.c:459)
         #10 0xaaaac55cae0f in aio_dispatch (/usr/src/debug/qemu-4.1.0/util/async.c:268)
         #11 0xffffb52d6a7b in g_main_context_dispatch (/usr/lib64/libglib-2.0.so.0+0x52a7b)
         #12 0xaaaac55d1e3b(/usr/bin/qemu-kvm-4.1.0+0x1622e3b)
         #13 0xaaaac4e314bb(/usr/bin/qemu-kvm-4.1.0+0xe824bb)
         #14 0xaaaac47f45ef(/usr/bin/qemu-kvm-4.1.0+0x8455ef)
         #15 0xffffb4bfef3f in __libc_start_main (/usr/lib64/libc.so.6+0x23f3f)
         #16 0xaaaac47ffacb(/usr/bin/qemu-kvm-4.1.0+0x850acb)
      
      Direct leak of 2 byte(s) in 2 object(s) allocated from:
         #0 0xffffb597c20b in __interceptor_malloc (/usr/lib64/libasan.so.4+0xd320b)
         #1 0xffffb52dcb1b in g_malloc (/usr/lib64/libglib-2.0.so.0+0x58b1b)
         #2 0xffffb52f8143 in g_strdup (/usr/lib64/libglib-2.0.so.0+0x74143)
         #3 0xaaaac5244893 in migrate_params_test_apply (/usr/src/debug/qemu-4.1.0/migration/migration.c:1382)
         #4 0xaaaac52fdca7 in qmp_migrate_set_parameters (/usr/src/debug/qemu-4.1.0/qapi/qapi-commands-migration.c:192)
         #5 0xaaaac551d543 in qmp_dispatch (/usr/src/debug/qemu-4.1.0/qapi/qmp-dispatch.c)
         #6 0xaaaac52a0a8f in qmp_dispatch (/usr/src/debug/qemu-4.1.0/monitor/qmp.c:125)
         #7 0xaaaac52a1c7f in monitor_qmp_dispatch (/usr/src/debug/qemu-4.1.0/monitor/qmp.c:214)
         #8 0xaaaac55cb0cf in aio_bh_call (/usr/src/debug/qemu-4.1.0/util/async.c:117)
         #9 0xaaaac55d4543 in aio_bh_poll (/usr/src/debug/qemu-4.1.0/util/aio-posix.c:459)
         #10 0xaaaac55cae0f in in aio_dispatch (/usr/src/debug/qemu-4.1.0/util/async.c:268)
         #11 0xffffb52d6a7b in g_main_context_dispatch (/usr/lib64/libglib-2.0.so.0+0x52a7b)
         #12 0xaaaac55d1e3b(/usr/bin/qemu-kvm-4.1.0+0x1622e3b)
         #13 0xaaaac4e314bb(/usr/bin/qemu-kvm-4.1.0+0xe824bb)
         #14 0xaaaac47f45ef (/usr/bin/qemu-kvm-4.1.0+0x8455ef)
         #15 0xffffb4bfef3f in __libc_start_main (/usr/lib64/libc.so.6+0x23f3f)
         #16 0xaaaac47ffacb(/usr/bin/qemu-kvm-4.1.0+0x850acb)
      
      Signed-off-by: default avatarChuan Zheng <zhengchuan@huawei.com>
      Reviewed-by: default avatarKeQian Zhu <zhukeqian1@huawei.com>
      Reviewed-by: default avatarHaiLiang <zhang.zhanghailiang@huawei.com>
      Reviewed-by: default avatarJuan Quintela <quintela@redhat.com>
      Signed-off-by: default avatarJuan Quintela <quintela@redhat.com>
      9728ebfb
  7. Jul 10, 2020
    • Claudio Fontana's avatar
      cpu-throttle: new module, extracted from cpus.c · b0c3cf94
      Claudio Fontana authored
      
      move the vcpu throttling functionality into its own module.
      
      This functionality is not specific to any accelerator,
      and it is used currently by migration to slow down guests to try to
      have migrations converge, and by the cocoa MacOS UI to throttle speed.
      
      cpu-throttle contains the controls to adjust and inspect throttle
      settings, start (set) and stop vcpu throttling, and the throttling
      function itself that is run periodically on vcpus to make them take a nap.
      
      Execution of the throttling function on all vcpus is triggered by a timer,
      registered at module initialization.
      
      No functionality change.
      
      Signed-off-by: default avatarClaudio Fontana <cfontana@suse.de>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Reviewed-by: default avatarLaurent Vivier <lvivier@redhat.com>
      Message-Id: <20200629093504.3228-3-cfontana@suse.de>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      b0c3cf94
  8. Jul 03, 2020
  9. Jul 02, 2020
  10. Jun 26, 2020
    • Eric Blake's avatar
      osdep: Make MIN/MAX evaluate arguments only once · f9919116
      Eric Blake authored
      I'm not aware of any immediate bugs in qemu where a second runtime
      evaluation of the arguments to MIN() or MAX() causes a problem, but
      proactively preventing such abuse is easier than falling prey to an
      unintended case down the road.  At any rate, here's the conversation
      that sparked the current patch:
      https://lists.gnu.org/archive/html/qemu-devel/2018-12/msg05718.html
      
      
      
      Update the MIN/MAX macros to only evaluate their argument once at
      runtime; this uses typeof(1 ? (a) : (b)) to ensure that we are
      promoting the temporaries to the same type as the final comparison (we
      have to trigger type promotion, as typeof(bitfield) won't compile; and
      we can't use typeof((a) + (b)) or even typeof((a) + 0), as some of our
      uses of MAX are on void* pointers where such addition is undefined).
      
      However, we are unable to work around gcc refusing to compile ({}) in
      a constant context (such as the array length of a static variable),
      even when only used in the dead branch of a __builtin_choose_expr(),
      so we have to provide a second macro pair MIN_CONST and MAX_CONST for
      use when both arguments are known to be compile-time constants and
      where the result must also be usable as a constant; this second form
      evaluates arguments multiple times but that doesn't matter for
      constants.  By using a void expression as the expansion if a
      non-constant is presented to this second form, we can enlist the
      compiler to ensure the double evaluation is not attempted on
      non-constants.
      
      Alas, as both macros now rely on compiler intrinsics, they are no
      longer usable in preprocessor #if conditions; those will just have to
      be open-coded or the logic rewritten into #define or runtime 'if'
      conditions (but where the compiler dead-code-elimination will probably
      still apply).
      
      I tested that both gcc 10.1.1 and clang 10.0.0 produce errors for all
      forms of macro mis-use.  As the errors can sometimes be cryptic, I'm
      demonstrating the gcc output:
      
      Use of MIN when MIN_CONST is needed:
      
      In file included from /home/eblake/qemu/qemu-img.c:25:
      /home/eblake/qemu/include/qemu/osdep.h:249:5: error: braced-group within expression allowed only inside a function
        249 |     ({                                                  \
            |     ^
      /home/eblake/qemu/qemu-img.c:92:12: note: in expansion of macro ‘MIN’
         92 | char array[MIN(1, 2)] = "";
            |            ^~~
      
      Use of MIN_CONST when MIN is needed:
      
      /home/eblake/qemu/qemu-img.c: In function ‘is_allocated_sectors’:
      /home/eblake/qemu/qemu-img.c:1225:15: error: void value not ignored as it ought to be
       1225 |             i = MIN_CONST(i, n);
            |               ^
      
      Use of MIN in the preprocessor:
      
      In file included from /home/eblake/qemu/accel/tcg/translate-all.c:20:
      /home/eblake/qemu/accel/tcg/translate-all.c: In function ‘page_check_range’:
      /home/eblake/qemu/include/qemu/osdep.h:249:6: error: token "{" is not valid in preprocessor expressions
        249 |     ({                                                  \
            |      ^
      
      Fix the resulting callsites that used #if or computed a compile-time
      constant min or max to use the new macros.  cpu-defs.h is interesting,
      as CPU_TLB_DYN_MAX_BITS is sometimes used as a constant and sometimes
      dynamic.
      
      It may be worth improving glib's MIN/MAX definitions to be saner, but
      that is a task for another day.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Tested-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-Id: <20200625162602.700741-1-eblake@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      f9919116
  11. Jun 18, 2020
  12. Jun 17, 2020
    • Laurent Vivier's avatar
      migration: fix multifd_send_pages() next channel · 7e89a140
      Laurent Vivier authored
      
      multifd_send_pages() loops around the available channels,
      the next channel to use between two calls to multifd_send_pages() is stored
      inside a local static variable, next_channel.
      
      It works well, except if the number of channels decreases between two calls
      to multifd_send_pages(). In this case, the loop can try to access the
      data of a channel that doesn't exist anymore.
      
      The problem can be triggered if we start a migration with a given number of
      channels and then we cancel the migration to restart it with a lower number.
      This ends generally with an error like:
      qemu-system-ppc64: .../util/qemu-thread-posix.c:77: qemu_mutex_lock_impl: Assertion `mutex->initialized' failed.
      
      This patch fixes the error by capping next_channel with the current number
      of channels before using it.
      
      Signed-off-by: default avatarLaurent Vivier <lvivier@redhat.com>
      Message-Id: <20200617113154.593233-1-lvivier@redhat.com>
      Reviewed-by: default avatarJuan Quintela <quintela@redhat.com>
      Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      7e89a140
  13. Jun 15, 2020
  14. Jun 10, 2020
  15. Jun 01, 2020
Loading