diff mbox

[QEMU] vmxcap: Open MSR file in unbuffered mode

Message ID 511B7C4E.8070403@siemens.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Kiszka Feb. 13, 2013, 11:43 a.m. UTC
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>
---
 scripts/kvm/vmxcap |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

Gleb Natapov Feb. 14, 2013, 7:55 a.m. UTC | #1
On Wed, Feb 13, 2013 at 12:43:10PM +0100, Jan Kiszka wrote:
> 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>
Applied, thanks.

> ---
>  scripts/kvm/vmxcap |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/kvm/vmxcap b/scripts/kvm/vmxcap
> index 0b23f77..6363e73 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)
> -- 
> 1.7.3.4

--
			Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andreas Färber Feb. 14, 2013, 10:25 a.m. UTC | #2
Am 14.02.2013 08:55, schrieb Gleb Natapov:
> On Wed, Feb 13, 2013 at 12:43:10PM +0100, Jan Kiszka wrote:
>> 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>
> Applied, thanks.

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

Andreas
Gleb Natapov Feb. 14, 2013, 12:02 p.m. UTC | #3
On Thu, Feb 14, 2013 at 11:25:05AM +0100, Andreas Färber wrote:
> Am 14.02.2013 08:55, schrieb Gleb Natapov:
> > On Wed, Feb 13, 2013 at 12:43:10PM +0100, Jan Kiszka wrote:
> >> 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>
> > Applied, thanks.
> 
> Could you please fix the "to to"? :)
> 
Too too late :( Pushed already.

--
			Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/scripts/kvm/vmxcap b/scripts/kvm/vmxcap
index 0b23f77..6363e73 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)