From patchwork Fri Sep 3 12:21:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 154091 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o83CNYNu022454 for ; Fri, 3 Sep 2010 12:23:34 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757934Ab0ICMWl (ORCPT ); Fri, 3 Sep 2010 08:22:41 -0400 Received: from tx2ehsobe002.messaging.microsoft.com ([65.55.88.12]:46891 "EHLO TX2EHSOBE003.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751850Ab0ICMWj (ORCPT ); Fri, 3 Sep 2010 08:22:39 -0400 Received: from mail160-tx2-R.bigfish.com (10.9.14.237) by TX2EHSOBE003.bigfish.com (10.9.40.23) with Microsoft SMTP Server id 8.1.340.0; Fri, 3 Sep 2010 12:22:39 +0000 Received: from mail160-tx2 (localhost.localdomain [127.0.0.1]) by mail160-tx2-R.bigfish.com (Postfix) with ESMTP id F35F5A301CE; Fri, 3 Sep 2010 12:22:38 +0000 (UTC) X-SpamScore: -21 X-BigFish: VS-21(zz1432N98dNzz1202hzz8275bh15d4Rz32i87h2a8h) X-FB-DOMAIN-IP-MATCH: fail Received: from mail160-tx2 (localhost.localdomain [127.0.0.1]) by mail160-tx2 (MessageSwitch) id 1283516558288670_17208; Fri, 3 Sep 2010 12:22:38 +0000 (UTC) Received: from TX2EHSMHS017.bigfish.com (unknown [10.9.14.237]) by mail160-tx2.bigfish.com (Postfix) with ESMTP id 5CB26378052; Fri, 3 Sep 2010 12:22:37 +0000 (UTC) Received: from ausb3extmailp02.amd.com (163.181.251.22) by TX2EHSMHS017.bigfish.com (10.9.99.117) with Microsoft SMTP Server (TLS) id 14.0.482.44; Fri, 3 Sep 2010 12:22:26 +0000 Received: from ausb3twp01.amd.com (ausb3twp01.amd.com [163.181.250.37]) by ausb3extmailp02.amd.com (Switch-3.2.7/Switch-3.2.7) with SMTP id o83CNj7q011373; Fri, 3 Sep 2010 07:24:14 -0500 X-WSS-ID: 0L867NS-01-AGG-02 X-M-MSG: Received: from sausexhtp01.amd.com (sausexhtp01.amd.com [163.181.3.165]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by ausb3twp01.amd.com (Tumbleweed MailGate 3.7.2) with ESMTP id 242B810285DF; Fri, 3 Sep 2010 07:21:27 -0500 (CDT) Received: from storexhtp02.amd.com (172.24.4.4) by sausexhtp01.amd.com (163.181.3.165) with Microsoft SMTP Server (TLS) id 8.3.83.0; Fri, 3 Sep 2010 07:21:30 -0500 Received: from gwo.osrc.amd.com (165.204.16.204) by storexhtp02.amd.com (172.24.4.4) with Microsoft SMTP Server id 8.3.83.0; Fri, 3 Sep 2010 08:21:29 -0400 Received: from lemmy.osrc.amd.com (lemmy.osrc.amd.com [165.204.15.93]) by gwo.osrc.amd.com (Postfix) with ESMTP id E7EC449C0E9; Fri, 3 Sep 2010 13:21:28 +0100 (BST) Received: by lemmy.osrc.amd.com (Postfix, from userid 1000) id 28972A0500; Fri, 3 Sep 2010 14:21:40 +0200 (CEST) Date: Fri, 3 Sep 2010 14:21:40 +0200 From: "Roedel, Joerg" To: Avi Kivity , Marcelo Tosatti CC: "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 3/3] KVM: SVM: Clean up rip handling in vmrun emulation Message-ID: <20100903122140.GG1964@amd.com> References: <1283441387-7378-1-git-send-email-joerg.roedel@amd.com> <1283441387-7378-4-git-send-email-joerg.roedel@amd.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1283441387-7378-4-git-send-email-joerg.roedel@amd.com> Organization: Advanced Micro Devices =?iso-8859-1?Q?GmbH?= =?iso-8859-1?Q?=2C_Karl-Hammerschmidt-Str=2E_34=2C_85609_Dornach_bei_M=FC?= =?iso-8859-1?Q?nchen=2C_Gesch=E4ftsf=FChrer=3A_Thomas_M=2E_McCoy=2C_Giuli?= =?iso-8859-1?Q?ano_Meroni=2C_Andrew_Bowd=2C_Sitz=3A_Dornach=2C_Gemeinde_A?= =?iso-8859-1?Q?schheim=2C_Landkreis_M=FCnchen=2C_Registergericht_M=FCnche?= =?iso-8859-1?Q?n=2C?= HRB Nr. 43632 User-Agent: Mutt/1.5.20 (2009-06-14) X-Reverse-DNS: ausb3extmailp02.amd.com Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 03 Sep 2010 12:23:34 +0000 (UTC) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index ecd4e58..6808f64 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -2069,7 +2069,7 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm) return false; } - trace_kvm_nested_vmrun(svm->vmcb->save.rip - 3, vmcb_gpa, + trace_kvm_nested_vmrun(svm->vmcb->save.rip, vmcb_gpa, nested_vmcb->save.rip, nested_vmcb->control.int_ctl, nested_vmcb->control.event_inj, @@ -2098,7 +2098,7 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm) hsave->save.cr0 = kvm_read_cr0(&svm->vcpu); hsave->save.cr4 = svm->vcpu.arch.cr4; hsave->save.rflags = vmcb->save.rflags; - hsave->save.rip = svm->next_rip; + hsave->save.rip = kvm_rip_read(&svm->vcpu); hsave->save.rsp = vmcb->save.rsp; hsave->save.rax = vmcb->save.rax; if (npt_enabled) @@ -2270,8 +2270,8 @@ static int vmrun_interception(struct vcpu_svm *svm) if (nested_svm_check_permissions(svm)) return 1; - svm->next_rip = kvm_rip_read(&svm->vcpu) + 3; - skip_emulated_instruction(&svm->vcpu); + /* Save rip after vmrun instruction */ + kvm_rip_write(&svm->vcpu, kvm_rip_read(&svm->vcpu) + 3); if (!nested_svm_vmrun(svm)) return 1;