Re: [Qemu-devel] memtest 4.20+ does not work with -cpu host

2012-09-13 Thread Peter Lieven

On 10.09.2012 14:32, Avi Kivity wrote:

On 09/10/2012 03:29 PM, Peter Lieven wrote:

On 09/10/12 14:21, Gleb Natapov wrote:

On Mon, Sep 10, 2012 at 02:15:49PM +0200, Paolo Bonzini wrote:

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:


There is rdmsr/wrmsr in msr-tools.

rdmsr returns it cannot read those MSRs. regardless if I use -cpu host
or -cpu qemu64.

On the host.



did you get my output?

#rdmsr -0 0x194
00011100
#rdmsr -0 0xce
0c0004011103

cheers,
peter




Re: [Qemu-devel] memtest 4.20+ does not work with -cpu host

2012-09-13 Thread Paolo Bonzini
Il 13/09/2012 09:53, Peter Lieven ha scritto:

 rdmsr returns it cannot read those MSRs. regardless if I use -cpu host
 or -cpu qemu64.
 On the host.


 did you get my output?
 
 #rdmsr -0 0x194
 00011100
 #rdmsr -0 0xce
 0c0004011103

Yes, that can help implementing it in KVM.  But without a spec to
understand what the bits actually mean, it's just as risky...

Peter, do you have any idea where to get the spec of the memory
controller MSRs in Nehalem and newer processors?  Apparently, memtest is
using them (and in particular 0x194) to find the speed of the FSB, or
something like that.

Paolo



Re: [Qemu-devel] memtest 4.20+ does not work with -cpu host

2012-09-13 Thread Gleb Natapov
On Thu, Sep 13, 2012 at 09:55:06AM +0200, Paolo Bonzini wrote:
 Il 13/09/2012 09:53, Peter Lieven ha scritto:
 
  rdmsr returns it cannot read those MSRs. regardless if I use -cpu host
  or -cpu qemu64.
  On the host.
 
 
  did you get my output?
  
  #rdmsr -0 0x194
  00011100
  #rdmsr -0 0xce
  0c0004011103
 
 Yes, that can help implementing it in KVM.  But without a spec to
 understand what the bits actually mean, it's just as risky...
 
 Peter, do you have any idea where to get the spec of the memory
 controller MSRs in Nehalem and newer processors?  Apparently, memtest is
 using them (and in particular 0x194) to find the speed of the FSB, or
 something like that.
 
Why would anyone will want to run memtest in a vm? May be just add those
MSRs to ignore list and that's it.

--
Gleb.



Re: [Qemu-devel] memtest 4.20+ does not work with -cpu host

2012-09-13 Thread Paolo Bonzini
Il 13/09/2012 09:57, Gleb Natapov ha scritto:
   
   #rdmsr -0 0x194
   00011100
   #rdmsr -0 0xce
   0c0004011103
  
  Yes, that can help implementing it in KVM.  But without a spec to
  understand what the bits actually mean, it's just as risky...
  
  Peter, do you have any idea where to get the spec of the memory
  controller MSRs in Nehalem and newer processors?  Apparently, memtest is
  using them (and in particular 0x194) to find the speed of the FSB, or
  something like that.
  
 Why would anyone will want to run memtest in a vm? May be just add those
 MSRs to ignore list and that's it.

From the output it looks like it's basically a list of bits.  Returning
something sensible is better, same as for the speed scaling MSRs.

Paolo



Re: [Qemu-devel] memtest 4.20+ does not work with -cpu host

2012-09-13 Thread Gleb Natapov
On Thu, Sep 13, 2012 at 10:00:26AM +0200, Paolo Bonzini wrote:
 Il 13/09/2012 09:57, Gleb Natapov ha scritto:

#rdmsr -0 0x194
00011100
#rdmsr -0 0xce
0c0004011103
   
   Yes, that can help implementing it in KVM.  But without a spec to
   understand what the bits actually mean, it's just as risky...
   
   Peter, do you have any idea where to get the spec of the memory
   controller MSRs in Nehalem and newer processors?  Apparently, memtest is
   using them (and in particular 0x194) to find the speed of the FSB, or
   something like that.
   
  Why would anyone will want to run memtest in a vm? May be just add those
  MSRs to ignore list and that's it.
 
 From the output it looks like it's basically a list of bits.  Returning
 something sensible is better, same as for the speed scaling MSRs.
 
Everything is list of bits in computers :) At least 0xce is documented in  SDM.
It cannot be implemented in a migration safe manner.

--
Gleb.



Re: [Qemu-devel] memtest 4.20+ does not work with -cpu host

2012-09-13 Thread Peter Lieven

On 13.09.2012 10:05, Gleb Natapov wrote:

On Thu, Sep 13, 2012 at 10:00:26AM +0200, Paolo Bonzini wrote:

Il 13/09/2012 09:57, Gleb Natapov ha scritto:

#rdmsr -0 0x194
00011100
#rdmsr -0 0xce
0c0004011103

Yes, that can help implementing it in KVM.  But without a spec to
understand what the bits actually mean, it's just as risky...

Peter, do you have any idea where to get the spec of the memory
controller MSRs in Nehalem and newer processors?  Apparently, memtest is
using them (and in particular 0x194) to find the speed of the FSB, or
something like that.


Why would anyone will want to run memtest in a vm? May be just add those
MSRs to ignore list and that's it.

From the output it looks like it's basically a list of bits.  Returning
something sensible is better, same as for the speed scaling MSRs.


Everything is list of bits in computers :) At least 0xce is documented in  SDM.
It cannot be implemented in a migration safe manner.

What do you suggest just say memtest does not work?
I am wondering why it is working with -cpu qemu64.

Peter



--
Gleb.





Re: [Qemu-devel] memtest 4.20+ does not work with -cpu host

2012-09-13 Thread Gleb Natapov
On Thu, Sep 13, 2012 at 02:05:23PM +0200, Peter Lieven wrote:
 On 13.09.2012 10:05, Gleb Natapov wrote:
 On Thu, Sep 13, 2012 at 10:00:26AM +0200, Paolo Bonzini wrote:
 Il 13/09/2012 09:57, Gleb Natapov ha scritto:
 #rdmsr -0 0x194
 00011100
 #rdmsr -0 0xce
 0c0004011103
 Yes, that can help implementing it in KVM.  But without a spec to
 understand what the bits actually mean, it's just as risky...
 
 Peter, do you have any idea where to get the spec of the memory
 controller MSRs in Nehalem and newer processors?  Apparently, memtest is
 using them (and in particular 0x194) to find the speed of the FSB, or
 something like that.
 
 Why would anyone will want to run memtest in a vm? May be just add those
 MSRs to ignore list and that's it.
 From the output it looks like it's basically a list of bits.  Returning
 something sensible is better, same as for the speed scaling MSRs.
 
 Everything is list of bits in computers :) At least 0xce is documented in  
 SDM.
 It cannot be implemented in a migration safe manner.
 What do you suggest just say memtest does not work?
Why do you want to run it in a guest? 

 I am wondering why it is working with -cpu qemu64.
 
Because memtest has different code for different cpu models.

--
Gleb.



Re: [Qemu-devel] memtest 4.20+ does not work with -cpu host

2012-09-13 Thread Peter Lieven

On 13.09.2012 14:42, Gleb Natapov wrote:

On Thu, Sep 13, 2012 at 02:05:23PM +0200, Peter Lieven wrote:

On 13.09.2012 10:05, Gleb Natapov wrote:

On Thu, Sep 13, 2012 at 10:00:26AM +0200, Paolo Bonzini wrote:

Il 13/09/2012 09:57, Gleb Natapov ha scritto:

#rdmsr -0 0x194
00011100
#rdmsr -0 0xce
0c0004011103

Yes, that can help implementing it in KVM.  But without a spec to
understand what the bits actually mean, it's just as risky...

Peter, do you have any idea where to get the spec of the memory
controller MSRs in Nehalem and newer processors?  Apparently, memtest is
using them (and in particular 0x194) to find the speed of the FSB, or
something like that.


Why would anyone will want to run memtest in a vm? May be just add those
MSRs to ignore list and that's it.

From the output it looks like it's basically a list of bits.  Returning
something sensible is better, same as for the speed scaling MSRs.


Everything is list of bits in computers :) At least 0xce is documented in  SDM.
It cannot be implemented in a migration safe manner.

What do you suggest just say memtest does not work?

Why do you want to run it in a guest?
Testing memory thorughput of different host memory layouts/settings 
(hugepages, ksm etc.).

Stress testing new settings and qemu-kvm builds.
Testing new nodes with a VM which claims all available pages. Its a lot 
easier than booting

a node with a CD and attaching to the Console.

This, of course, is all not missing critical and call also be done with 
cpu model qemu64. I just
came across memtest no longer working and where wondering if there is a 
general regressing.


BTW, from 
http://opensource.apple.com/source/xnu/xnu-1228.15.4/osfmk/i386/tsc.c?txt


#define MSR_FLEX_RATIO  0x194
#define MSR_PLATFORM_INFO   0x0ce
#define BASE_NHM_CLOCK_SOURCE   1ULL
#define CPUID_MODEL_NEHALEM 26

switch (cpuid_info()-cpuid_model) {
case CPUID_MODEL_NEHALEM: {
uint64_t cpu_mhz;
uint64_t msr_flex_ratio;
uint64_t msr_platform_info;

/* See if FLEX_RATIO is being used */
msr_flex_ratio = rdmsr64(MSR_FLEX_RATIO);
msr_platform_info = rdmsr64(MSR_PLATFORM_INFO);
flex_ratio_min = (uint32_t)bitfield(msr_platform_info, 47, 40);
flex_ratio_max = (uint32_t)bitfield(msr_platform_info, 15, 8);
/* No BIOS-programed flex ratio. Use hardware max as default */
tscGranularity = flex_ratio_max;
if (msr_flex_ratio  bit(16)) {
/* Flex Enabled: Use this MSR if less than max */
flex_ratio = (uint32_t)bitfield(msr_flex_ratio, 15, 8);
if (flex_ratio  flex_ratio_max)
tscGranularity = flex_ratio;
}

/* If EFI isn't configured correctly, use a constant
 * value. See 6036811.
 */
if (busFreq == 0)
busFreq = BASE_NHM_CLOCK_SOURCE;

cpu_mhz = tscGranularity * BASE_NHM_CLOCK_SOURCE;

kprintf([NHM] Maximum Non-Turbo Ratio = [%d]\n,
(uint32_t)tscGranularity);
kprintf([NHM] CPU: Frequency  = %6d.%04dMhz\n,
(uint32_t)(cpu_mhz / Mega), (uint32_t)(cpu_mhz % Mega));
break;
}



Peter



Re: [Qemu-devel] memtest 4.20+ does not work with -cpu host

2012-09-13 Thread Gleb Natapov
On Thu, Sep 13, 2012 at 02:56:33PM +0200, Peter Lieven wrote:
 On 13.09.2012 14:42, Gleb Natapov wrote:
 On Thu, Sep 13, 2012 at 02:05:23PM +0200, Peter Lieven wrote:
 On 13.09.2012 10:05, Gleb Natapov wrote:
 On Thu, Sep 13, 2012 at 10:00:26AM +0200, Paolo Bonzini wrote:
 Il 13/09/2012 09:57, Gleb Natapov ha scritto:
 #rdmsr -0 0x194
 00011100
 #rdmsr -0 0xce
 0c0004011103
 Yes, that can help implementing it in KVM.  But without a spec to
 understand what the bits actually mean, it's just as risky...
 
 Peter, do you have any idea where to get the spec of the memory
 controller MSRs in Nehalem and newer processors?  Apparently, memtest 
 is
 using them (and in particular 0x194) to find the speed of the FSB, or
 something like that.
 
 Why would anyone will want to run memtest in a vm? May be just add those
 MSRs to ignore list and that's it.
 From the output it looks like it's basically a list of bits.  Returning
 something sensible is better, same as for the speed scaling MSRs.
 
 Everything is list of bits in computers :) At least 0xce is documented in  
 SDM.
 It cannot be implemented in a migration safe manner.
 What do you suggest just say memtest does not work?
 Why do you want to run it in a guest?
 Testing memory thorughput of different host memory layouts/settings
 (hugepages, ksm etc.).
In may days memtets looked for memory errors. This does not make much
sense in virtualized environment. What does it do today? Calculates
throughput? Does it prefaults memory before doing so, because otherwise
numbers will not be very meaningful when running inside VM. But since
memtets works on physical memory I doubt it prefaults.

 Stress testing new settings and qemu-kvm builds.
Why guest accessing memory stress qemu-kvm?

 Testing new nodes with a VM which claims all available pages. Its a
 lot easier than booting
 a node with a CD and attaching to the Console.
Boot Window, it access all memory :) or run with qemu64 like you say
below.

 
 This, of course, is all not missing critical and call also be done
 with cpu model qemu64. I just
 came across memtest no longer working and where wondering if there
 is a general regressing.
 
If it is a regression it is likely in memtest

 BTW, from 
 http://opensource.apple.com/source/xnu/xnu-1228.15.4/osfmk/i386/tsc.c?txt

You can send them patch to check that it runs in a VM and skip all that.
 
 #define MSR_FLEX_RATIO  0x194
 #define MSR_PLATFORM_INFO   0x0ce
 #define BASE_NHM_CLOCK_SOURCE   1ULL
 #define CPUID_MODEL_NEHALEM 26
 
   switch (cpuid_info()-cpuid_model) {
   case CPUID_MODEL_NEHALEM: {
   uint64_t cpu_mhz;
   uint64_t msr_flex_ratio;
   uint64_t msr_platform_info;
 
   /* See if FLEX_RATIO is being used */
   msr_flex_ratio = rdmsr64(MSR_FLEX_RATIO);
   msr_platform_info = rdmsr64(MSR_PLATFORM_INFO);
   flex_ratio_min = (uint32_t)bitfield(msr_platform_info, 47, 40);
   flex_ratio_max = (uint32_t)bitfield(msr_platform_info, 15, 8);
   /* No BIOS-programed flex ratio. Use hardware max as default */
   tscGranularity = flex_ratio_max;
   if (msr_flex_ratio  bit(16)) {
   /* Flex Enabled: Use this MSR if less than max */
   flex_ratio = (uint32_t)bitfield(msr_flex_ratio, 15, 8);
   if (flex_ratio  flex_ratio_max)
   tscGranularity = flex_ratio;
   }
 
   /* If EFI isn't configured correctly, use a constant
* value. See 6036811.
*/
   if (busFreq == 0)
   busFreq = BASE_NHM_CLOCK_SOURCE;
 
   cpu_mhz = tscGranularity * BASE_NHM_CLOCK_SOURCE;
 
   kprintf([NHM] Maximum Non-Turbo Ratio = [%d]\n,
   (uint32_t)tscGranularity);
   kprintf([NHM] CPU: Frequency  = %6d.%04dMhz\n,
   (uint32_t)(cpu_mhz / Mega), (uint32_t)(cpu_mhz % Mega));
   break;
 }
 
 
 
 Peter

--
Gleb.



Re: [Qemu-devel] memtest 4.20+ does not work with -cpu host

2012-09-10 Thread Peter Lieven

On 09/06/12 16:58, Avi Kivity wrote:

On 08/22/2012 06:06 PM, Peter Lieven wrote:

Hi,

has anyone ever tested to run memtest with -cpu host flag passed to
qemu-kvm?
For me it resets when probing the chipset. With -cpu qemu64 it works
just fine.

Maybe this is specific to memtest, but it might be sth that can happen
in other
applications to.

Any thoughts?

Try to identify the cpu flag that causes this by removing them
successively (-cpu host,-flag...).  Alternatively capture a trace
(http://www.linux-kvm.org/page/Tracing) look for TRIPLE_FAULT (Intel),
and post the few hundred lines preceding it.


Here we go:

qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_userspace_exit: reason 
KVM_EXIT_IO (2)

qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_entry: vcpu 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_exit: reason EXCEPTION_NMI 
rip 0xd185 info 0 8307

qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_fpu: load
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_entry: vcpu 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_exit: reason IO_INSTRUCTION 
rip 0xcc60 info cf80003 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_pio: pio_write at 0xcf8 
size 4 count 1
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_userspace_exit: reason 
KVM_EXIT_IO (2)

qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_fpu: unload
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_entry: vcpu 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_exit: reason IO_INSTRUCTION 
rip 0xcc29 info cfc0009 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_emulate_insn: [FAILED TO 
PARSE] rip=52265 csbase=0 len=2 insn=fí%ÿÿ flags=5 failed=0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_pio: pio_read at 0xcfc size 
2 count 1
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_userspace_exit: reason 
KVM_EXIT_IO (2)

qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_entry: vcpu 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_exit: reason IO_INSTRUCTION 
rip 0xcc60 info cf80003 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_pio: pio_write at 0xcf8 
size 4 count 1
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_userspace_exit: reason 
KVM_EXIT_IO (2)

qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_entry: vcpu 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_exit: reason IO_INSTRUCTION 
rip 0xcc29 info cfe0009 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_emulate_insn: [FAILED TO 
PARSE] rip=52265 csbase=0 len=2 insn=fí%ÿÿ flags=5 failed=0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_pio: pio_read at 0xcfe size 
2 count 1
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_userspace_exit: reason 
KVM_EXIT_IO (2)

qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_entry: vcpu 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_exit: reason EXCEPTION_NMI 
rip 0xd185 info 0 8307

qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_fpu: load
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_entry: vcpu 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_exit: reason IO_INSTRUCTION 
rip 0xcc60 info cf80003 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_pio: pio_write at 0xcf8 
size 4 count 1
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_userspace_exit: reason 
KVM_EXIT_IO (2)

qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_fpu: unload
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_entry: vcpu 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_exit: reason IO_INSTRUCTION 
rip 0xcc29 info cfc0009 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_emulate_insn: [FAILED TO 
PARSE] rip=52265 csbase=0 len=2 insn=fí%ÿÿ flags=5 failed=0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_pio: pio_read at 0xcfc size 
2 count 1
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_userspace_exit: reason 
KVM_EXIT_IO (2)

qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_entry: vcpu 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_exit: reason IO_INSTRUCTION 
rip 0xcc60 info cf80003 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_pio: pio_write at 0xcf8 
size 4 count 1
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_userspace_exit: reason 
KVM_EXIT_IO (2)

qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_entry: vcpu 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_exit: reason IO_INSTRUCTION 
rip 0xcc29 info cfc0009 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_emulate_insn: [FAILED TO 
PARSE] rip=52265 csbase=0 len=2 insn=fí%ÿÿ flags=5 failed=0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_pio: pio_read at 0xcfc size 
2 count 1
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_userspace_exit: reason 
KVM_EXIT_IO (2)

qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_entry: vcpu 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_exit: reason EPT_MISCONFIG 
rip 0x86e0 info 0 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_emulate_insn: [FAILED TO 
PARSE] rip=34528 csbase=0 len=3 insn=ˆF@Š„Òuõ‰L$ flags=5 failed=0
qemu-kvm-1.0.1-5107 [007] 410771.148000: vcpu_match_mmio: gva 0xb873c 
gpa 0xb873c Write GPA
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_mmio: mmio write len 1 gpa 
0xb873c val 0x6f

qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_entry: vcpu 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_exit: 

Re: [Qemu-devel] memtest 4.20+ does not work with -cpu host

2012-09-10 Thread Paolo Bonzini
Il 10/09/2012 13:06, Peter Lieven ha scritto:
 
 qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_entry: vcpu 0
 qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_exit: reason MSR_READ rip
 0x11478 info 0 0
 qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_msr: msr_read 194 = 0x0 (#GP)
 qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_inj_exception: #GP (0x0)
 qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_entry: vcpu 0
 qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_exit: reason TRIPLE_FAULT
 rip 0x11478 info 0 0

Memory controller MSR:

static float getNHMmultiplier(void)
{
unsigned int msr_lo, msr_hi;
float coef;

/* Find multiplier (by MSR) */
/* First, check if Flexible Ratio is Enabled */
rdmsr(0x194, msr_lo, msr_hi);
if((msr_lo  16)  1){
coef = (msr_lo  8)  0xFF;
 } else {
rdmsr(0xCE, msr_lo, msr_hi);
coef = (msr_lo  8)  0xFF;
 }

return coef;
}

Looks like we need to emulate it since memtest only looks at the cpuid
to detect an integrated memory controller.  What does this return for you?

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



Re: [Qemu-devel] memtest 4.20+ does not work with -cpu host

2012-09-10 Thread Peter Lieven

On 09/10/12 13:29, Paolo Bonzini wrote:

Il 10/09/2012 13:06, Peter Lieven ha scritto:

qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_entry: vcpu 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_exit: reason MSR_READ rip
0x11478 info 0 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_msr: msr_read 194 = 0x0 (#GP)
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_inj_exception: #GP (0x0)
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_entry: vcpu 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_exit: reason TRIPLE_FAULT
rip 0x11478 info 0 0

Memory controller MSR:

static float getNHMmultiplier(void)
{
 unsigned int msr_lo, msr_hi;
 float coef;

 /* Find multiplier (by MSR) */
 /* First, check if Flexible Ratio is Enabled */
 rdmsr(0x194, msr_lo, msr_hi);
 if((msr_lo  16)  1){
 coef = (msr_lo  8)  0xFF;
  } else {
 rdmsr(0xCE, msr_lo, msr_hi);
 coef = (msr_lo  8)  0xFF;
  }

 return coef;
}

Looks like we need to emulate it since memtest only looks at the cpuid
to detect an integrated memory controller.  What does this return for you?

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

I/O error.

Peter




Re: [Qemu-devel] memtest 4.20+ does not work with -cpu host

2012-09-10 Thread Peter Lieven

On 09/10/12 13:29, Paolo Bonzini wrote:

Il 10/09/2012 13:06, Peter Lieven ha scritto:

qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_entry: vcpu 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_exit: reason MSR_READ rip
0x11478 info 0 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_msr: msr_read 194 = 0x0 (#GP)
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_inj_exception: #GP (0x0)
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_entry: vcpu 0
qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_exit: reason TRIPLE_FAULT
rip 0x11478 info 0 0

Memory controller MSR:

static float getNHMmultiplier(void)
{
 unsigned int msr_lo, msr_hi;
 float coef;

 /* Find multiplier (by MSR) */
 /* First, check if Flexible Ratio is Enabled */
 rdmsr(0x194, msr_lo, msr_hi);
 if((msr_lo  16)  1){
 coef = (msr_lo  8)  0xFF;
  } else {
 rdmsr(0xCE, msr_lo, msr_hi);
 coef = (msr_lo  8)  0xFF;
  }

 return coef;
}

Looks like we need to emulate it since memtest only looks at the cpuid
to detect an integrated memory controller.  What does this return for you?

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.

peter




Re: [Qemu-devel] memtest 4.20+ does not work with -cpu host

2012-09-10 Thread Avi Kivity
On 09/10/2012 02:29 PM, Paolo Bonzini wrote:
 Il 10/09/2012 13:06, Peter Lieven ha scritto:
 
 qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_entry: vcpu 0
 qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_exit: reason MSR_READ rip
 0x11478 info 0 0
 qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_msr: msr_read 194 = 0x0 (#GP)
 qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_inj_exception: #GP (0x0)
 qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_entry: vcpu 0
 qemu-kvm-1.0.1-5107 [007] 410771.148000: kvm_exit: reason TRIPLE_FAULT
 rip 0x11478 info 0 0
 
 Memory controller MSR:
 
 static float getNHMmultiplier(void)
 {
 unsigned int msr_lo, msr_hi;
 float coef;
 
 /* Find multiplier (by MSR) */
 /* First, check if Flexible Ratio is Enabled */
 rdmsr(0x194, msr_lo, msr_hi);
 if((msr_lo  16)  1){
 coef = (msr_lo  8)  0xFF;
  } else {
 rdmsr(0xCE, msr_lo, msr_hi);
 coef = (msr_lo  8)  0xFF;
  }
 
 return coef;
 }
 

The SDM only mentions 0x194 as a machine check exception register
(recorded R12).

In the Architectural MSRs (how I love that name) section 18AH-197H are
listed as reserved.

In the Nehalem section they're not there at all.



-- 
error compiling committee.c: too many arguments to function



Re: [Qemu-devel] memtest 4.20+ does not work with -cpu host

2012-09-10 Thread Paolo Bonzini
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



Re: [Qemu-devel] memtest 4.20+ does not work with -cpu host

2012-09-10 Thread Gleb Natapov
On Mon, Sep 10, 2012 at 02:15:49PM +0200, Paolo Bonzini wrote:
 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:
 
There is rdmsr/wrmsr in msr-tools.

 #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
 --
 To unsubscribe from this list: send the line unsubscribe kvm in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Gleb.



Re: [Qemu-devel] memtest 4.20+ does not work with -cpu host

2012-09-10 Thread Avi Kivity
On 09/10/2012 03:29 PM, Peter Lieven wrote:
 On 09/10/12 14:21, Gleb Natapov wrote:
 On Mon, Sep 10, 2012 at 02:15:49PM +0200, Paolo Bonzini wrote:
 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:

 There is rdmsr/wrmsr in msr-tools.
 rdmsr returns it cannot read those MSRs. regardless if I use -cpu host
 or -cpu qemu64.

On the host.


-- 
error compiling committee.c: too many arguments to function



Re: [Qemu-devel] memtest 4.20+ does not work with -cpu host

2012-09-10 Thread Peter Lieven

On 09/10/12 14:32, Avi Kivity wrote:

On 09/10/2012 03:29 PM, Peter Lieven wrote:

On 09/10/12 14:21, Gleb Natapov wrote:

On Mon, Sep 10, 2012 at 02:15:49PM +0200, Paolo Bonzini wrote:

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:


There is rdmsr/wrmsr in msr-tools.

rdmsr returns it cannot read those MSRs. regardless if I use -cpu host
or -cpu qemu64.

On the host.

aaah ok:

#rdmsr -0 0x194
00011100
#rdmsr -0 0xce
0c0004011103

Peter








Re: [Qemu-devel] memtest 4.20+ does not work with -cpu host

2012-09-10 Thread Peter Lieven

On 09/10/12 14:21, Gleb Natapov wrote:

On Mon, Sep 10, 2012 at 02:15:49PM +0200, Paolo Bonzini wrote:

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:


There is rdmsr/wrmsr in msr-tools.
rdmsr returns it cannot read those MSRs. regardless if I use -cpu host 
or -cpu qemu64.


peter

#includefcntl.h
#includestdio.h
#includestdlib.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
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Gleb.





Re: [Qemu-devel] memtest 4.20+ does not work with -cpu host

2012-09-06 Thread Avi Kivity
On 08/22/2012 06:06 PM, Peter Lieven wrote:
 Hi,
 
 has anyone ever tested to run memtest with -cpu host flag passed to
 qemu-kvm?
 For me it resets when probing the chipset. With -cpu qemu64 it works
 just fine.
 
 Maybe this is specific to memtest, but it might be sth that can happen
 in other
 applications to.
 
 Any thoughts?

Try to identify the cpu flag that causes this by removing them
successively (-cpu host,-flag...).  Alternatively capture a trace
(http://www.linux-kvm.org/page/Tracing) look for TRIPLE_FAULT (Intel),
and post the few hundred lines preceding it.


-- 
error compiling committee.c: too many arguments to function



[Qemu-devel] memtest 4.20+ does not work with -cpu host

2012-08-22 Thread Peter Lieven

Hi,

has anyone ever tested to run memtest with -cpu host flag passed to 
qemu-kvm?
For me it resets when probing the chipset. With -cpu qemu64 it works 
just fine.


Maybe this is specific to memtest, but it might be sth that can happen 
in other

applications to.

Any thoughts?

Thanks,
Peter