qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH v9 11/23] replay: recording and replaying cl


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [RFC PATCH v9 11/23] replay: recording and replaying clock ticks
Date: Wed, 18 Feb 2015 15:13:10 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0


On 18/02/2015 12:56, Pavel Dovgalyuk wrote:
> +void replay_read_next_clock(ReplayClockKind kind)

This function is called like this:

> +    if (replay_file) {
> +        int64_t ret;
> +        replay_mutex_lock();
> +        if (skip_async_events(EVENT_CLOCK + kind)) {
> +            replay_read_next_clock(kind);
> +        }

So it seems to me that this section is unnecessary:

> +    replay_fetch_data_kind();
> +    if (replay_file) {
> +        unsigned int read_kind = replay_data_kind - EVENT_CLOCK;
> +
> +        if (read_kind != kind) {
> +            return;
> +        }

1) replay_file must be non-NULL

2) skip_async_events has fetched replay_data_kind

3) replay_data_kind - EVENT_CLOCK must match read_kind

It can be replaced simply with

    assert(replay_has_unread_data);
    assert(replay_data_kind - EVENT_CLOCK == kind);

I suspect there are other cases like this where you have unnecessary
calls to replay_fetch_data_kind().

Paolo



reply via email to

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