public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: "Yang, Sheng" <sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [RFC][PATCH 1/2] KVM: In-kernel PIT model
Date: Tue, 22 Jan 2008 15:54:10 +0200	[thread overview]
Message-ID: <4795F582.7050802@qumranet.com> (raw)
In-Reply-To: <200801211718.23664.sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Yang, Sheng wrote:
> +
> +/* Compute with 96 bit intermediate result: (a*b)/c */
> +static u64 muldiv64(u64 a, u32 b, u32 c)
>   

Why do we need such high accuracy for the pit?

> +
> +static int pit_get_out(struct kvm *kvm, int channel)
> +{
> +	struct PITChannelState *c =
> +		&kvm->arch.vpit->pit_state.channels[channel];
> +	struct kvm_vcpu *vcpu = kvm->vcpus[0];
> +	u64 d, t;
> +	int out;
> +
> +	ASSERT(mutex_is_locked(&kvm->arch.vpit->pit_state.lock));
> +
> +	kvm_get_msr(vcpu, MSR_IA32_TIME_STAMP_COUNTER, &t);
> +	d = muldiv64(t - c->count_load_time, PIT_FREQ, cpu_khz * 1000);
>   

I assume this is to correlate the tsc and the pit counters.  Doesn't 
this break with cpu frequency scaling or with vcpu migrations?

What if this is called within the context of vcpu 1?  Not sure 
kvm_get_msr() will work correctly at all.

> +struct PITTimer {
>   
> +
> +struct PITChannelState {
> +
> +struct PITState {
>   

Please use the traditional naming convention (pit_timer, 
pit_channel_state, pit_state)

-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

  parent reply	other threads:[~2008-01-22 13:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-21  9:18 [RFC][PATCH 1/2] KVM: In-kernel PIT model Yang, Sheng
     [not found] ` <200801211718.23664.sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2008-01-21  9:53   ` Jan Kiszka
     [not found]     ` <47946B96.4040508-kv7WeFo6aLtBDgjK7y7TUQ@public.gmane.org>
2008-01-21 10:14       ` Avi Kivity
     [not found]         ` <47947088.5030309-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-21 10:22           ` Jan Kiszka
     [not found]             ` <47947252.7000606-kv7WeFo6aLtBDgjK7y7TUQ@public.gmane.org>
2008-01-21 10:44               ` Avi Kivity
2008-01-21 10:28       ` Carsten Otte
     [not found]         ` <479473D0.7000002-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
2008-01-22  1:15           ` Yang, Sheng
2008-01-22 13:54   ` Avi Kivity [this message]
     [not found]     ` <4795F582.7050802-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-23  6:00       ` Yang, Sheng
     [not found]         ` <200801231400.36063.sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2008-01-23  9:46           ` Avi Kivity
     [not found]             ` <47970CEE.2050000-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-24  9:29               ` Yang, Sheng
     [not found]                 ` <200801241729.18787.sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2008-01-24  9:26                   ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4795F582.7050802@qumranet.com \
    --to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox