Skip to contentSkip to conversation

vmxcap: Open MSR file in unbuffered mode

PATCH Applied Jan Kiszka 3 participants 4 messages Feb 13, 2013 – Feb 14, 2013 KVM

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 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.

---
 scripts/kvm/vmxcap |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
scripts/kvm/vmxcap +2 -2
index 0b23f77..6363e73 100755
@@ -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)
Signature · 1 line
1.7.3.4
Applied
#1 lore raw
Quoted 5 lines · Jan Kiszka

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.

Applied, thanks.

Quoted 22 lines
---
 scripts/kvm/vmxcap |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
scripts/kvm/vmxcap +2 -2
index 0b23f77..6363e73 100755
@@ -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)
Signature · 1 line
1.7.3.4

--
Gleb.

#2 lore raw

Am 14.02.2013 08:55, schrieb Gleb Natapov:

Quoted 7 lines · Jan Kiszka
Quoted 5 lines

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.

Applied, thanks.

Could you please fix the "to to"? :)

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#3 lore raw
Quoted 11 lines · Andreas Färber

Am 14.02.2013 08:55, schrieb Gleb Natapov:

Quoted 7 lines · Jan Kiszka
Quoted 5 lines

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.

Applied, thanks.

Could you please fix the "to to"? :)

Too too late :( Pushed already.

--
Gleb.