All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] implementing architectural timers using QEMU timers
@ 2017-01-09 15:18 Max Filippov
  2017-01-09 15:41 ` Alex Bligh
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Max Filippov @ 2017-01-09 15:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, Alex Bligh, Pavel Dovgaluk

Hello,

I'm trying to reimplement xtensa CCOUNT (cycle counter) and
CCOMPARE (CCOUNT-based timer interrupts) using QEMU
timers. That is CCOUNT value is derived from the
QEMU_CLOCK_VIRTUAL clock and CCOMPARE interrupts are
generated from the QEMU_CLOCK_VIRTUAL timer callbacks.
The code is here:
  https://github.com/OSLL/qemu-xtensa/commits/xtensa-ccount

I've got the following issues doing that:

- in non-icount mode I can often read CCOUNT and get a value
  that is greater than programmed CCOMPARE value, which
  means that QEMU timer must have been fired at that point, but
  no sign of timer callback being called. That is timer callback
  invocation lags behind due time.

  Is my understanding correct that there's no hard expectations
  that firing of QEMU timers will be correctly sequenced with
  readings of QEMU clock?

- I thought that could be improved in -icount mode, so I tried that.
  It is better with -icount, but it's still not 100% accurate. That is
  I was able to observe guest reading QEMU clock value that is
  past QEMU timer deadline before that timer callback was
  invoked.

  That sounds like a bug to me, is it?

- when guest sets a timer and halts itself waiting for timer
  interrupt with waiti opcode QEMU behaviour is very strange with
  -icount: regardless of the programmed timeout QEMU waits for
  about a second before it delivers interrupt, and, AFAICT,
  interrupt delivery it is not caused by the corresponding CCOUNT
  timer. I was able to track this issue down to the
  qemu_clock_use_for_deadline function, i.e. always returning true
  'fixes' that unwanted delay, but looking around the timer code
  I've got the impression that that's not the correct fix.

  Any suggestions on how to fix that?

-- 
Thanks.
-- Max

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-01-17 18:20 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-09 15:18 [Qemu-devel] implementing architectural timers using QEMU timers Max Filippov
2017-01-09 15:41 ` Alex Bligh
2017-01-10 15:22   ` Max Filippov
2017-01-10  8:31 ` Pavel Dovgalyuk
2017-01-10 18:39   ` Max Filippov
2017-01-10 18:47     ` Peter Maydell
2017-01-10 18:51       ` Max Filippov
2017-01-12 11:28     ` Pavel Dovgalyuk
2017-01-12 12:01       ` Peter Maydell
2017-01-12 12:19         ` Pavel Dovgalyuk
2017-01-16 17:19           ` Paolo Bonzini
2017-01-17  5:45             ` Pavel Dovgalyuk
2017-01-17 18:20             ` Max Filippov
2017-01-15 21:52       ` Max Filippov
2017-01-10  9:10 ` Frederic Konrad
2017-01-10 18:45   ` Max Filippov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.