qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 6/6] target-alpha: Add high-resolution access to


From: Edgar E. Iglesias
Subject: Re: [Qemu-devel] [PATCH 6/6] target-alpha: Add high-resolution access to wall clock and an alarm.
Date: Sat, 27 Aug 2011 18:44:08 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Aug 26, 2011 at 05:36:19PM +0100, Peter Maydell wrote:
> On 26 August 2011 17:28, Richard Henderson <address@hidden> wrote:
> > On 08/25/2011 11:07 PM, Paolo Bonzini wrote:
> >> On 08/26/2011 05:51 AM, Peter Maydell wrote:
> >>> Don't you need some magic around helper calls that read/write
> >>> the time to keep -icount working? I don't understand this but
> >>> Paolo does...
> >>
> >> Let's say I understand the theory (how icount relies on it)
> >> more than the practice (how the targets should do it). :)
> >
> > Heh.  Well, let's say that while I've aped the other targets in
> > how icount is treated in the translator, I have no idea what it
> > is really supposed to accomplish, and so have never used it.
> 
> Well, "what it's supposed to accomplish" is straightforward
> enough, we want to keep a count of cycles executed (and I think
> also maintain determinism, although that I'm less certain about).
> Since we only update the count at the start of each basic block,
> we (potentially) have to stop the basic block where we hit an
> I/O operation which fiddles with the timer. For I/O via memory
> accesses this is all dealt with by the generic code, but where
> the CPU has some instruction which does things with timers not
> via a memory access there needs to be a bit of special casing.
> 
> Look at the way target-i386 and target-mips use gen_io_start()
> and gen_io_end() around x86 io insns and MIPS mtc0. I think
> that what you need is (a) to bracket with gen_io_start/end
> and (b) to end the translation block, but that's really just
> guesswork from the existing code...

I think thats right, you need both.

If you forget the gen_io_start/end calls, you'll notice. Everytime
the timer is read you'll hit the "Bad clock read" from cpus.c.

IIUC, If you dont end the TB after timer reads, the read will return
a time in the future (i.e the insns beyond the read will be accounted
as already executed at the point where you read the time).

For alarm setups, you need to end the TB to get precise deliveries, otherwise
I think you risk executing insns beyond the point when the timer should
have fired. Maybe not so likely unless you're setting timers to very
short intervals though.

Cheers



reply via email to

[Prev in Thread] Current Thread [Next in Thread]