Skip to contentSkip to conversation

audio: make audio poll timer deterministic

PATCH In review Pavel Dovgalyuk 4 participants 5 messages Feb 14, 2017 – Feb 16, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 audio: make audio poll timer deterministic

This patch changes resetting strategy of the audio polling timer. It does not change expiration time if the timer is already set. This patch is needed to make this timer deterministic and to use execution record/replay for audio devices.

audio_reset_timer is used in the function audio_vm_change_state_handler. Therefore every time VM is stopped or restarted the timer will be reset to new timeout. Virtual clock does not proceed while VM is stopped. Therefore there is no need in resetting the timeout when VM restarts.

v2: updated commit message
v3: now using timer_mod_anticipate function (as suggested by Yurii Zubrytskyi)

---
 audio/audio.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
audio/audio.c +1 -1
index c845a44..beadf7b 100644
@@ -1112,7 +1112,7 @@ static int audio_is_timer_needed (void)
 static void audio_reset_timer (AudioState *s)
 {
     if (audio_is_timer_needed ()) {
-        timer_mod (s->ts,
+        timer_mod_anticipate_ns(s->ts,
             qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + conf.period.ticks);
     }
     else {
#1 lore raw
Quoted 5 lines · Pavel Dovgalyuk

This patch changes resetting strategy of the audio polling timer. It does not change expiration time if the timer is already set. This patch is needed to make this timer deterministic and to use execution record/replay for audio devices.

Quoted 7 lines

audio_reset_timer is used in the function audio_vm_change_state_handler. Therefore every time VM is stopped or restarted the timer will be reset to new timeout. Virtual clock does not proceed while VM is stopped. Therefore there is no need in resetting the timeout when VM restarts.

v2: updated commit message
v3: now using timer_mod_anticipate function (as suggested by Yurii Zubrytskyi)

Gerd, feel free to pick either v2 or v3.

Paolo

#2 lore raw
Quoted 12 lines · Paolo Bonzini
Quoted 10 lines · Pavel Dovgalyuk

This patch changes resetting strategy of the audio polling timer. It does not change expiration time if the timer is already set. This patch is needed to make this timer deterministic and to use execution record/replay for audio devices.

audio_reset_timer is used in the function audio_vm_change_state_handler. Therefore every time VM is stopped or restarted the timer will be reset to new timeout. Virtual clock does not proceed while VM is stopped. Therefore there is no need in resetting the timeout when VM restarts.

Quoted 4 lines
Quoted 2 lines

v2: updated commit message
v3: now using timer_mod_anticipate function (as suggested by Yurii Zubrytskyi)

Gerd, feel free to pick either v2 or v3.

Picked up v3 now.

thanks,
Gerd

#3 lore raw
Quoted 13 lines

From: Gerd Hoffmann [mailto:[email protected]]

Quoted 11 lines · Paolo Bonzini
Quoted 10 lines · Pavel Dovgalyuk

This patch changes resetting strategy of the audio polling timer. It does not change expiration time if the timer is already set. This patch is needed to make this timer deterministic and to use execution record/replay for audio devices.

audio_reset_timer is used in the function audio_vm_change_state_handler. Therefore every time VM is stopped or restarted the timer will be reset to new timeout. Virtual clock does not proceed while VM is stopped. Therefore there is no need in resetting the timeout when VM restarts.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

v2: updated commit message
v3: now using timer_mod_anticipate function (as suggested by Yurii Zubrytskyi)

Gerd, feel free to pick either v2 or v3.

Picked up v3 now.

Thanks!

And what about patch for audio record/replay?
http://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg00345.html

Pavel Dovgalyuk

#4 lore raw
Quoted 16 lines · Pavel Dovgalyuk
Quoted 16 lines

From: Gerd Hoffmann [mailto:[email protected]]

Quoted 14 lines · Paolo Bonzini
Quoted 12 lines · Pavel Dovgalyuk

This patch changes resetting strategy of the audio polling timer. It does not change expiration time if the timer is already set. This patch is needed to make this timer deterministic and to use execution record/replay for audio devices.

audio_reset_timer is used in the function audio_vm_change_state_handler. Therefore every time VM is stopped or restarted the timer will be reset to new timeout. Virtual clock does not proceed while VM is stopped. Therefore there is no need in resetting the timeout when VM restarts.

v2: updated commit message
v3: now using timer_mod_anticipate function (as suggested by Yurii Zubrytskyi)

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Gerd, feel free to pick either v2 or v3.

Picked up v3 now.

Thanks!

And what about patch for audio record/replay?
http://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg00345.html

Picked that one too (busy preparing a audio pull req atm).

cheers,
Gerd