diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2013-02-13 12:43:10 +0100 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2013-04-17 23:27:23 -0300 |
commit | f505a4d74aae6fc8bb5502a6038b5f671aa97713 (patch) | |
tree | 7ccf4099316ff7012247fceb496897cb45122676 /scripts/kvm | |
parent | 1773d9ee6e7138e3956081670215e8bc0ae14828 (diff) |
vmxcap: Open MSR file in unbuffered mode
Python may otherwise decide to to read larger chunks, applying the seek
only on the software buffer. This will return results from the wrong
MSRs.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Diffstat (limited to 'scripts/kvm')
-rwxr-xr-x | scripts/kvm/vmxcap | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/kvm/vmxcap b/scripts/kvm/vmxcap index 0b23f7795a..6363e7368f 100755 --- a/scripts/kvm/vmxcap +++ b/scripts/kvm/vmxcap @@ -27,9 +27,9 @@ MSR_IA32_VMX_VMFUNC = 0x491 class msr(object): def __init__(self): try: - self.f = file('/dev/cpu/0/msr') + self.f = open('/dev/cpu/0/msr', 'r', 0) except: - self.f = file('/dev/msr0') + self.f = open('/dev/msr0', 'r', 0) def read(self, index, default = None): import struct self.f.seek(index) |