1. 07 Jun, 2016 1 commit
  2. 15 Mar, 2016 1 commit
    • Pavel Dovgalyuk's avatar
      icount: decouple warp calls · e76d1798
      Pavel Dovgalyuk authored
      qemu_clock_warp function is called to update virtual clock when CPU
      is sleeping. This function includes replay checkpoint to make execution
      deterministic in icount mode.
      Record/replay module flushes async event queue at checkpoints.
      Some of the events (e.g., block devices operations) include interaction
      with hardware. E.g., APIC polled by block devices sets one of IRQ flags.
      Flag to be set depends on currently executed thread (CPU or iothread).
      Therefore in replay mode we have to process the checkpoints in the same thread
      as they were recorded.
      qemu_clock_warp function (and its checkpoint) may be called from different
      thread. This patch decouples two different execution cases of this function:
      call when CPU is sleeping from iothread and call from cpu thread to update
      virtual clock.
      First task is performed by qemu_start_warp_timer function. It sets warp
      timer event to the moment of nearest pending virtual timer.
      Second function (qemu_account_warp_timer) is called from cpu thread
      before execution of the code. It advances virtual clock by adding the length
      of period while CPU was sleeping.
      Signed-off-by: 's avatarPavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
      Message-Id: <20160310115609.4812.44986.stgit@PASHA-ISP>
      [Update docs. - Paolo]
      Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
  3. 04 Feb, 2016 1 commit
    • Peter Maydell's avatar
      all: Clean up includes · d38ea87a
      Peter Maydell authored
      Clean up includes so that osdep.h is included first and headers
      which it implies are not included manually.
      This commit was created with scripts/clean-includes.
      Signed-off-by: 's avatarPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1454089805-5470-16-git-send-email-peter.maydell@linaro.org
  4. 06 Nov, 2015 2 commits
  5. 22 Jul, 2015 1 commit
  6. 19 Jun, 2015 1 commit
    • 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: 's avatarPaul Donohue <qemu-git@PaulSD.com>
      Message-Id: <20150612140845.GD2749@TopQuark.net>
      Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
  7. 26 Jan, 2015 2 commits
    • Peter Maydell's avatar
      qemu-timer.c: Trim list of included headers · 1ac0206b
      Peter Maydell authored
      qemu-timer.c was including a lot more headers than it needed to,
      presumably for historical reasons. In particular, it included
      ui/console.h; this now tries to pull in <pixman.h>, which will
      cause a compilation failure in --disable-tools --disable-system
      configurations when running "make check" (which builds qemu-timer.c,
      even though the linux-user binaries themselves don't need it).
      Fix this build failure by trimming down the set of included
      headers severely -- we only really need main-loop.h and timer.h.
      Signed-off-by: 's avatarPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
      Message-id: 1421770600-17525-1-git-send-email-peter.maydell@linaro.org
    • Paolo Bonzini's avatar
      qemu-timer: introduce timer_deinit · cd1bd53a
      Paolo Bonzini authored
      In some cases, a timer was set to NULL so that we could check if it is
      initialized.  Use the timer_list field instead, and add a timer_deinit
      function that NULLs it.
      It then makes sense that timer_del be a no-op (instead of a crasher) on
      such a de-initialized timer.  It avoids the need to poke at the timerlist
      field to check if the timers are initialized.
      Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
  8. 14 Jan, 2015 1 commit
  9. 15 Dec, 2014 1 commit
  10. 27 Nov, 2014 1 commit
    • Peter Maydell's avatar
      qemu-timer: Avoid overflows when converting timeout to struct timespec · 490309fc
      Peter Maydell authored
      In qemu_poll_ns(), when we convert an int64_t nanosecond timeout into
      a struct timespec, we may accidentally run into overflow problems if
      the timeout is very long. This happens because the tv_sec field is a
      time_t, which is signed, so we might end up setting it to a negative
      value by mistake. This will result in what was intended to be a
      near-infinite timeout turning into an instantaneous timeout, and we'll
      busy loop. Cap the maximum timeout at INT32_MAX seconds (about 68 years)
      to avoid this problem.
      This specifically manifested on ARM hosts as an extreme slowdown on
      guest shutdown (when the guest reprogrammed the PL031 RTC to not
      generate alarms using a very long timeout) but could happen on other
      hosts and guests too.
      Reported-by: 's avatarChristoffer Dall <christoffer.dall@linaro.org>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: 's avatarPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: 's avatarFam Zheng <famz@redhat.com>
      Message-id: 1416939705-1272-1-git-send-email-peter.maydell@linaro.org
  11. 09 May, 2014 1 commit
    • Kirill Batuzov's avatar
      vl.c: remove init_clocks call from main · 02ce232c
      Kirill Batuzov authored
      Clocks are initialized in qemu_init_main_loop. They are not needed before it.
      Initializing them twice is not only unnecessary but is harmful: it results in
      memory leak and potentially can lead to a situation where different parts of
      QEMU use different sets of timers.
      To avoid it remove init_clocks call from main and add an assertion to
      qemu_clock_init that corresponding clock has not been initialized yet.
      Signed-off-by: 's avatarKirill Batuzov <batuzovk@ispras.ru>
      Signed-off-by: 's avatarStefan Hajnoczi <stefanha@redhat.com>
  12. 07 May, 2014 1 commit
  13. 17 Oct, 2013 3 commits
  14. 18 Sep, 2013 3 commits
    • Paolo Bonzini's avatar
      qemu-timer: do not take the lock in timer_pending · 3db1ee7c
      Paolo Bonzini authored
      We can deduce the result from expire_time, by making it always -1 if
      the timer is not in the active_timers list.  We need to check against
      negative times passed to timer_mod_ns; clamping them to zero is not
      a problem because the only clock that has a zero value at VM startup
      is QEMU_CLOCK_VIRTUAL, and it is monotonic so it cannot be non-zero.
      QEMU_CLOCK_HOST, instead, is not monotonic but it cannot go to negative
      values unless the host time is seriously screwed up and points to
      the 1960s.
      Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: 's avatarStefan Hajnoczi <stefanha@redhat.com>
    • Stefan Hajnoczi's avatar
      qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe · 978f2205
      Stefan Hajnoczi authored
      Introduce QEMUTimerList->active_timers_lock to protect the linked list
      of active timers.  This allows qemu_timer_mod_ns() to be called from any
      Note that vm_clock is not thread-safe and its use of
      qemu_clock_has_timers() works fine today but is also not thread-safe.
      The purpose of this patch is to eventually let device models set or
      cancel timers from a vcpu thread without holding the global mutex.
      Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: 's avatarStefan Hajnoczi <stefanha@redhat.com>
    • Stefan Hajnoczi's avatar
      qemu-timer: drop outdated signal safety comments · da718ceb
      Stefan Hajnoczi authored
      host_alarm_handler() is invoked from the signal processing thread
      (currently the iothread).  Previously we did processing in a real signal
      handler with signalfd and therefore needed signal-safe timer code.
      Today host_alarm_handler() just marks the alarm timer as expired/pending
      and notifies the main loop using qemu_notify_event().
      Therefore these outdated comments about signal safety can be dropped.
      Signed-off-by: 's avatarStefan Hajnoczi <stefanha@redhat.com>
  15. 22 Aug, 2013 17 commits
  16. 12 Apr, 2013 1 commit
  17. 19 Dec, 2012 2 commits