xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Don Slutz <dslutz@verizon.com>
To: Eric Shelton <eshelton@pobox.com>, Jan Beulich <JBeulich@suse.com>
Cc: Kevin Tian <kevin.tian@intel.com>, Keir Fraser <keir@xen.org>,
	Ian Campbell <Ian.Campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Tim Deegan <tim@xen.org>, Don Slutz <dslutz@verizon.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
	Eddie Dong <eddie.dong@intel.com>,
	Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>,
	Jun Nakajima <jun.nakajima@intel.com>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: Re: [PATCH v4 01/16] xen: Add support for VMware cpuid leaves
Date: Mon, 22 Sep 2014 14:21:44 -0400	[thread overview]
Message-ID: <542068B8.2020304@terremark.com> (raw)
In-Reply-To: <CAPQw5r=ibij6-AbX0_J0-EA0uTvDx8VkqN5YahPVqURY6pyYfw@mail.gmail.com>

On 09/17/14 00:30, Eric Shelton wrote:
> On 15.09.14 at 08:42, Jan Beulich wrote:
> >>>> On 12.09.14 at 19:46, <dslutz@verizon.com 
> <mailto:dslutz@verizon.com>> wrote:
> >> On 09/12/14 05:49, Jan Beulich wrote:
> >>>>>> On 11.09.14 at 21:49, <andrew.cooper3@citrix.com 
> <mailto:andrew.cooper3@citrix.com>> wrote:
> >>>>> +    case 0x10:
> >>>>> +        /* (Virtual) TSC frequency in kHz. */
> >>>>> +        *eax =  d->arch.tsc_khz;
> >>>>> +        /* (Virtual) Bus (local apic timer) frequency in kHz. */
> >>>>> +        *ebx = 1000000000ull / APIC_BUS_CYCLE_NS / 1000ull;
> >>>> At least 1 pair of brackets please, especially as the placement of
> >>>> brackets affects the result of this particular calculation.
> >>> Or simply eliminate one of the divisions using
> >>> "1000000ull / APIC_BUS_CYCLE_NS".
> >>
> >> I am totally confused.  I am happy to go with Jan's version.
> >>
> >> The confusion is that I get the same answer all the ways I try.
> >
> > Hmm - this ...
> >
> >>        ebx1 = 1000000000ull / APIC_BUS_CYCLE_NS / 1000ull;
> >>        ebx2 = (1000000000ull / APIC_BUS_CYCLE_NS) / 1000ull;
> >>        ebx3 = 1000000000ull / (APIC_BUS_CYCLE_NS * 1000ull);
> >
> > ... clearly indicates the contrary: You converted to mutiplication
> >here, when the respective possibility of putting parentheses here
> >would have been
> >
> > ebx3 = 1000000000ull / (APIC_BUS_CYCLE_NS / 1000ull);
> >
> >which I'm sure you agree won't produce the same result. But yes,
> >the language implies parentheses this way
> >
> > ebx2 = (1000000000ull / APIC_BUS_CYCLE_NS) / 1000ull;
> >
> >so the original expression without them was correct, just
> >slightly ambiguous.
> >
> >Jan
>
> A different approach for the bus frequency, taken in the patch I just 
> posted, is to provide the actual bus frequency, rather than a 
> hardcoded value.  Specifically, the value bus_freq in apic.c.
>

This is not the correct bus frequency for the vlapic code.

I have a server where the host:
...
(XEN) ..... host bus clock speed is 200.0108 MHz.

But the guest sees:
...
..... host bus clock speed is 99.0999 MHz.

(do to a bug in Linux, this is not displayed correctly, the real value 
is 99.999 MHz
because "CONFIG_HZ=1000" not 100)

I also see:
..... host bus clock speed is 100.0000 MHz.


So reporting the 200.0108 to the guest would be wrong.

(And on a different server I have:

(XEN) ..... host bus clock speed is 100.0010 MHz.

for the host; which is closer but still not right).

    -Don Slutz

> Additionally, I propose Xen provides the 0x40000010 timing info leaf 
> for all domains, not just those operating under a VMware compatability 
> mode.  This is the approach taken in my proposed patch.  OS X will 
> happily use the 0x40000010 leaf even if the hypervisor vendor ID does 
> not indicate VMware.  Use of this leaf ended up being the only way I 
> managed to find to get OS X to configure its timers correctly on a 
> Haswell system.
>
> Eric
>

  reply	other threads:[~2014-09-22 18:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-17  4:30 [PATCH v4 01/16] xen: Add support for VMware cpuid leaves Eric Shelton
2014-09-22 18:21 ` Don Slutz [this message]
2014-09-22 19:55   ` Eric Shelton
  -- strict thread matches above, loose matches on Subject: below --
2014-09-11 18:36 [PATCH v4 00/16] Xen VMware tools support Don Slutz
2014-09-11 18:36 ` [PATCH v4 01/16] xen: Add support for VMware cpuid leaves Don Slutz
2014-09-11 19:49   ` Andrew Cooper
2014-09-12  9:49     ` Jan Beulich
2014-09-12 17:46       ` Don Slutz
2014-09-15  7:42         ` Jan Beulich
2014-09-17 15:41           ` Don Slutz
2014-09-12 21:26     ` Don Slutz
2014-09-12 12:37   ` Boris Ostrovsky
2014-09-12 17:50     ` Don Slutz

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=542068B8.2020304@terremark.com \
    --to=dslutz@verizon.com \
    --cc=Aravind.Gopalakrishnan@amd.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=eddie.dong@intel.com \
    --cc=eshelton@pobox.com \
    --cc=jun.nakajima@intel.com \
    --cc=keir@xen.org \
    --cc=kevin.tian@intel.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.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).