From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH v5 10/13] ARM: KVM: Guest wait-for-interrupts (WFI) support Date: Mon, 12 Dec 2011 19:44:36 +0200 Message-ID: <4EE63D84.1010209@redhat.com> References: <20111211102403.21693.6887.stgit@localhost> <20111211102522.21693.14911.stgit@localhost> <4EE60BCE.6010405@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: android-virt@lists.cs.columbia.edu, kvm@vger.kernel.org, Marc.Zyngier@arm.com, catalin.marinas@arm.com, tech@virtualopensystems.com, peter.maydell@linaro.org To: Christoffer Dall Return-path: Received: from mx1.redhat.com ([209.132.183.28]:45312 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751585Ab1LLRow (ORCPT ); Mon, 12 Dec 2011 12:44:52 -0500 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On 12/12/2011 06:20 PM, Christoffer Dall wrote: > >> > >> +/** > >> + * kvm_handle_wfi - handle a wait-for-interrupts instruction executed by a guest > >> + * @vcpu: the vcpu pointer > >> + * @run: the kvm_run structure pointer > >> + * > >> + * Simply sets the wait_for_interrupts flag on the vcpu structure, which will > >> + * halt execution of world-switches and schedule other host processes until > >> + * there is an incoming IRQ or FIQ to the VM. > >> + */ > >> int kvm_handle_wfi(struct kvm_vcpu *vcpu, struct kvm_run *run) > >> { > >> + trace_kvm_wfi(vcpu->arch.regs.pc); > >> + if (!vcpu->arch.virt_irq) > >> + vcpu->arch.wait_for_interrupts = 1; > > > > Why not just block here? > > > > well, if we block, but receive a signal that we want to go back into > userspace for, and then come back but the guest should still be > waiting, then I want that flag set, and I think it's the most logical > control flow. Am I missing something completely? That's just not the flow that the other archs use, I don't think that it really matters. kvm_vcpu_block() checks for and wakes up on signals, so it's okay to call it from here directly. -- error compiling committee.c: too many arguments to function