Commit 7659505c authored by Dr. David Alan Gilbert's avatar Dr. David Alan Gilbert Committed by Jason Wang
Browse files

migration: Switch to using announce timer



Switch the announcements to using the new announce timer.
Move the code that does it to announce.c rather than savevm
because it really has nothing to do with the actual migration.

Migration starts the announce from bh's and so they're all
in the main thread/bql, and so there's never any racing with
the timers themselves.

Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
parent 9d8c6a25
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -29,16 +29,6 @@ void blk_mig_init(void);
static inline void blk_mig_init(void) {}
#endif

#define SELF_ANNOUNCE_ROUNDS 5

static inline
int64_t self_announce_delay(int round)
{
    assert(round < SELF_ANNOUNCE_ROUNDS && round > 0);
    /* delay 50ms, 150ms, 250ms, ... */
    return 50 + (SELF_ANNOUNCE_ROUNDS - round - 1) * 100;
}

AnnounceParameters *migrate_announce_params(void);
/* migration/savevm.c */

+2 −0
Original line number Diff line number Diff line
@@ -36,4 +36,6 @@ void qemu_announce_timer_reset(AnnounceTimer *timer,
                               QEMUTimerCB *cb,
                               void *opaque);

void qemu_announce_self(AnnounceTimer *timer, AnnounceParameters *params);

#endif
+0 −2
Original line number Diff line number Diff line
@@ -81,8 +81,6 @@ extern bool machine_init_done;
void qemu_add_machine_init_done_notifier(Notifier *notify);
void qemu_remove_machine_init_done_notifier(Notifier *notify);

void qemu_announce_self(void);

extern int autostart;

typedef enum {
+1 −1
Original line number Diff line number Diff line
@@ -374,7 +374,7 @@ static void process_incoming_migration_bh(void *opaque)
     * This must happen after all error conditions are dealt with and
     * we're sure the VM is going to be running on this host.
     */
    qemu_announce_self();
    qemu_announce_self(&mis->announce_timer, migrate_announce_params());

    if (multifd_load_cleanup(&local_err) != 0) {
        error_report_err(local_err);
+4 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include "qemu/coroutine_int.h"
#include "hw/qdev.h"
#include "io/channel.h"
#include "net/announce.h"

struct PostcopyBlocktimeContext;

@@ -36,6 +37,9 @@ struct MigrationIncomingState {
     */
    QemuEvent main_thread_load_event;

    /* For network announces */
    AnnounceTimer  announce_timer;

    size_t         largest_page_size;
    bool           have_fault_thread;
    QemuThread     fault_thread;
Loading