Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Jan 2023 22:11:39 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 02c219b9c9a8 - stable/13 - vmm svm: Mark all VMCB state caches dirty on vCPU restore.
Message-ID:  <202301262211.30QMBdbZ018552@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=02c219b9c9a877b09af78a9c5bf22eff00ebceda

commit 02c219b9c9a877b09af78a9c5bf22eff00ebceda
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-11-18 17:58:22 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-01-26 21:44:23 +0000

    vmm svm: Mark all VMCB state caches dirty on vCPU restore.
    
    Mark Johnston noticed that this was missing VMCB_CACHE_LBR.  Just set
    all the bits as is done in svm_run() rather than trying to clear
    individual bits.
    
    Reported by:    markj
    Reviewed by:    corvink, markj
    Differential Revision:  https://reviews.freebsd.org/D37259
    
    (cherry picked from commit 19b9dd2e08eda491ab1c181ca5a3659f7e7628fc)
---
 sys/amd64/vmm/amd/svm.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/sys/amd64/vmm/amd/svm.c b/sys/amd64/vmm/amd/svm.c
index 0db1e45594fa..d6502e331278 100644
--- a/sys/amd64/vmm/amd/svm.c
+++ b/sys/amd64/vmm/amd/svm.c
@@ -2478,17 +2478,8 @@ svm_snapshot(void *arg, struct vm_snapshot_meta *meta)
 		SNAPSHOT_VAR_OR_LEAVE(vcpu->asid.num, meta, ret, done);
 
 		/* Set all caches dirty */
-		if (meta->op == VM_SNAPSHOT_RESTORE) {
-			svm_set_dirty(sc, i, VMCB_CACHE_ASID);
-			svm_set_dirty(sc, i, VMCB_CACHE_IOPM);
-			svm_set_dirty(sc, i, VMCB_CACHE_I);
-			svm_set_dirty(sc, i, VMCB_CACHE_TPR);
-			svm_set_dirty(sc, i, VMCB_CACHE_CR2);
-			svm_set_dirty(sc, i, VMCB_CACHE_CR);
-			svm_set_dirty(sc, i, VMCB_CACHE_DT);
-			svm_set_dirty(sc, i, VMCB_CACHE_SEG);
-			svm_set_dirty(sc, i, VMCB_CACHE_NP);
-		}
+		if (meta->op == VM_SNAPSHOT_RESTORE)
+			svm_set_dirty(sc, i, 0xffffffff);
 	}
 
 	if (meta->op == VM_SNAPSHOT_RESTORE)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202301262211.30QMBdbZ018552>