]> git.proxmox.com Git - mirror_qemu.git/commitdiff
vmxcap: Open MSR file in unbuffered mode
authorJan Kiszka <jan.kiszka@siemens.com>
Wed, 13 Feb 2013 11:43:10 +0000 (12:43 +0100)
committerMarcelo Tosatti <mtosatti@redhat.com>
Thu, 18 Apr 2013 02:27:23 +0000 (23:27 -0300)
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>
scripts/kvm/vmxcap

index 0b23f7795a32ccf36c64e130d2319fa28d6a6117..6363e7368f5aca4a4c9a530fc0e697d0a784aeef 100755 (executable)
@@ -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)