qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
	Gleb Natapov <gleb@redhat.com>,
	qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: [Qemu-devel] [PATCH 1/5] vmxcap: Open MSR file in unbuffered mode
Date: Wed, 17 Apr 2013 23:48:22 -0300	[thread overview]
Message-ID: <f505a4d74aae6fc8bb5502a6038b5f671aa97713.1366253306.git.mtosatti@redhat.com> (raw)
In-Reply-To: <cover.1366253306.git.mtosatti@redhat.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

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 | 4 ++--
 1 file 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.8.1.4

  reply	other threads:[~2013-04-18  2:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-18  2:48 [Qemu-devel] [PATCH 0/5] [PULL] qemu-kvm.git uq/master queue Marcelo Tosatti
2013-04-18  2:48 ` Marcelo Tosatti [this message]
2013-04-18  2:48 ` [Qemu-devel] [PATCH 2/5] vmxcap: Augment reported information Marcelo Tosatti
2013-04-18  2:48 ` [Qemu-devel] [PATCH 3/5] vmxcap: Report APIC register emulation and RDTSCP control Marcelo Tosatti
2013-04-18  2:48 ` [Qemu-devel] [PATCH 4/5] target-i386: kvm: save/restore steal time MSR Marcelo Tosatti
2013-04-18  2:48 ` [Qemu-devel] [PATCH 5/5] vmxcap: Update according to SDM of January 2013 Marcelo Tosatti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f505a4d74aae6fc8bb5502a6038b5f671aa97713.1366253306.git.mtosatti@redhat.com \
    --to=mtosatti@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=gleb@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).