All of lore.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Alok Kataria <akataria@vmware.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	the arch/x86 maintainers <x86@kernel.org>,
	Greg KH <gregkh@suse.de>, "greg@kroah.com" <greg@kroah.com>,
	"ksrinivasan@novell.com" <ksrinivasan@novell.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"borislav.petkov@amd.com" <borislav.petkov@amd.com>
Subject: Re: [Patch] Skip cpu_calibrate for kernel running under hypervisors.
Date: Tue, 17 Aug 2010 20:56:34 +0200	[thread overview]
Message-ID: <20100817185634.GA10597@liondog.tnic> (raw)
In-Reply-To: <1282063532.4388.8.camel@ank32.eng.vmware.com>

From: Alok Kataria <akataria@vmware.com>
Date: Tue, Aug 17, 2010 at 09:45:32AM -0700

Hi Alok,

> > > I know it was... and calibrate_cpu() seems to be an AMD-specific
> > > function, but that's rather crappy.  I'm thinking that perhaps we should
> > > make it an x86_init function, then the AMD CPU detection can install it
> > > and the vmware hypervisor detection can uninstall it.
> > 
> > Btw, can we revisit this AMD-specific issue? IIUC, Alok you're seeing
> > a mismatch between the calibrated TSC value and the cpu frequency even
> > on cpus which have the CONSTANT_TSC bit set, i.e. their TSC is counting
> > with P0 frequency. Can you please elaborate more on what systems you're
> > seeing this (cpu family, chipset, etc)?
> 
> We have seen these issues when running inside a Virtual Machine on
> VMware's platform. Please look at the vmware_set_cpu_features function,
> it relies on the hypervisor to provide a constant/reliable TSC. Though
> still when running the kernel on virtual cpus, as compared to
> running on physical cpus, the timing characteristics are different,
> since virtual cpus have to time share physical cpus with each other,
> which may result in errors during calibration. As a result its better to
> get these values directly from the hypervisor rather than trying to
> calibrate them.

Thanks for clarifying this. I kinda stumbled over "AMD hardware" in your
previous email but now its perfectly clear.

> And just to clarify, we have never seen this on a physical machine.

Anyway, your patch got me looking into the code and currently we do
calibrate_cpu() on all AMD systems with invariant TSC. However, machines
starting with F10h revB have a setting in MSRC001_0015[24] which, when
set, denotes that the TSC counts with P0 frequency and thus equals the
core frequency. So for those machines we won't need to calibrate the cpu
frequency. I'm figuring out some additional details internally and will
be sending a fix soon.

Thanks.

-- 
Regards/Gruss,
    Boris.

  reply	other threads:[~2010-08-17 18:56 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-16 19:25 [Patch] Skip cpu_calibrate for kernel running under hypervisors Alok Kataria
2010-08-16 23:56 ` H. Peter Anvin
2010-08-17  5:51   ` Alok Kataria
2010-08-17  6:30     ` H. Peter Anvin
2010-08-17  7:05       ` Borislav Petkov
2010-08-17 16:45         ` Alok Kataria
2010-08-17 18:56           ` Borislav Petkov [this message]
2010-08-18 16:16             ` [PATCH] x86, tsc: Limit CPU frequency calibration on AMD Borislav Petkov
2010-08-18 16:23               ` H. Peter Anvin
2010-08-18 17:34                 ` Borislav Petkov
2010-08-18 17:44                   ` H. Peter Anvin
2010-08-18 17:51                   ` Alok Kataria
2010-08-18 18:45                     ` Borislav Petkov
2010-08-24 15:53                       ` [PATCH -v2] " Borislav Petkov
2010-08-24 17:51                         ` Alok Kataria
2010-08-24 22:33                         ` H. Peter Anvin
2010-08-25  7:06                           ` Borislav Petkov
2010-08-25 13:04                             ` Andreas Herrmann
2010-08-25 13:39                               ` Andreas Herrmann
2010-08-25 16:28                               ` [PATCH -v3] x86, tsc: Remove " Borislav Petkov
2010-08-25 21:36                                 ` [tip:x86/cpu] " tip-bot for Borislav Petkov
2010-08-25 22:33                                 ` [PATCH -v3] " Alok Kataria
2010-08-26  7:19                                   ` Borislav Petkov
2010-08-19 18:47               ` [PATCH] x86, tsc: Limit " john stultz
2010-08-19 20:29                 ` Borislav Petkov
2010-08-19 20:52                   ` john stultz
2010-08-17 16:48       ` [Patch] Skip cpu_calibrate for kernel running under hypervisors Alok Kataria
2010-08-17 16:49         ` H. Peter Anvin

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=20100817185634.GA10597@liondog.tnic \
    --to=bp@alien8.de \
    --cc=akataria@vmware.com \
    --cc=borislav.petkov@amd.com \
    --cc=greg@kroah.com \
    --cc=gregkh@suse.de \
    --cc=hpa@zytor.com \
    --cc=ksrinivasan@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.