Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/nvmm/x86 Micro optimization: the STAR/LSTAR/CSTAR/SF...



details:   https://anonhg.NetBSD.org/src/rev/e9adac75904d
branches:  trunk
changeset: 448901:e9adac75904d
user:      maxv <maxv%NetBSD.org@localhost>
date:      Wed Feb 13 07:04:12 2019 +0000

description:
Micro optimization: the STAR/LSTAR/CSTAR/SFMASK MSRs are static, so rather
than saving them on each VMENTRY, save them only once, at VCPU creation
time.

diffstat:

 sys/dev/nvmm/x86/nvmm_x86_svm.c |  14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diffs (42 lines):

diff -r 94d27fed3c22 -r e9adac75904d sys/dev/nvmm/x86/nvmm_x86_svm.c
--- a/sys/dev/nvmm/x86/nvmm_x86_svm.c   Wed Feb 13 06:52:43 2019 +0000
+++ b/sys/dev/nvmm/x86/nvmm_x86_svm.c   Wed Feb 13 07:04:12 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvmm_x86_svm.c,v 1.20 2019/02/12 14:54:59 maxv Exp $   */
+/*     $NetBSD: nvmm_x86_svm.c,v 1.21 2019/02/13 07:04:12 maxv Exp $   */
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.20 2019/02/12 14:54:59 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.21 2019/02/13 07:04:12 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1157,10 +1157,6 @@
 {
        struct svm_cpudata *cpudata = vcpu->cpudata;
 
-       cpudata->star = rdmsr(MSR_STAR);
-       cpudata->lstar = rdmsr(MSR_LSTAR);
-       cpudata->cstar = rdmsr(MSR_CSTAR);
-       cpudata->sfmask = rdmsr(MSR_SFMASK);
        cpudata->fsbase = rdmsr(MSR_FSBASE);
        cpudata->kernelgsbase = rdmsr(MSR_KERNELGSBASE);
 }
@@ -1592,6 +1588,12 @@
 
        /* Bluntly hide the host TSC. */
        cpudata->tsc_offset = rdtsc();
+
+       /* These MSRs are static. */
+       cpudata->star = rdmsr(MSR_STAR);
+       cpudata->lstar = rdmsr(MSR_LSTAR);
+       cpudata->cstar = rdmsr(MSR_CSTAR);
+       cpudata->sfmask = rdmsr(MSR_SFMASK);
 }
 
 static int



Home | Main Index | Thread Index | Old Index