From patchwork Tue Aug 2 12:55:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Har'El X-Patchwork-Id: 1029402 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p72CsDto002176 for ; Tue, 2 Aug 2011 12:57:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754431Ab1HBMz1 (ORCPT ); Tue, 2 Aug 2011 08:55:27 -0400 Received: from mtagate1.uk.ibm.com ([194.196.100.161]:58816 "EHLO mtagate1.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754341Ab1HBMz1 (ORCPT ); Tue, 2 Aug 2011 08:55:27 -0400 Received: from d06nrmr1806.portsmouth.uk.ibm.com (d06nrmr1806.portsmouth.uk.ibm.com [9.149.39.193]) by mtagate1.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p72CtQDk024310 for ; Tue, 2 Aug 2011 12:55:26 GMT Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by d06nrmr1806.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p72CtQWR2425028 for ; Tue, 2 Aug 2011 13:55:26 +0100 Received: from d06av05.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p72CtP9l004864 for ; Tue, 2 Aug 2011 06:55:26 -0600 Received: from rice.haifa.ibm.com (rice.haifa.ibm.com [9.148.8.217]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p72CtOYw004847 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 2 Aug 2011 06:55:25 -0600 Received: from rice.haifa.ibm.com (lnx-nyh.haifa.ibm.com [127.0.0.1]) by rice.haifa.ibm.com (8.14.5/8.14.4) with ESMTP id p72CtO2F002155; Tue, 2 Aug 2011 15:55:24 +0300 Received: (from nyh@localhost) by rice.haifa.ibm.com (8.14.5/8.14.5/Submit) id p72CtNjD002153; Tue, 2 Aug 2011 15:55:23 +0300 Date: Tue, 2 Aug 2011 15:55:23 +0300 Message-Id: <201108021255.p72CtNjD002153@rice.haifa.ibm.com> X-Authentication-Warning: rice.haifa.ibm.com: nyh set sender to "Nadav Har'El" using -f Cc: "Roedel, Joerg" , Zachary Amsden , Bandan Das , Marcelo Tosatti , avi@redhat.com To: kvm@vger.kernel.org From: "Nadav Har'El" References: <1312289591-nyh@il.ibm.com> Subject: [PATCH 3/3] Fix TSC MSR read in nested SVM 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.6 (demeter1.kernel.org [140.211.167.41]); Tue, 02 Aug 2011 12:57:21 +0000 (UTC) When the TSC MSR is read by an L2 guest (when L1 allowed this MSR to be read without exit), we need to return L2's notion of the TSC, not L1's. The current code incorrectly returned L1 TSC, because svm_get_msr() was also used in x86.c where this was assumed, but now that these places call the new svm_read_l1_tsc(), the MSR read can be fixed. Signed-off-by: Nadav Har'El Tested-by: Joerg Roedel Acked-by: Joerg Roedel --- arch/x86/kvm/svm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- .before/arch/x86/kvm/svm.c 2011-08-02 15:51:02.000000000 +0300 +++ .after/arch/x86/kvm/svm.c 2011-08-02 15:51:02.000000000 +0300 @@ -2907,9 +2907,7 @@ static int svm_get_msr(struct kvm_vcpu * switch (ecx) { case MSR_IA32_TSC: { - struct vmcb *vmcb = get_host_vmcb(svm); - - *data = vmcb->control.tsc_offset + + *data = svm->vmcb->control.tsc_offset + svm_scale_tsc(vcpu, native_read_tsc()); break;