> Subject: Re: [Qemu-devel] about the patch kvmclock Ensure proper env->tsc
> value for kvmclock_current_nsec calculation
> 
> >      Thanks for your reply, I have read the thread in your email, what's the
> mean of 'switching from old to new disk', could give a detail description?
> 
> The test case was like that (using libvirt):
> 
> 1. Get VM running (linux, using kvmclock), 2. Use blockcopy to copy disk data
> from one location to another, 3. Issue blockjob --pivot (to finish mirroring)
> 
>  From what I remember, at point 3, VM is momentarily paused and resumed,
> so kvm state change handler is called twice. Without this patch, the VM
> hanged because its time goes backwards (or qemu crashed if assertion was
> not compiled out).
> 
> --
> mg

So, the problem is cause by stop_vm(RUN_STATE_PAUSED), in this case the 
env->tsc is not updated, which lead to the issue. 
Is that right?  If the cpu_clean_all_dirty() is needed just for the APIC status 
reason, I think we can do the cpu_synchronize_all_states() in do_vm_stop
and after vm_state_notify() when the RUN_STATE_PAUSED is hit, at this point all 
the device models is stopped, there is no outdated APIC status.  

I want to write a patch to fix this issue in another way, could help to verify 
it in you environment, very appreciate if you could.

Thanks.

Liang

Reply via email to