From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Roedel Subject: Re: [patch 7/8] Dont mark TSC unstable due to S4 suspend Date: Thu, 9 Feb 2012 15:28:59 +0100 Message-ID: <20120209142859.GO22598@amd.com> References: <20120203174349.110232777@amt.cnet> <20120203174449.321042059@amt.cnet> <20120208151848.GC22598@amd.com> <20120208155646.GB3398@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Cc: , To: Marcelo Tosatti Return-path: Received: from va3ehsobe003.messaging.microsoft.com ([216.32.180.13]:25033 "EHLO VA3EHSOBE007.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753776Ab2BIO3H (ORCPT ); Thu, 9 Feb 2012 09:29:07 -0500 Content-Disposition: inline In-Reply-To: <20120208155646.GB3398@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Feb 08, 2012 at 01:56:46PM -0200, Marcelo Tosatti wrote: > On Wed, Feb 08, 2012 at 04:18:48PM +0100, Joerg Roedel wrote: > > This is not going to work when tsc-scaling is enabled. The > > adjust_tsc_offset_host() function just scales the offset the same way > > the tsc is scaled. But that is broken because the tsc-offset is applied > > _after_ the tsc-ratio by scaling hardware. So to get the desired > > tsc-value in the guest the offset needs to be scaled in the opposite > > direction as the tsc itself. This is rather complicated to implement. > > By saying that "tsc-offset is applied _after_ the tsc-ratio by scaling > hardware" you mean that guest tsc is calculated as > > tsc = host_tsc_value * tsc_ratio > tsc += tsc_offset > > ? > > If so, that means the tsc_offset must be scaled to guest tsc units. > > Which is what both adjust_tsc_offset(host=true) and compute_tsc_offset() > do. > > What am i missing here? Nothing. You are right, bad math on my side. Joerg -- AMD Operating System Research Center Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach General Managers: Alberto Bozzo Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632