Re: [PATCH v2 4/6] KVM-GST: KVM Steal time registration

2011-02-01 Thread Glauber Costa
On Sun, 2011-01-30 at 15:16 +0200, Avi Kivity wrote: On 01/28/2011 09:52 PM, Glauber Costa wrote: Register steal time within KVM. Everytime we sample the steal time information, we update a local variable that tells what was the last time read. We then account the difference.

Re: [PATCH v2 4/6] KVM-GST: KVM Steal time registration

2011-02-01 Thread Peter Zijlstra
On Tue, 2011-02-01 at 13:53 -0200, Glauber Costa wrote: And since the granularity of the cpu accounting is too coarse, we end up with much more steal time than we should, because things that are less than 1 unity of cputime, are often rounded up to 1 unity of cputime. See, that! is the

Re: [PATCH v2 4/6] KVM-GST: KVM Steal time registration

2011-02-01 Thread Glauber Costa
See, that! is the problem, don't round up like that. Yeah, I was using usecs_to_cputime(), believing this was the standard interface. By the way, one of the things that also led to better results were just forcing it to 0 every time we had steal == 1 in the end. But *that* was a real hack =)

Re: [PATCH v2 4/6] KVM-GST: KVM Steal time registration

2011-02-01 Thread Peter Zijlstra
On Tue, 2011-02-01 at 15:00 -0200, Glauber Costa wrote: What you can do is: steal_ticks = steal_time_clock() / TICK_NSEC, or simply keep a steal time delta and every time it overflows cputime_one_jiffy insert a steal-time tick. What do you think about keeping accounting in msec/usec

Re: [PATCH v2 4/6] KVM-GST: KVM Steal time registration

2011-02-01 Thread Venkatesh Pallipadi
On Tue, Feb 1, 2011 at 9:44 AM, Peter Zijlstra pet...@infradead.org wrote: On Tue, 2011-02-01 at 15:00 -0200, Glauber Costa wrote: What you can do is: steal_ticks = steal_time_clock() / TICK_NSEC, or simply keep a steal time delta and every time it overflows cputime_one_jiffy insert a

Re: [PATCH v2 4/6] KVM-GST: KVM Steal time registration

2011-01-31 Thread Peter Zijlstra
On Fri, 2011-01-28 at 14:52 -0500, Glauber Costa wrote: + /* +* using nanoseconds introduces noise, which accumulates easily +* leading to big steal time values. We want, however, to keep the +* interface nanosecond-based for future-proofness. The hypervisor may

Re: [PATCH v2 4/6] KVM-GST: KVM Steal time registration

2011-01-30 Thread Avi Kivity
On 01/28/2011 09:52 PM, Glauber Costa wrote: Register steal time within KVM. Everytime we sample the steal time information, we update a local variable that tells what was the last time read. We then account the difference. static void kvm_guest_cpu_offline(void *dummy) {

[PATCH v2 4/6] KVM-GST: KVM Steal time registration

2011-01-28 Thread Glauber Costa
Register steal time within KVM. Everytime we sample the steal time information, we update a local variable that tells what was the last time read. We then account the difference. Signed-off-by: Glauber Costa glom...@redhat.com CC: Rik van Riel r...@redhat.com CC: Jeremy Fitzhardinge

Re: [PATCH v2 4/6] KVM-GST: KVM Steal time registration

2011-01-28 Thread Rik van Riel
On 01/28/2011 02:52 PM, Glauber Costa wrote: Register steal time within KVM. Everytime we sample the steal time information, we update a local variable that tells what was the last time read. We then account the difference. Signed-off-by: Glauber Costaglom...@redhat.com CC: Rik van