qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Lieven <pl@dlhnet.de>
To: Gleb Natapov <gleb@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>, 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: Thu, 13 Sep 2012 14:56:33 +0200	[thread overview]
Message-ID: <5051D801.6020302@dlhnet.de> (raw)
In-Reply-To: <20120913124227.GE20907@redhat.com>

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
>>>>>>>>> 0000000000011100
>>>>>>>>> #rdmsr -0 0xce
>>>>>>>>> 00000c0004011103
>>>>>>> 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   133333333ULL
#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

  reply	other threads:[~2012-09-13 12:56 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
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 [this message]
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=5051D801.6020302@dlhnet.de \
    --to=pl@dlhnet.de \
    --cc=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --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).