From mboxrd@z Thu Jan 1 00:00:00 1970 From: Liran Alon Subject: Re: [PATCH v3 10/11] KVM: nVMX: Wake halted L2 on nested posted-interrupt Date: Wed, 27 Dec 2017 14:01:16 +0200 Message-ID: <5A438B8C.3080109@ORACLE.COM> References: <1514131983-24305-1-git-send-email-liran.alon@oracle.com> <1514131983-24305-11-git-send-email-liran.alon@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: jmattson@google.com, wanpeng.li@hotmail.com, idan.brown@ORACLE.COM, Liam Merwick , Konrad Rzeszutek Wilk To: Paolo Bonzini , rkrcmar@redhat.com, kvm@vger.kernel.org Return-path: Received: from aserp2130.oracle.com ([141.146.126.79]:35093 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750790AbdL0MBc (ORCPT ); Wed, 27 Dec 2017 07:01:32 -0500 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On 27/12/17 13:31, Paolo Bonzini wrote: > On 24/12/2017 17:13, Liran Alon wrote: >> If L1 doesn't intercept L2 HLT (doesn't set CPU_BASED_HLT_EXITING), >> then when L2 executes HLT instruction, KVM will block vCPU from >> further execution (just like what happens when L1 executes HLT). >> >> Thus, when some CPU sends nested-posted-interrupt to a halted >> L2 vCPU, vmx_deliver_nested_posted_interrupt() notes that >> vcpu->mode != IN_GUEST_MODE and therefore doesn't send a physical IPI. >> Because the dest vCPU is blocked by HLT, we should kick it. > > In patch 9, you write "in addition, assume that dest CPU passes the > checks for pending kvm requests before sender sets KVM_REQ_EVENT". But, > this is pretty much the same scenario that you are fixing here (except > without KVM_REQ_EVENT involvement). > > So patch 10 should be placed *before patch 9* and it should do something > like this: > > - kvm_vcpu_trigger_posted_interrupt(vcpu, true); > ... > kvm_make_request(KVM_REQ_EVENT, vcpu); > + if (!kvm_vcpu_trigger_posted_interrupt(vcpu, true)) > + kvm_vcpu_kick(vcpu); > > with patch 9's commit message adjusted. > > Paolo > I think that current patch series makes more sense than reordering them. This is because the patch you are suggesting will actually, as a side-effect, fix the bug that is fixed in commit "KVM: nVMX: Deliver missed nested-PI notification-vector via self-IPI while interrupts disabled". This is actually the same as the first patch I suggested for fixing the bug in v1 of this series: http://lkml.kernel.org/r/1510252040-5609-1-git-send-email-liran.alon@oracle.com After I submitted v1, Radim mentioned that even though the fix is correct, it is awkward and error-prone. I agreed and therefore we have written another fix using self-IPI. Therefore, to preserve each commit fixing only one problem, I prefer to keep the orders of commits as they are now. Regards, -Liran