From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: kvm guest loops_per_jiffy miscalibration under host load Date: Mon, 07 Jul 2008 14:21:45 -0500 Message-ID: <48726CC9.1070008@us.ibm.com> References: <20080702164021.GA31751@dmt.cnet> <486CD151.8020004@redhat.com> <487177CB.60104@us.ibm.com> <5d6222a80807071127s1ed157eaje2f1fcf511a34813@mail.gmail.com> <20080707184843.GA14634@dmt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Glauber Costa , Glauber Costa , kvm-devel , kraxel@redhat.com, chrisw@redhat.com To: Marcelo Tosatti Return-path: Received: from e31.co.us.ibm.com ([32.97.110.149]:55452 "EHLO e31.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754723AbYGGTWI (ORCPT ); Mon, 7 Jul 2008 15:22:08 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e31.co.us.ibm.com (8.13.8/8.13.8) with ESMTP id m67JM7qR021697 for ; Mon, 7 Jul 2008 15:22:07 -0400 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m67JM7Ps164532 for ; Mon, 7 Jul 2008 13:22:07 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m67JM65f018373 for ; Mon, 7 Jul 2008 13:22:06 -0600 In-Reply-To: <20080707184843.GA14634@dmt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: Marcelo Tosatti wrote: > On Mon, Jul 07, 2008 at 03:27:16PM -0300, Glauber Costa wrote: > >>> I agree. A paravirt solution solves the problem. >>> >> Please, look at the patch I've attached. >> >> It does __delay with host help. This may have the nice effect of not >> busy waiting for long-enough delays, and may well. >> >> It is _completely_ PoC, just to show the idea. It's ugly, broken, >> obviously have to go through pv-ops, etc. >> >> Also, I intend to add a lpj field in the kvm clock memory area. We >> could do just this later, do both, etc. >> >> If we agree this is a viable solution, I'll start working on a patch >> > > This stops interrupts from being processed during the delay. And also > there are cases like this recently introduced break: > > /* Allow RT tasks to run */ > preempt_enable(); > rep_nop(); > preempt_disable(); > > I think it would be better to just pass the lpj value via paravirt and > let the guest busy-loop as usual. > I agree. VMI and Xen already pass a cpu_khz paravirt value. Something similar would probably do the trick. It may be worthwhile having udelay() or spinlocks call into KVM if they've been spinning long enough but I think that's a separate discussion. Regards, Anthony Liguori