[PATCH] ensure guest's kvmclock never goes backwards when TSC jumps backward

2014-07-16 Thread Igor Mammedov
There are buggy hosts in the wild that advertise invariant TSC and as result host uses TSC as clocksource, but TSC on such host sometimes sporadically jumps backwards. This causes kvmclock to go backwards if host advertises PVCLOCK_TSC_STABLE_BIT, which turns off aggregated clock accumulator and

Re: [PATCH] ensure guest's kvmclock never goes backwards when TSC jumps backward

2014-07-16 Thread Paolo Bonzini
Il 16/07/2014 11:52, Igor Mammedov ha scritto: There are buggy hosts in the wild that advertise invariant TSC and as result host uses TSC as clocksource, but TSC on such host sometimes sporadically jumps backwards. This causes kvmclock to go backwards if host advertises PVCLOCK_TSC_STABLE_BIT,

Re: [PATCH] ensure guest's kvmclock never goes backwards when TSC jumps backward

2014-07-16 Thread Marcelo Tosatti
On Wed, Jul 16, 2014 at 12:18:37PM +0200, Paolo Bonzini wrote: Il 16/07/2014 11:52, Igor Mammedov ha scritto: There are buggy hosts in the wild that advertise invariant TSC and as result host uses TSC as clocksource, but TSC on such host sometimes sporadically jumps backwards. This causes

Re: [PATCH] ensure guest's kvmclock never goes backwards when TSC jumps backward

2014-07-16 Thread Igor Mammedov
On Wed, 16 Jul 2014 08:41:00 -0300 Marcelo Tosatti mtosa...@redhat.com wrote: On Wed, Jul 16, 2014 at 12:18:37PM +0200, Paolo Bonzini wrote: Il 16/07/2014 11:52, Igor Mammedov ha scritto: There are buggy hosts in the wild that advertise invariant TSC and as result host uses TSC as

Re: [PATCH] ensure guest's kvmclock never goes backwards when TSC jumps backward

2014-07-16 Thread Paolo Bonzini
Il 16/07/2014 15:55, Igor Mammedov ha scritto: On Wed, 16 Jul 2014 08:41:00 -0300 Marcelo Tosatti mtosa...@redhat.com wrote: On Wed, Jul 16, 2014 at 12:18:37PM +0200, Paolo Bonzini wrote: Il 16/07/2014 11:52, Igor Mammedov ha scritto: There are buggy hosts in the wild that advertise

Re: [PATCH] ensure guest's kvmclock never goes backwards when TSC jumps backward

2014-07-16 Thread Igor Mammedov
On Wed, 16 Jul 2014 16:16:17 +0200 Paolo Bonzini pbonz...@redhat.com wrote: Il 16/07/2014 15:55, Igor Mammedov ha scritto: On Wed, 16 Jul 2014 08:41:00 -0300 Marcelo Tosatti mtosa...@redhat.com wrote: On Wed, Jul 16, 2014 at 12:18:37PM +0200, Paolo Bonzini wrote: Il 16/07/2014 11:52,

Re: [PATCH] ensure guest's kvmclock never goes backwards when TSC jumps backward

2014-07-16 Thread Paolo Bonzini
Il 16/07/2014 16:51, Igor Mammedov ha scritto: I'm not sure that a per-CPU value is enough; your patch can make the problem much less frequent of course, but I'm not sure neither detection nor correction are 100% reliable. Your addition is basically a faster but less reliable version of the

Re: [PATCH] ensure guest's kvmclock never goes backwards when TSC jumps backward

2014-07-16 Thread Igor Mammedov
On Wed, 16 Jul 2014 16:55:37 +0200 Paolo Bonzini pbonz...@redhat.com wrote: Il 16/07/2014 16:51, Igor Mammedov ha scritto: I'm not sure that a per-CPU value is enough; your patch can make the problem much less frequent of course, but I'm not sure neither detection nor correction are 100%