Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset

2013-12-12 Thread Paolo Bonzini
Il 12/12/2013 03:52, Fernando Luis Vázquez Cao ha scritto: On 12/09/2013 05:50 PM, Fernando Luis Vázquez Cao wrote: On 12/06/2013 11:22 PM, Marcelo Tosatti wrote: On Fri, Dec 06, 2013 at 05:24:18PM +0900, Fernando Luis Vázquez Cao wrote: I also wanted to make sure that the initialization that

Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset

2013-12-11 Thread Fernando Luis Vázquez Cao
On 12/09/2013 05:50 PM, Fernando Luis Vázquez Cao wrote: On 12/06/2013 11:22 PM, Marcelo Tosatti wrote: On Fri, Dec 06, 2013 at 05:24:18PM +0900, Fernando Luis Vázquez Cao wrote: I also wanted to make sure that the initialization that we do in kvm_arch_vcpu_postcreate on power up and the

Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset

2013-12-09 Thread Fernando Luis Vázquez Cao
On 12/06/2013 11:22 PM, Marcelo Tosatti wrote: On Fri, Dec 06, 2013 at 05:24:18PM +0900, Fernando Luis Vázquez Cao wrote: I also wanted to make sure that the initialization that we do in kvm_arch_vcpu_postcreate on power up and the subsequent TSC writeback work well together, but I didn't have

Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset

2013-12-06 Thread Fernando Luis Vázquez Cao
On 12/06/2013 01:38 AM, Paolo Bonzini wrote: Il 05/12/2013 17:17, Marcelo Tosatti ha scritto: 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

Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset

2013-12-06 Thread Paolo Bonzini
Il 06/12/2013 09:24, Fernando Luis Vázquez Cao ha scritto: Could we start with the patch that I already sent? It's been tested, it is conservative in the sense that it does the minimum necessary to fix an existing bug, and should be easy to backport. I will be replying to this email with an

Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset

2013-12-06 Thread Fernando Luis Vázquez Cao
On 12/06/2013 05:36 PM, Paolo Bonzini wrote: Il 06/12/2013 09:24, Fernando Luis Vázquez Cao ha scritto: Could we start with the patch that I already sent? It's been tested, it is conservative in the sense that it does the minimum necessary to fix an existing bug, and should be easy to backport.

Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset

2013-12-06 Thread Paolo Bonzini
Il 06/12/2013 09:56, Fernando Luis Vázquez Cao ha scritto: I will also be sending a patch that makes the TSC writeback unconditional, but this one should probably be kept on hold until it is properly tested. If you test it, I can drop the if myself from your patch. Unfortunately I will

Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset

2013-12-06 Thread Fernando Luis Vazquez Cao
On 2013年12月06日 18:08, Paolo Bonzini wrote: Il 06/12/2013 09:56, Fernando Luis Vázquez Cao ha scritto: I will also be sending a patch that makes the TSC writeback unconditional, but this one should probably be kept on hold until it is properly tested. If you test it, I can drop the if myself

Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset

2013-12-06 Thread Marcelo Tosatti
On Fri, Dec 06, 2013 at 05:24:18PM +0900, Fernando Luis Vázquez Cao wrote: On 12/06/2013 01:38 AM, Paolo Bonzini wrote: Il 05/12/2013 17:17, Marcelo Tosatti ha scritto: 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

Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset

2013-12-05 Thread Paolo Bonzini
Il 05/12/2013 07:15, Fernando Luis Vázquez Cao ha scritto: VCPU TSC is not cleared by a warm reset (*), which leaves many Linux guests vulnerable to the overflow in cyc2ns_offset fixed by upstream commit 9993bc635d01a6ee7f6b833b4ee65ce7c06350b1 (sched/x86: Fix overflow in cyc2ns_offset). To

Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset

2013-12-05 Thread Fernando Luis Vazquez Cao
(2013/12/05 18:28), Paolo Bonzini wrote: Il 05/12/2013 07:15, Fernando Luis Vázquez Cao ha scritto: VCPU TSC is not cleared by a warm reset (*), which leaves many Linux guests vulnerable to the overflow in cyc2ns_offset fixed by upstream commit 9993bc635d01a6ee7f6b833b4ee65ce7c06350b1

Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset

2013-12-05 Thread Paolo Bonzini
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

Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset

2013-12-05 Thread Fernando Luis Vazquez Cao
(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

Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset

2013-12-05 Thread Paolo Bonzini
Il 05/12/2013 16:42, Fernando Luis Vazquez Cao ha scritto: (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,

Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset

2013-12-05 Thread Marcelo Tosatti
On Thu, Dec 05, 2013 at 10:28:18AM +0100, Paolo Bonzini wrote: Il 05/12/2013 07:15, Fernando Luis Vázquez Cao ha scritto: VCPU TSC is not cleared by a warm reset (*), which leaves many Linux guests vulnerable to the overflow in cyc2ns_offset fixed by upstream commit

Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset

2013-12-05 Thread Marcelo Tosatti
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.

Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset

2013-12-05 Thread Paolo Bonzini
Il 05/12/2013 17:12, Marcelo Tosatti ha scritto: - call kvm_set_ticks() from cpu_set_ticks() and cpu_enable_ticks() env-tsc is just a placeholder for the vcpu TSC. A vcpus TSC from QEMU's point of view is a register initialized to zero, which requires read/write from KVM, and migration.

Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset

2013-12-05 Thread Paolo Bonzini
Il 05/12/2013 17:17, Marcelo Tosatti ha scritto: 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

Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset

2013-12-05 Thread Marcelo Tosatti
On Thu, Dec 05, 2013 at 05:02:02PM +0100, Paolo Bonzini wrote: Il 05/12/2013 16:42, Fernando Luis Vazquez Cao ha scritto: (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

Re: [Qemu-devel] [PATCH] target-i386: clear guest TSC on reset

2013-12-05 Thread Marcelo Tosatti
On Thu, Dec 05, 2013 at 02:40:00PM -0200, Marcelo Tosatti wrote: On Thu, Dec 05, 2013 at 05:02:02PM +0100, Paolo Bonzini wrote: Il 05/12/2013 16:42, Fernando Luis Vazquez Cao ha scritto: (2013/12/05 22:53), Paolo Bonzini wrote: Il 05/12/2013 14:15, Fernando Luis Vazquez Cao ha scritto:

[Qemu-devel] [PATCH] target-i386: clear guest TSC on reset

2013-12-04 Thread Fernando Luis Vázquez Cao
VCPU TSC is not cleared by a warm reset (*), which leaves many Linux guests vulnerable to the overflow in cyc2ns_offset fixed by upstream commit 9993bc635d01a6ee7f6b833b4ee65ce7c06350b1 (sched/x86: Fix overflow in cyc2ns_offset). To put it in a nutshell, if a Linux guest without the patch above