This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] [PATCH] SVM: enables TSC scaling ratio support for SVM

To: "'xen-devel@xxxxxxxxxxxxxxxxxxx'" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Keir Fraser <keir@xxxxxxx>
Subject: [Xen-devel] [PATCH] SVM: enables TSC scaling ratio support for SVM
From: Wei Huang <wei.huang2@xxxxxxx>
Date: Fri, 27 May 2011 11:34:59 -0500
Delivery-date: Fri, 27 May 2011 11:31:30 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv: Gecko/20110414 Thunderbird/3.1.10
Future AMD CPUs support TSC scaling. It allows guests to have a different TSC frequency from host system using this formula: guest_tsc = host_tsc * tsc_ratio + vmcb_offset. The tsc_ratio is a 64bit MSR contains a fixed-point number in 8.32 format (8 bits for integer part and 32bits for fractional part). For instance 0x00000003_80000000 means tsc_ratio=3.5.

This patch enables TSC scaling ratio for SVM. With it, guest VMs don't need take #VMEXIT to calculate a translated TSC value when it is running under TSC emulation mode. This can SUBSTANTIALLY reduce the rdtsc overhead.

Signed-off-by: Wei Huang <wei.huang2@xxxxxxx>

 arch/x86/hvm/svm/svm.c        |   32 +++++++++++++++++++++++++++++++-
 arch/x86/hvm/svm/vmcb.c       |    4 +++-
 include/asm-x86/hvm/svm/svm.h |    8 ++++++++
 include/asm-x86/msr-index.h   |    3 +++
 4 files changed, 45 insertions(+), 2 deletions(-)

Attachment: xen_tsc_ratio.txt
Description: xen_tsc_ratio.txt

Xen-devel mailing list
<Prev in Thread] Current Thread [Next in Thread>