qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 11/41] migration: simplify error handling


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 11/41] migration: simplify error handling
Date: Thu, 21 Feb 2013 18:44:52 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

Il 21/02/2013 18:34, Juan Quintela ha scritto:
> This move buffered_flush() to inside the iothread lock.  At least the
> commit message needs to be changed.

No, it doesn't... Here is the full body of the migration thread:

    qemu_mutex_lock_iothread();
    qemu_savevm_state_begin(s->file, &s->params);

    while (s->state == MIG_STATE_ACTIVE) {
        int64_t current_time = qemu_get_clock_ms(rt_clock);
        uint64_t pending_size;

        if (s->bytes_xfer < s->xfer_limit) {
            /* call qemu_savevm_state_* */
        }

        qemu_mutex_unlock_iothread();
        if (current_time >= initial_time + BUFFER_DELAY) {
            /* yadda yadda */
            s->bytes_xfer = 0;
            initial_time = current_time;
        }
        if (!last_round && (s->bytes_xfer >= s->xfer_limit)) {
            /* usleep expects microseconds */
            g_usleep((initial_time + BUFFER_DELAY - current_time)*1000);
        }
        buffered_flush(s);
        qemu_mutex_lock_iothread();

        if (qemu_file_get_error(s->file)) {
            migrate_fd_error(s);
        }
    }

    qemu_mutex_unlock_iothread();

> Looking at the rest of the series before thinking if that is the right
> approach.

The series is fully bisectable.  There should be no thread-unsafe patch,
nor any state where blocking calls are done with iothread lock taken
(except at the end of migration where qemu_savevm_state_complete runs
with iothread lock taken; but this happens much later than this patch).

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]