> 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 would agree this is the issue. I was thinking that the timer ran in the same 
thread as the CPU (thus preventing the two from running at the same time) but 
I guess this is not true. There must be some sync point, because taking too 
long to finish the timer makes things stall (or that may just be due to 
causing a delay in delivery of the next interrupt.)

So I guess what I am looking for is a way to ensure the two run mutually 
exclusive of each other. I know from other systems that we can run all this in 
a single thread (hardware models and guest CPU) so it should be possible to do 
in QEMU as well.

Steven




Reply via email to