Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933538AbbBCBVK (ORCPT ); Mon, 2 Feb 2015 20:21:10 -0500 Received: from mga14.intel.com ([192.55.52.115]:55126 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933302AbbBCBVI (ORCPT ); Mon, 2 Feb 2015 20:21:08 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,509,1418112000"; d="scan'208";a="646433464" From: "Zhang, Yang Z" To: Paolo Bonzini , Wincy Van CC: "gleb@kernel.org" , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , Wanpeng Li , Jan Kiszka Subject: RE: [PATCH v4 6/6] KVM: nVMX: Enable nested posted interrupt processing Thread-Topic: [PATCH v4 6/6] KVM: nVMX: Enable nested posted interrupt processing Thread-Index: AQHQPtfflTQDa6kOj06lAxxniiIk35zc90SAgAALdgCAARrCgA== Date: Tue, 3 Feb 2015 01:21:00 +0000 Message-ID: References: <54CF5971.8090407@redhat.com> <54CFA24C.4080806@redhat.com> In-Reply-To: <54CFA24C.4080806@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id t131LGWs006780 Content-Length: 1641 Lines: 46 Paolo Bonzini wrote on 2015-02-03: > > > On 02/02/2015 16:33, Wincy Van wrote: >> static void vmx_accomp_nested_posted_intr(struct kvm_vcpu *vcpu) { >> struct vcpu_vmx *vmx = to_vmx(vcpu); >> >> if (is_guest_mode(vcpu) && >> vmx->nested.posted_intr_nv != -1 && >> pi_test_on(vmx->nested.pi_desc)) >> kvm_apic_set_irr(vcpu, >> vmx->nested.posted_intr_nv); } >> Then we will get an nested-vmexit in vmx_check_nested_events, that >> posted intr will be handled by L1 immediately. >> This mechanism will also emulate the hardware's behavior: If a >> posted intr was not accomplished by hardware, we will get an Actually, we cannot say "not accomplished by hardware". It more like we don't do the job well. See my below answer. >> interrupt with POSTED_INTR_NV. > > Yes. This is not enough. From L1's point, L2 is in vmx non-root mode. So we should emulate the posted interrupt in L0 correctly, say: 1. clear ON bit 2. ack interrupt 3, syn pir to virr 4. update RVI. Then let the hardware(virtual interrupt delivery) to accomplish interrupt injection. Force a vmexit more like a trick. It's better to follow the hardware's behavior unless we cannot do it. > >> Would this be better? > > I think you do not even need a new bit. You can use KVM_REQ_EVENT and > (to complete my suggestion, which was not enough) do the above in > vmx_check_nested_events. > > Paolo Best regards, Yang ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?