Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 582038 - backport EPT accessed bit emulation
backport EPT accessed bit emulation
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kvm (Show other bugs)
5.5
All Linux
low Severity medium
: rc
: ---
Assigned To: Rik van Riel
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-04-13 18:33 EDT by Rik van Riel
Modified: 2013-01-09 17:27 EST (History)
6 users (show)

See Also:
Fixed In Version: kvm-83-175.el5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-01-13 18:34:42 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
trivial backport of upstream changeset (1.73 KB, patch)
2010-04-13 18:33 EDT, Rik van Riel
no flags Details | Diff
ETPtest.sh will kvmcall_cnt.stp (43 bytes, application/x-sh)
2010-05-28 01:51 EDT, Keqin Hong
no flags Details
kvm module systemtap (953 bytes, application/octet-stream)
2010-05-28 01:52 EDT, Keqin Hong
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2011:0028 normal SHIPPED_LIVE Low: kvm security and bug fix update 2011-01-13 06:03:39 EST

  None (edit)
Description Rik van Riel 2010-04-13 18:33:01 EDT
Created attachment 406365 [details]
trivial backport of upstream changeset

Description of problem:

The RHEL 5 KVM code does not emulate the accessed bit for EPT pages.  This can cause the host to swap out frequently used guest pages, which can be a performance issue.

I propose merging a backport of this changeset into RHEL 5 KVM:

commit 6316e1c8c6af6ccb55ff8564231710660608f46c
Author: Rik van Riel <riel@redhat.com>
Date:   Wed Feb 3 16:11:03 2010 -0500

    KVM: VMX: emulate accessed bit for EPT
    
    Currently KVM pretends that pages with EPT mappings never got
    accessed.  This has some side effects in the VM, like swapping
    out actively used guest pages and needlessly breaking up actively
    used hugepages.
    
    We can avoid those very costly side effects by emulating the
    accessed bit for EPT PTEs, which should only be slightly costly
    because pages pass through page_referenced infrequently.
    
    TLB flushing is taken care of by kvm_mmu_notifier_clear_flush_young().
    
    This seems to help prevent KVM guests from being swapped out when
    they should not on my system.
    
    Signed-off-by: Rik van Riel <riel@redhat.com>
    Signed-off-by: Avi Kivity <avi@redhat.com>
Comment 4 Keqin Hong 2010-05-17 05:00:38 EDT
Rik, could you tell us how to test this fix? An example with some steps would really help. Thanks.
Comment 5 Keqin Hong 2010-05-28 01:49:26 EDT
Using Systemtap to probe the fix, the results were
1. kvm-83-164.el5
stapio kvm_age_rmapp 15531164
kvm_age_rmapp@mmu.c returns 0 15531164 times

2. kvm-83-176.el5
stapio kvm_age_rmapp 11302136
kvm_age_rmapp@mmu.c returns 0 11299767 times
kvm_age_rmapp@mmu.c returns 1 2369 times

Host info:

CPU model: Intel(R) Core(TM) i7 CPU         920  @ 2.67GHz
Mem: 12G
# dmesg | grep ept
ata3.00: 976773168 sectors, multi 0: LBA48 NCQ (depth 31/32)
ata4.00: 976773168 sectors, multi 0: LBA48 NCQ (depth 31/32)
kvm: virtualization flags detected on this hardware: vmx tpr_shadow vnmi flexpriority ept vpid
kvm: virtualization flags detected on this hardware: vmx tpr_shadow vnmi flexpriority ept vpid
kvm: virtualization flags detected on this hardware: vmx tpr_shadow vnmi flexpriority ept vpid


Steps:
1. Start ./EPTtest.sh which in turn calls kvmcall_cnt.stp (see attachment)
2. Boot a Win2008rc guest overcommitting host physical memory
#/usr/libexec/qemu-kvm -m 12G -smp 4 -drive file=test2k8.raw,if=virtio,cache=none,boot=on -net nic,model=virtio,vlan=1,macaddr=76:00:40:3F:20:20 -net tap,vlan=1,script=/etc/qemu-ifup -boot c -uuid 17644ecc-d3a1-4d3c-a386-12daf50015f2 -usbdevice tablet -no-hpet -rtc-td-hack -no-kvm-pit-reinjection -monitor stdio -notify all -cpu qemu64,+sse2 -balloon none -startdate now -vnc :1 -name EPT-test
3. Wait till guest finishes booting, and shut down guest
4. Press "^C" to end ./EPTtest.sh
Comment 6 Keqin Hong 2010-05-28 01:51:52 EDT
Created attachment 417481 [details]
ETPtest.sh will kvmcall_cnt.stp
Comment 7 Keqin Hong 2010-05-28 01:52:40 EDT
Created attachment 417482 [details]
kvm module systemtap
Comment 9 Keqin Hong 2010-11-05 07:29:37 EDT
Verified on kvm-83-206.el5, PASS.
Steps are the same as in Comment 5.

stapio kvm_age_rmapp 10454128
kvm_age_rmapp@mmu.c returns 0 9333769 times
kvm_age_rmapp@mmu.c returns 1 1120359 times
                            ^^^^^^^^^
Comment 12 errata-xmlrpc 2011-01-13 18:34:42 EST
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0028.html

Note You need to log in before you can comment on or make changes to this bug.