aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorNadav Amit <namit@cs.technion.ac.il>2014-12-24 19:52:22 -0500
committerPaolo Bonzini <pbonzini@redhat.com>2015-01-08 16:48:07 -0500
commite2cefa746e7e2a1104931d411b6f5de159d98ec6 (patch)
tree4f0bfcc2ac19ae66b6b92e06ed3ad24b1971911d /arch
parentab708099a0617e2c37b26d9ecbb373456057ba9b (diff)
KVM: x86: Do not set access bit on accessed segments
When segment is loaded, the segment access bit is set unconditionally. In fact, it should be set conditionally, based on whether the segment had the accessed bit set before. In addition, it can improve performance. Signed-off-by: Nadav Amit <namit@cs.technion.ac.il> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/emulate.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index cc24b74b7454..e36e1fc5bf85 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -1618,10 +1618,13 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt,
1618 1618
1619 if (seg_desc.s) { 1619 if (seg_desc.s) {
1620 /* mark segment as accessed */ 1620 /* mark segment as accessed */
1621 seg_desc.type |= 1; 1621 if (!(seg_desc.type & 1)) {
1622 ret = write_segment_descriptor(ctxt, selector, &seg_desc); 1622 seg_desc.type |= 1;
1623 if (ret != X86EMUL_CONTINUE) 1623 ret = write_segment_descriptor(ctxt, selector,
1624 return ret; 1624 &seg_desc);
1625 if (ret != X86EMUL_CONTINUE)
1626 return ret;
1627 }
1625 } else if (ctxt->mode == X86EMUL_MODE_PROT64) { 1628 } else if (ctxt->mode == X86EMUL_MODE_PROT64) {
1626 ret = ctxt->ops->read_std(ctxt, desc_addr+8, &base3, 1629 ret = ctxt->ops->read_std(ctxt, desc_addr+8, &base3,
1627 sizeof(base3), &ctxt->exception); 1630 sizeof(base3), &ctxt->exception);