qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Lieven <pl@dlhnet.de>
Cc: Avi Kivity <avi@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] memtest 4.20+ does not work with -cpu host
Date: Mon, 10 Sep 2012 14:15:49 +0200	[thread overview]
Message-ID: <504DD9F5.2040300@redhat.com> (raw)
In-Reply-To: <504DD483.6050104@dlhnet.de>

Il 10/09/2012 13:52, Peter Lieven ha scritto:
>> dd if=/dev/cpu/0/msr skip=$((0x194)) bs=8 count=1 | xxd
>> dd if=/dev/cpu/0/msr skip=$((0xCE)) bs=8 count=1 | xxd
> it only works without the skip. but the msr device returns all zeroes.

Hmm, the strange API of the MSR device doesn't work well with dd (dd
skips to 0x194 * 8 because bs is 8.  You can try this program:

#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>

int rdmsr(int fd, long reg)
{
    char msg[40];
    long long val;
    sprintf(msg, "rdmsr(%#x)", reg);
    if (pread(fd, &val, 8, reg) < 0) {
        perror(msg);
    } else {
        printf("%s: %#016llx\n", msg, val);
        fflush(stdout);
    }
}


int main()
{
    int fd = open("/dev/cpu/0/msr", O_RDONLY);
    if (fd < 0) { perror("open"); exit(1); }
    rdmsr(fd, 0x194);
    rdmsr(fd, 0xCE);
}

Paolo

  reply	other threads:[~2012-09-10 12:16 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-22 15:06 [Qemu-devel] memtest 4.20+ does not work with -cpu host Peter Lieven
2012-09-06 14:58 ` Avi Kivity
2012-09-10 11:06   ` Peter Lieven
2012-09-10 11:29     ` Paolo Bonzini
2012-09-10 11:47       ` Peter Lieven
2012-09-10 11:52       ` Peter Lieven
2012-09-10 12:15         ` Paolo Bonzini [this message]
2012-09-10 12:21           ` Gleb Natapov
2012-09-10 12:29             ` Peter Lieven
2012-09-10 12:32               ` Avi Kivity
2012-09-10 12:38                 ` Peter Lieven
2012-09-13  7:53                 ` Peter Lieven
2012-09-13  7:55                   ` Paolo Bonzini
2012-09-13  7:57                     ` Gleb Natapov
2012-09-13  8:00                       ` Paolo Bonzini
2012-09-13  8:05                         ` Gleb Natapov
2012-09-13 12:05                           ` Peter Lieven
2012-09-13 12:42                             ` Gleb Natapov
2012-09-13 12:56                               ` Peter Lieven
2012-09-13 13:43                                 ` Gleb Natapov
2012-09-10 12:12       ` Avi Kivity

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=504DD9F5.2040300@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pl@dlhnet.de \
    --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).