From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: KVM_EXIT_HALT and KVM_CREATE_IRQCHIP Date: Thu, 10 Jun 2010 13:03:04 +0300 Message-ID: <4C10B858.1020500@redhat.com> References: <4C10B5D8.2040409@cs.helsinki.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: KVM General , Cyrill Gorcunov , Asias He To: Pekka Enberg Return-path: Received: from mx1.redhat.com ([209.132.183.28]:29931 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753703Ab0FJKDQ (ORCPT ); Thu, 10 Jun 2010 06:03:16 -0400 In-Reply-To: <4C10B5D8.2040409@cs.helsinki.fi> Sender: kvm-owner@vger.kernel.org List-ID: On 06/10/2010 12:52 PM, Pekka Enberg wrote: > > How is the guest supposed to halt the hypervisor if KVM_CREATE_IRQCHIP > is being used? The kvm_emulate_halt() function seems to handle the > halt event completely if irqchip_in_kernel() returns true and thus > never exits to the hypervisor. "The hypervisor" is the combination of userspace and kvm. Without KVM_CREATE_IRQCHIP, HLT is emulated in userspace. With KVM_CREATE_IRQCHIP, HLT is emulated in the kernel. Emulating HLT in the kernel results in a faster return from HLT, which occurs frequently. If you need to break out of the kernel, send a signal to the thread that's running the vcpu. That works whether the guest is running or sleeping. > I see there's a KVM_GET_MP_STATE ioctl that can be used to check if > state is KVM_MP_STATE_HALTED but as we never exit to the hypervisor, > how is this supposed to work? Am I missing something obvious here? In general you only rarely want to check the state (example are for debugging and for live migration). It's not a stable value (the guest executing HLT, or a guest interrupt delivered, will change its value). What's your use case? -- error compiling committee.c: too many arguments to function