From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] kvm-vmx: add module parameter to avoid trapping HLT instructions (v2) Date: Fri, 03 Dec 2010 11:36:52 +0200 Message-ID: <4CF8BA34.1000508@redhat.com> References: <1291298357-5695-1-git-send-email-aliguori@us.ibm.com> <20101202173733.GA26342@amt.cnet> <4CF7EE63.40209@codemonkey.ws> <20101202201223.GA31316@amt.cnet> <4CF806E7.1090404@codemonkey.ws> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , kvm@vger.kernel.org, Chris Wright , Srivatsa Vaddagiri To: Anthony Liguori Return-path: Received: from mx1.redhat.com ([209.132.183.28]:65446 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932126Ab0LCJhF (ORCPT ); Fri, 3 Dec 2010 04:37:05 -0500 In-Reply-To: <4CF806E7.1090404@codemonkey.ws> Sender: kvm-owner@vger.kernel.org List-ID: On 12/02/2010 10:51 PM, Anthony Liguori wrote: >> VCPU in HLT state only allows injection of certain events that >> would be delivered on HLT. #PF is not one of them. > > But you can't inject an exception into a guest while the VMCS is > active, can you? No, but this is irrelevant. > So the guest takes an exit while in the hlt instruction but that's no > different than if the guest has been interrupted because of hlt exiting. hlt exiting doesn't leave vcpu in the halted state (since hlt has not been executed). So currently we never see a vcpu in halted state. > >> You'd have to handle this situation on event injection, vmentry fails >> otherwise. Or perhaps clear HLT state on vmexit and vmentry. > > So this works today because on a hlt exit, emulate_halt() will clear > the the HLT state which then puts the the vcpu into a state where it > can receive an exception injection? The halt state is never entered. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.