From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zachary Amsden Subject: Re: [PATCH 11/17] Fix a possible backwards warp of kvmclock Date: Wed, 16 Jun 2010 12:38:30 -1000 Message-ID: <4C195266.5010000@redhat.com> References: <1276587259-32319-1-git-send-email-zamsden@redhat.com> <1276587259-32319-12-git-send-email-zamsden@redhat.com> <4C18872E.4030105@redhat.com> <20100616135845.GM19104@mothafucka.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Jason Wang , avi@redhat.com, mtosatti@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org To: Glauber Costa Return-path: In-Reply-To: <20100616135845.GM19104@mothafucka.localdomain> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 06/16/2010 03:58 AM, Glauber Costa wrote: > On Wed, Jun 16, 2010 at 04:11:26PM +0800, Jason Wang wrote: > >> Zachary Amsden wrote: >> >>> Kernel time, which advances in discrete steps may progress much slower >>> than TSC. As a result, when kvmclock is adjusted to a new base, the >>> apparent time to the guest, which runs at a much higher, nsec scaled >>> rate based on the current TSC, may have already been observed to have >>> a larger value (kernel_ns + scaled tsc) than the value to which we are >>> setting it (kernel_ns + 0). >>> >>> >> This is one issue of kvmclock which tries to supply a clocksource whose >> precision may even higher than host. >> > What if we export to the guest the current clock resolution, and when doing guest > reads, simply chop whatever value we got to the lowest acceptable value? > I considered it, but it still doesn't solve the problem, at least, not without adding TSC trap and emulate. If you can see a higher resolution clock advance faster than the resolution of the kernel, you still have the problem, and any visible TSC will do that.