From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v2 4/9] KVM: arm/arm64: replace vcpu->arch.pause with a vcpu request Date: Tue, 4 Apr 2017 20:59:16 +0200 Message-ID: <3fc1cc66-89f3-f495-b64c-c9ec4f26e74c@redhat.com> References: <20170331160658.4331-1-drjones@redhat.com> <20170331160658.4331-5-drjones@redhat.com> <20170404160417.GN11752@cbox> <06b2a225-192c-9c96-c092-6e0575dd9410@redhat.com> <20170404171953.GP11752@cbox> <20170404181829.ipzlym4tm2r5s2fm@kamzik.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: marc.zyngier@arm.com, Christoffer Dall , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org To: Andrew Jones Return-path: In-Reply-To: <20170404181829.ipzlym4tm2r5s2fm@kamzik.brq.redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu List-Id: kvm.vger.kernel.org On 04/04/2017 20:18, Andrew Jones wrote: >> My understanding is that KVM-ARM is using KVM_REQ_VCPU_EXIT simply to >> reuse the smp_call_function_many code in kvm_make_all_cpus_request. >> Once you add EXITING_GUEST_MODE, ARM can just add a new function >> kvm_kick_all_cpus and use it for both pause and power_off. > > I was wondering about the justification of > 'if (vcpu->mode == EXITING_GUEST_MODE)' in the x86 code, as it seemed > redundant to me with the requests. I'll have another think on it to see > if request-less kicks can be satisfied in all cases by this, as long as we > have the mode setting, barrier, mode checking order ensured in vcpu run. Yes, this is the justification. You should add that to kvm_arch_vcpu_ioctl_run to close the race window (as well as the kvm_request_pending, just for good measure). These two are not really optional, they are part of how kvm_vcpu_exiting_guest_mode and requests are supposed to work. kvm_vcpu_exiting_guest_mode is optional, but ARM is using it and it's a pity to undo it. Once you have done this, you can choose whether to use requests or not for pause and poweroff, but I think it will not be necessary. Paolo