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

2015-01-19 Thread Pavel Dovgaluk
From: Paolo Bonzini [mailto:pbonz...@redhat.com] On 19/01/2015 14:10, Pavel Dovgaluk wrote: Because 'A' is written only inside some of the replay_run_event callbacks. It depends on type of the event and it's processing function inside the QEMU core. There could be no

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

2015-01-19 Thread Paolo Bonzini
On 19/01/2015 13:03, Pavel Dovgaluk wrote: It will work for protecting the events list (I've already did this). But that will not work for protecting the log file. replay_run_event can write some data to the log. And also some other function like replay_checkpoint can also write to the log

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

2015-01-19 Thread Pavel Dovgaluk
From: Paolo Bonzini [mailto:pbonz...@redhat.com] On 19/01/2015 13:03, Pavel Dovgaluk wrote: It will work for protecting the events list (I've already did this). But that will not work for protecting the log file. replay_run_event can write some data to the log. And also some other

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

2015-01-19 Thread Pavel Dovgaluk
From: Paolo Bonzini [mailto:pbonz...@redhat.com] On 19/01/2015 13:43, Pavel Dovgaluk wrote: For example, why can't replay_run_event (or something that it calls) take the replay lock locally, when it writes to the log? replay_run_event can take the lock. Suppose that it writes data 'A'.

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

2015-01-19 Thread Pavel Dovgaluk
From: Paolo Bonzini [mailto:pbonz...@redhat.com] On 19/01/2015 14:01, Pavel Dovgaluk wrote: It would be easier if you pointed me to actual code in the series. But this doesn't seem impossible to fix by atomically writing the 'E' and 'A' in the same critical section. Because 'A' is

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

2015-01-19 Thread Paolo Bonzini
On 19/01/2015 14:10, Pavel Dovgaluk wrote: Because 'A' is written only inside some of the replay_run_event callbacks. It depends on type of the event and it's processing function inside the QEMU core. There could be no 'A' at all. Why can't that code write the 'E' as

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

2015-01-19 Thread Paolo Bonzini
On 19/01/2015 13:43, Pavel Dovgaluk wrote: For example, why can't replay_run_event (or something that it calls) take the replay lock locally, when it writes to the log? replay_run_event can take the lock. Suppose that it writes data 'A'. replay_run_event itself corresponds to some event

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

2015-01-19 Thread Paolo Bonzini
On 19/01/2015 14:01, Pavel Dovgaluk wrote: It would be easier if you pointed me to actual code in the series. But this doesn't seem impossible to fix by atomically writing the 'E' and 'A' in the same critical section. Because 'A' is written only inside some of the replay_run_event

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

2015-01-19 Thread Pavel Dovgaluk
From: Paolo Bonzini [mailto:pbonz...@redhat.com] On 16/01/2015 09:03, Pavel Dovgaluk wrote: There is one problem with protecting log file inside the replay code. We probably should have the following sequence of calls: lock_replay_mutex replay_save_events replay_run_event

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

2015-01-19 Thread Paolo Bonzini
On 16/01/2015 09:03, Pavel Dovgaluk wrote: There is one problem with protecting log file inside the replay code. We probably should have the following sequence of calls: lock_replay_mutex replay_save_events replay_run_event unlock_replay_mutex But replay_run_event can also

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

2015-01-16 Thread Pavel Dovgaluk
From: Paolo Bonzini [mailto:pbonz...@redhat.com] On 13/01/2015 10:21, Pavel Dovgaluk 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

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

2015-01-13 Thread Pavel Dovgaluk
From: Paolo Bonzini [mailto:pbonz...@redhat.com] 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,

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

2015-01-13 Thread Paolo Bonzini
On 13/01/2015 10:21, Pavel Dovgaluk 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); +} + +

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

2015-01-12 Thread Pavel Dovgaluk
From: Paolo Bonzini [mailto:pbonz...@redhat.com] On 12/01/2015 13:00, Pavel Dovgalyuk wrote: diff --git a/replay/replay.h b/replay/replay.h index 90a949b..1c18c0e 100755 --- a/replay/replay.h +++ b/replay/replay.h @@ -16,6 +16,16 @@ #include stdint.h #include qapi-types.h +/*

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

2015-01-12 Thread Paolo Bonzini
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); +} + +

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

2015-01-12 Thread Paolo Bonzini
On 12/01/2015 13:43, Pavel Dovgaluk wrote: +#define REPLAY_CLOCK(clock, value) \ +(replay_mode == REPLAY_MODE_PLAY ? replay_read_clock((clock)) \ +: replay_mode == REPLAY_MODE_RECORD \ +