qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: steven.seeger@flightsystems.net
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] ppc icount questions
Date: Fri, 12 Jan 2018 19:11:10 +0100	[thread overview]
Message-ID: <c2e77a8e-077d-1d7e-b19c-e6f9c683d6aa@redhat.com> (raw)
In-Reply-To: <13538328.oP85yjFLDs@wirbelwind>

On 12/01/2018 19:03, Steven Seeger wrote:
>> That's probably because the CPU runs in the background while the timers
>> run.  So QEMU_CLOCK_VIRTUAL is _not_ latched while the timers run.
>> Would that explain it?
> 
> Yes that would explain it. QEMU_CLOCK_VIRTUAL should increase with number of 
> executed instructions, but it seems as I said above that this is still 
> factoring time in somewhere. Even though time is a factor (the host must be 
> able to wake up determinstically to handle the next timer deadline in the 
> guest) surely the concept of QEMU_CLOCK_VIRTUAL as tied to number of executed 
> instructions could remain stable.

I think this is the issue:

     I/O thread                    vCPU thread
 -----------------------------------------------------------------------
                                   executes 1,000,000,000-th instruction
                                   wakes up I/O thread
     finds 1st timer
     runs 1st timer
                                   executes 1,000 instructions
----------- QEMU_CLOCK_VIRTUAL now is 1,000,001,000 --------------------
     1st timer finishes
                                   executes 10,000 instructions
----------- QEMU_CLOCK_VIRTUAL now is 1,000,011,000 --------------------
     runs 2nd timer

> I can obtain "sort-of" decent results by using QEMU_CLOCK_VIRTUAL_RT for my tx 
> char timer in serial.c which allows fast bootup and approximately determinstic 
> virtual time later on in execution, but I still have issues with the number of 
> cpu instructions executed varying between timer responses.

QEMU_CLOCK_VIRTUAL_RT is for internal use (by -icount sleep, -icount
shift=auto, etc.).  You almost certainly don't need it.

Paolo

> With an interrupt every 1 second, and an interrupt every 10 ms, I would expect 
> the vxWorks guest to respond to these interrupts with a rather accurate delay 
> between them at the time the 10ms and 1 second interrupt occur at "the same 
> time."

  reply	other threads:[~2018-01-12 18:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12 16:19 [Qemu-devel] ppc icount questions Steven Seeger
2018-01-12 16:52 ` Paolo Bonzini
2018-01-12 17:12   ` Steven Seeger
2018-01-12 17:19     ` Paolo Bonzini
2018-01-12 18:03       ` Steven Seeger
2018-01-12 18:11         ` Paolo Bonzini [this message]
2018-01-12 18:35           ` Steven Seeger

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=c2e77a8e-077d-1d7e-b19c-e6f9c683d6aa@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=steven.seeger@flightsystems.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).