From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: Accessing host TSC from a guest kernel Date: Sun, 26 Sep 2010 12:36:54 +0200 Message-ID: <4C9F2246.209@redhat.com> References: <4C9C11C7.70202@klipix.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Julien Desfossez Return-path: Received: from mx1.redhat.com ([209.132.183.28]:35430 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756828Ab0IZKhB (ORCPT ); Sun, 26 Sep 2010 06:37:01 -0400 In-Reply-To: <4C9C11C7.70202@klipix.org> Sender: kvm-owner@vger.kernel.org List-ID: On 09/24/2010 04:49 AM, Julien Desfossez wrote: > Hello, > > I'd like to access the host TSC from the inside of a guest kernel and I > don't really know if it's possible. > > I'm working with kvm_clock and I have been playing with the > pvclock_vcpu_time_info structure, but I'm not sure if I'm in the right > direction. > > So could you tell me if there is an efficient way to access to access > the host TSC (or at least the TSC_OFFSET) from a module inside a guest > kernel ? > > I did it with an hypercall, but it's for tracing purpose and doing an > hypercall every time I want to record an event, is way too costly. > > It isn't possible. If you need a coherent host/guest timestamp, I suggest using ktime_get(). -- error compiling committee.c: too many arguments to function