[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset
From: |
Marcelo Tosatti |
Subject: |
Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset |
Date: |
Thu, 5 Dec 2013 14:17:07 -0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Fri, Dec 06, 2013 at 12:42:44AM +0900, Fernando Luis Vazquez Cao wrote:
> (2013/12/05 22:53), Paolo Bonzini wrote:
> > Il 05/12/2013 14:15, Fernando Luis Vazquez Cao ha scritto:
> >> /*
> >> * KVM is yet unable to synchronize TSC values of multiple VCPUs
> >> on
> >> * writeback. Until this is fixed, we only write the offset to SMP
> >> * guests after migration, desynchronizing the VCPUs, but avoiding
> >> * huge jump-backs that would occur without any writeback at all.
> >> */
> >> - if (smp_cpus == 1 || env->tsc != 0) {
> >> + if (smp_cpus == 1 || env->tsc != 0 || level ==
> >> KVM_PUT_RESET_STATE) {
> >> kvm_msr_entry_set(&msrs[n++], MSR_IA32_TSC, env->tsc);
> >> }
> > This is still a bit ugly, and desynchronizes the VCPUs on reset.
>
> I agree it is a bit ugly, but in my testing QEMU seemed to loop over all
> the VCPUS fast enough for the kernel side kvm_write_tsc() to do a
> reasonable job of matching the offsets (the Linux guest did not mark
> the TSC unstable due to the TSCs being unsynchronized). Am I missing
> something?
Right, modern kernels (see kvm_write_tsc) perform synchronization, so in
theory the "KVM is yet unable to synchronize ..." code is not necessary
anymore.
I vote for dropping the thing entirely.
> > The main point of my outlined solution is that you only have one value
> > that is tracked, not one per VCPU (which in the case of migration adds
> > unpredictable latencies---for example due to emptying the migration
> > buffers). We already save that value; all that's left is to use it
> > instead of env->tsc.
>
> I understand the benefits of what you are proposing but, since it is
> wider is scope and it would be more difficult to backport, I would
> prefer to implement it as a follow-up patch, unless you think that
> the current patch as a standalone fix does more harm than good.
>
> - Fernando
- Re: [Qemu-devel] [PATCH] kvm: clear guest TSC on reset, Fernando Luis Vázquez Cao, 2013/12/05
- [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset, Fernando Luis Vázquez Cao, 2013/12/05
- Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset, Paolo Bonzini, 2013/12/05
- Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset, Fernando Luis Vazquez Cao, 2013/12/05
- Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset, Paolo Bonzini, 2013/12/05
- Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset, Fernando Luis Vazquez Cao, 2013/12/05
- Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset, Paolo Bonzini, 2013/12/05
- Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset, Marcelo Tosatti, 2013/12/05
- Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset, Marcelo Tosatti, 2013/12/05
- Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset,
Marcelo Tosatti <=
- Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset, Paolo Bonzini, 2013/12/05
- Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset, Fernando Luis Vázquez Cao, 2013/12/06
- [Qemu-devel] [PATCH 1//2 v3] target-i386: clear guest TSC on reset, Fernando Luis Vázquez Cao, 2013/12/06
- [Qemu-devel] [PATCH 2/2] target-i386: do not special case TSC writeback, Fernando Luis Vázquez Cao, 2013/12/06
- Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset, Paolo Bonzini, 2013/12/06
- Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset, Fernando Luis Vázquez Cao, 2013/12/06
- Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset, Paolo Bonzini, 2013/12/06
- Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset, Fernando Luis Vazquez Cao, 2013/12/06
- Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset, Marcelo Tosatti, 2013/12/06
- Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset, Fernando Luis Vázquez Cao, 2013/12/09