On 02/02/2015 14:50, Pavel Dovgaluk wrote:
> I think not. We just have to write number of already executed instructions.
> This number is not linked to exception event. They could be read in replay 
> while
> processing some other event.
>  

I was referring to replay_put_event(EVENT_EXCEPTION) only.

In principle you could run EVENT_EXCEPTION concurrently with other event
writes, for example:

+        replay_mutex_lock();
+        replay_put_event(EVENT_CLOCK + kind);
+        replay_put_qword(clock);
+        replay_mutex_unlock();

and get

        EVENT_CLOCK + kind (1 byte)
        EVENT_EXCEPTION (1 byte)
        clock (8 bytes)

in the replay stream.

I know it's really unlikely, perhaps even impossible in the current QEMU
architecture that is dominated by the big QEMU lock.  But the right
thing to do is to lock the mutex around all event writes.  Even if the
write itself is atomic, it could happen in the middle of another write
if you do not lock the mutex.

Paolo

Reply via email to