From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Roedel Subject: Re: [PATCH] kvm-vmx: add module parameter to avoid trapping HLT instructions (v3) Date: Sat, 4 Dec 2010 09:53:47 +0100 Message-ID: <20101204085347.GB29502@8bytes.org> References: <1291415962-13762-1-git-send-email-aliguori@us.ibm.com> <20101203233231.GA29502@8bytes.org> <4CF97F5E.3000704@codemonkey.ws> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Anthony Liguori , kvm@vger.kernel.org, Avi Kivity , Marcelo Tosatti , Chris Wright , Srivatsa Vaddagiri To: Anthony Liguori Return-path: Received: from 8bytes.org ([88.198.83.132]:45703 "EHLO 8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751151Ab0LDIxs (ORCPT ); Sat, 4 Dec 2010 03:53:48 -0500 Content-Disposition: inline In-Reply-To: <4CF97F5E.3000704@codemonkey.ws> Sender: kvm-owner@vger.kernel.org List-ID: On Fri, Dec 03, 2010 at 05:38:06PM -0600, Anthony Liguori wrote: > On 12/03/2010 05:32 PM, Joerg Roedel wrote: >> On Fri, Dec 03, 2010 at 04:39:22PM -0600, Anthony Liguori wrote: >> >>> + if (yield_on_hlt) >>> + min |= CPU_BASED_HLT_EXITING; >>> >> This approach won't work out on AMD because in HLT the CPU may enter >> C1e. In C1e the local apic timer interupt is not delivered anymore and >> when this is the current timer in use the cpu may miss timer ticks or >> never comes out of HLT again. The guest has no chance to work around >> this as the Linux idle routine does. >> > > And this doesn't break old software on bare metal? Yes it does. In fact, this behavior is documented as Erratum 400 for AMD CPUs. Linux has a workaround for it for quite some time. You can have a look at the c1e_idle routine for details. C1e can also be disabled by the OS. But there are BIOSes which re-enable it in SMI. So there is the chance that it gets re-enabled whithout an vmexit. Joerg