qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH v7 12/21] replay: recording and replaying cl


From: Pavel Dovgaluk
Subject: Re: [Qemu-devel] [RFC PATCH v7 12/21] replay: recording and replaying clock ticks
Date: Tue, 13 Jan 2015 12:21:57 +0300

> From: Paolo Bonzini [mailto:address@hidden
> On 12/01/2015 13:00, Pavel Dovgalyuk wrote:
> > +/*! Reads next clock event from the input. */
> > +int64_t replay_read_clock(unsigned int kind)
> > +{
> > +    if (kind >= REPLAY_CLOCK_COUNT) {
> > +        fprintf(stderr, "invalid clock ID %d for replay\n", kind);
> > +        exit(1);
> > +    }
> > +
> > +    replay_exec_instructions();
> > +
> > +    if (replay_file) {
> > +        if (skip_async_events(EVENT_CLOCK + kind)) {
> > +            replay_read_next_clock(kind);
> > +        }
> > +        int64_t ret = replay_state.cached_clock[kind];
> > +
> > +        return ret;
> > +    }
> > +
> > +    fprintf(stderr, "REPLAY INTERNAL ERROR %d\n", __LINE__);
> > +    exit(1);
> > +}
> 
> Is this thread safe?  

It is, because order of main_loop and cpu_exec executions is protected
by global mutex.

> Please introduce the record/replay QemuMutex in
> patch 4, and all along the series document which variables it protects.

record/replay only uses mutex for events queue, because events may be 
added to the queue by the different threads.

Pavel Dovgalyuk




reply via email to

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