From patchwork Wed Sep 23 10:26:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wanpeng Li X-Patchwork-Id: 7248781 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B908E9F380 for ; Wed, 23 Sep 2015 10:29:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E737120A89 for ; Wed, 23 Sep 2015 10:29:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 27D0920AB5 for ; Wed, 23 Sep 2015 10:29:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753728AbbIWK3j (ORCPT ); Wed, 23 Sep 2015 06:29:39 -0400 Received: from blu004-omc1s17.hotmail.com ([65.55.116.28]:59664 "EHLO BLU004-OMC1S17.hotmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753670AbbIWK3h (ORCPT ); Wed, 23 Sep 2015 06:29:37 -0400 Received: from BLU437-SMTP8 ([65.55.116.8]) by BLU004-OMC1S17.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Wed, 23 Sep 2015 03:29:37 -0700 X-TMN: [1zPSY9ik55fp5uswJ443AbwOXfj+KMsH] X-Originating-Email: [wanpeng.li@hotmail.com] Message-ID: From: Wanpeng Li To: Paolo Bonzini CC: Jan Kiszka , Bandan Das , Wincy Van , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Wanpeng Li Subject: [PATCH 2/2] KVM: nVMX: fix flush vpid01 during nested vmentry/vmexit Date: Wed, 23 Sep 2015 18:26:58 +0800 X-Mailer: git-send-email 1.9.1 In-Reply-To: <1443004018-45326-1-git-send-email-wanpeng.li@hotmail.com> References: <1443004018-45326-1-git-send-email-wanpeng.li@hotmail.com> X-OriginalArrivalTime: 23 Sep 2015 10:29:35.0907 (UTC) FILETIME=[BE633730:01D0F5EA] MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP vpid_sync_vcpu_single() still handles vpid01 during nested vmentry/vmexit since vmx->vpid is used for invvpid. This patch fix it by specific the vpid02 through __vmx_flush_tlb() to flush the right vpid. Signed-off-by: Wanpeng Li --- arch/x86/kvm/vmx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 7188c5e..31fb631 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -7207,7 +7207,7 @@ static int handle_invvpid(struct kvm_vcpu *vcpu) case VMX_VPID_EXTENT_INDIVIDUAL_ADDR: case VMX_VPID_EXTENT_SINGLE_CONTEXT: case VMX_VPID_EXTENT_ALL_CONTEXT: - vmx_flush_tlb(vcpu); + __vmx_flush_tlb(vcpu, to_vmx(vcpu)->nested.vpid02); nested_vmx_succeed(vcpu); break; default: @@ -9501,7 +9501,7 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->nested.vpid02); if (vmcs12->virtual_processor_id != vmx->nested.last_vpid) { vmx->nested.last_vpid = vmcs12->virtual_processor_id; - vmx_flush_tlb(vcpu); + __vmx_flush_tlb(vcpu, to_vmx(vcpu)->nested.vpid02); } } else { vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);