From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH] kvm-vmx: add module parameter to avoid trapping HLT instructions (v2) Date: Thu, 02 Dec 2010 16:27:56 -0600 Message-ID: <4CF81D6C.6070202@linux.vnet.ibm.com> References: <1291298357-5695-1-git-send-email-aliguori@us.ibm.com> <20101202191416.GQ10050@sequoia.sous-sol.org> <20101202204016.GB31316@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Chris Wright , kvm@vger.kernel.org, Avi Kivity , Srivatsa Vaddagiri To: Marcelo Tosatti Return-path: Received: from e31.co.us.ibm.com ([32.97.110.149]:40083 "EHLO e31.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757274Ab0LBW2E (ORCPT ); Thu, 2 Dec 2010 17:28:04 -0500 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by e31.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id oB2MEYnP014390 for ; Thu, 2 Dec 2010 15:14:34 -0700 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id oB2MS1HS175740 for ; Thu, 2 Dec 2010 15:28:01 -0700 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id oB2MRxCO018358 for ; Thu, 2 Dec 2010 15:28:00 -0700 In-Reply-To: <20101202204016.GB31316@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On 12/02/2010 02:40 PM, Marcelo Tosatti wrote: > Consuming the timeslice outside guest mode is less intrusive and easier > to replace. Something like this should work? > > if (vcpu->arch.mp_state == KVM_MP_STATE_HALTED) { > while (!need_resched()) > default_idle(); > } > > But you agree this is no KVM business. > My initial inclination is that this would be inappropriate for KVM but I think I'm slowly convincing myself otherwise. Ultimately, hard limits and deterministic scheduling are related goals but not quite the same. A hard limit is very specific, you want to receive no more than an exit amount of CPU time per VCPU With deterministic scheduling, you want to make sure that a set of VMs are not influenced by each other's behavior. You want hard limits when you want to hide the density/capacity of a node from the end customer. You want determinism when you simply want to isolate the performance of each customer from the other customers. That is, the only thing that should affect the performance graph of a VM is how many neighbors it has (which is controlled by management software) rather than what its neighbors are doing. If you have hard limits, you can approximate deterministic scheduling but it's complex in the face of changing numbers of guests. Additionally, hard limits present issues with directed yield that don't exist with a deterministic scheduling approach. You can still donate your time slice to another VCPU because the VCPUs are not actually capped. That may mean that an individual VCPU gets more PCPU time than an exact division but for the VM overall, it won't get more than it's total share. So the principle of performance isolation for the guest isn't impacted. Regards, Anthony Liguori