• Paul Donohue's avatar
    qemu-timer: Call clock reset notifiers on forward jumps · fb1a3a05
    Paul Donohue authored
    Commit 691a0c9c
    
     introduced a mechanism by which QEMU_CLOCK_HOST can
    notify other parts of the emulator when the host clock has jumped
    backward.  This is used to avoid stalling timers that were scheduled
    based on the host clock.
    
    However, if the host clock jumps forward, then timers that were
    scheduled based on the host clock may fire rapidly and cause other
    problems.  For example, the mc146818rtc periodic timer will block
    execution of the VM and consume host CPU while firing every interrupt
    for the time period that was skipped by the host clock.
    
    To correct that problem, this commit fires the reset notification if the
    host clock jumps forward by more than a hard-coded limit.  The limit is
    currently set to a value of 60 seconds, which should be small enough to
    prevent excessive timer loops, but large enough to avoid frequent resets
    in idle VMs.
    
    Signed-off-by: default avatarPaul Donohue <qemu-git@PaulSD.com>
    Message-Id: <20150612140845.GD2749@TopQuark.net>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    fb1a3a05