qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	monstr@monstr.eu, qemu-devel@nongnu.org,
	John Linn <john.linn@xilinx.com>,
	duyl@xilinx.com, linnj@xilinx.com, edgar.iglesias@gmail.com,
	afaerber@suse.de, john.williams@petalogix.com
Subject: Re: [Qemu-devel] [PATCH v6 2/4] cadence_ttc: initial version of device model
Date: Tue, 28 Feb 2012 12:07:52 +0000	[thread overview]
Message-ID: <201202281207.53320.paul@codesourcery.com> (raw)
In-Reply-To: <CAEgOgz7fCSBucMrdrSo01=H+4eHMpctKC73vjoeRxt+0N8ohLQ@mail.gmail.com>

> > Thinking about that, I realised why I don't like the following line:
> >> +    s->reg_value = (uint32_t)((x + interval) % interval);
> > 
> > This assumes x > -interval, which is not always true.
> 
> This would mean you have wrapped twice or more in one time step, which
> I am assuming is a fatal error condition, as It means your software
> has missed interrupts and all sort of race conditions would occur. I
> would personally prefer to assert !(x < -interval) and have qemu
> hw_error or something, as in these cases QEMU can just not handle your
> super quick timer wrap around.

No, not fatal at all.  On a heavily loaded host it's normal for qemu[1] to 
stall for tens of miliseconds at a time.  In extreme cases several seconds at 
a time, though we've fixed most of those.  This is greater than the interval 
of many guest periodic events.  A linux guest with HZ=1000 (even HZ=100) will 
routinely loose timer ticks.  By my reading your timers have a configurable 
limit, so the obvious configuration is a limit of 25000 (2.5MHz / 100), and 
trigger the jiffy tick off the timer wrap/reload.

If your guest OS assumes their ISR will complete before timer triggers again 
then it will break.  That's their problem.  Any guest that relies on 
consistent realtime performance/behavior is going to malfunction when run 
inside qemu.  This is only one of several ways that qemu behavior can differ 
from that of real hardware.

You can workaround some of these issues with -icount, though that has its own 
set of problems.  One of which is that is doesn't support KVM or SMP[2]. 
guests.

Paul

[1] The same applies for KVM.
[2] SMP may be fixable.  KVM probably not.

  parent reply	other threads:[~2012-02-28 12:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-20  1:45 [Qemu-devel] [PATCH v6 0/4] Zynq-7000 EPP platform model Peter A. G. Crosthwaite
2012-02-20  1:37 ` Peter Crosthwaite
2012-02-20  1:45 ` [Qemu-devel] [PATCH v6 1/4] cadence_uart: initial version of device model Peter A. G. Crosthwaite
2012-02-20 18:58   ` Peter Maydell
2012-02-23  1:41     ` Peter Crosthwaite
2012-02-20  1:45 ` [Qemu-devel] [PATCH v6 2/4] cadence_ttc: " Peter A. G. Crosthwaite
2012-02-20 19:32   ` Peter Maydell
2012-02-21 13:04     ` Paul Brook
2012-02-23  1:24       ` Peter Crosthwaite
2012-02-27 15:45         ` Paul Brook
2012-02-28  1:04           ` Peter Crosthwaite
2012-02-28  1:55             ` Peter Crosthwaite
2012-02-28 12:07             ` Paul Brook [this message]
2012-02-28 13:42               ` Peter Crosthwaite
2012-02-23  1:42     ` Peter Crosthwaite
2012-02-20  1:45 ` [Qemu-devel] [PATCH v6 3/4] cadence_gem: " Peter A. G. Crosthwaite
2012-02-20  1:45 ` [Qemu-devel] [PATCH v6 4/4] xilinx_zynq: machine model initial version Peter A. G. Crosthwaite
2012-02-20  6:25 ` [Qemu-devel] [PULL] Zynq-7000 EPP platform model Peter Crosthwaite
2012-02-20  7:24   ` Andreas Färber
2012-02-24 16:37   ` Anthony Liguori
2012-02-27  4:31     ` Peter Crosthwaite

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=201202281207.53320.paul@codesourcery.com \
    --to=paul@codesourcery.com \
    --cc=afaerber@suse.de \
    --cc=duyl@xilinx.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=john.linn@xilinx.com \
    --cc=john.williams@petalogix.com \
    --cc=linnj@xilinx.com \
    --cc=monstr@monstr.eu \
    --cc=peter.crosthwaite@petalogix.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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).