From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: memtest 4.20+ does not work with -cpu host Date: Mon, 10 Sep 2012 14:15:49 +0200 Message-ID: <504DD9F5.2040300@redhat.com> References: <5034F587.4000403@dlhnet.de> <5048BA0F.3070300@redhat.com> <504DC9BC.1060407@dlhnet.de> <504DCF1A.1@redhat.com> <504DD483.6050104@dlhnet.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Avi Kivity , "qemu-devel@nongnu.org" , "kvm@vger.kernel.org" To: Peter Lieven Return-path: Received: from mx1.redhat.com ([209.132.183.28]:3054 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757286Ab2IJMPy (ORCPT ); Mon, 10 Sep 2012 08:15:54 -0400 In-Reply-To: <504DD483.6050104@dlhnet.de> Sender: kvm-owner@vger.kernel.org List-ID: 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 #include #include 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