All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Filippov <jcmvbkbc@gmail.com>
To: Pavel Dovgalyuk <dovgaluk@ispras.ru>
Cc: qemu-devel <qemu-devel@nongnu.org>,
	Richard Henderson <rth@twiddle.net>,
	Alex Bligh <alex@alex.org.uk>,
	Pavel Dovgaluk <Pavel.Dovgaluk@ispras.ru>
Subject: Re: [Qemu-devel] implementing architectural timers using QEMU timers
Date: Tue, 10 Jan 2017 10:39:08 -0800	[thread overview]
Message-ID: <CAMo8BfJKXOhiPQz8GT6hXNNBXKsz-67iKx9ct9tEwukVLWR3QA@mail.gmail.com> (raw)
In-Reply-To: <001201d26b1b$e5a8ce20$b0fa6a60$@ru>

On Tue, Jan 10, 2017 at 12:31 AM, Pavel Dovgalyuk <dovgaluk@ispras.ru> wrote:
>> From: Max Filippov [mailto:jcmvbkbc@gmail.com]
>
>> 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:
>>
>> - 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.
>
> icount is meant to be 100% accurate.
> tcg_get_icount_limit function calculates the deadline before the soonest
> virtual timer and executes number of instructions that will fit this
> timeout.

Ok, looks like what happens in my case is that instruction that
sets CCOMPARE and thus changes remaining icount does not
cause exit from the cpu_exec. So merely ending TB on
QEMU_CLOCK_VIRTUAL timer update is not enough, I need to
throw an exception of some kind? Or does the timer code need
to take care of that?

> Maybe you need the accuracy that is higher than the precision of the virtual clock?
> Every executed instruction in icount mode takes fixed period of virtual time.

-- 
Thanks.
-- Max

  reply	other threads:[~2017-01-10 18:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMo8BfJKXOhiPQz8GT6hXNNBXKsz-67iKx9ct9tEwukVLWR3QA@mail.gmail.com \
    --to=jcmvbkbc@gmail.com \
    --cc=Pavel.Dovgaluk@ispras.ru \
    --cc=alex@alex.org.uk \
    --cc=dovgaluk@ispras.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.