All of lore.kernel.org
 help / color / mirror / Atom feed
From: Don Slutz <dslutz@verizon.com>
To: Jan Beulich <JBeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	xen-devel@lists.xen.org, Don Slutz <dslutz@verizon.com>
Cc: Jun Nakajima <jun.nakajima@intel.com>,
	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>,
	Eddie Dong <eddie.dong@intel.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: [PATCH v4 01/16] xen: Add support for VMware cpuid leaves
Date: Fri, 12 Sep 2014 13:46:45 -0400	[thread overview]
Message-ID: <54133185.9070203@terremark.com> (raw)
In-Reply-To: <5412DDCF020000780003465F@mail.emea.novell.com>


On 09/12/14 05:49, Jan Beulich wrote:
>>>> On 11.09.14 at 21:49, <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. This 
includes
when APIC_BUS_CYCLE_NS is other values then 10.


Some facts:
1) 1000000000 takes only 30bits, I am asking it to be 64.
2) I am only making it smaller in all cases.

I have tested this on CentOS release 6.5 (Final) both 32 and 64 and
it all says they are all the same.

Here is my testing:

build1:~/tmp/zz-div>p /etc/redhat-release
CentOS release 6.5 (Final)
build1:~/tmp/zz-div>uname -a
Linux build1 2.6.32-431.el6.i686 #1 SMP Fri Nov 22 00:26:36 UTC 2013 
i686 i686 i386 GNU/Linux
build1:~/tmp/zz-div>cat zz-div.c
#include <stdio.h>
#include <stdint.h>

int main(void)
{
     uint32_t ebx1, ebx2, ebx3, ebx4, ebx5;
     uint32_t start = 1000000000ull;
     uint32_t APIC_BUS_CYCLE_NS;

     printf("start=0x%x, %d\n\n", start, start);
     for ( APIC_BUS_CYCLE_NS = 1; APIC_BUS_CYCLE_NS < 10000; 
APIC_BUS_CYCLE_NS++ )
     {
         ebx1 = 1000000000ull / APIC_BUS_CYCLE_NS / 1000ull;
         ebx2 = (1000000000ull / APIC_BUS_CYCLE_NS) / 1000ull;
         ebx3 = 1000000000ull / (APIC_BUS_CYCLE_NS * 1000ull);
         ebx4 = 1000000000ull / 1000ull / APIC_BUS_CYCLE_NS;
         ebx5 = 1000000ull / APIC_BUS_CYCLE_NS;

         if ( ebx1 != ebx2 ||
              ebx1 != ebx3 ||
              ebx1 != ebx4 ||
              ebx1 != ebx5 )
         {
             printf("APIC_BUS_CYCLE_NS=%d:\n", APIC_BUS_CYCLE_NS);
             printf(" ebx1=0x%x, %d\n", ebx1, ebx1);
             printf(" ebx2=0x%x, %d\n", ebx2, ebx2);
             printf(" ebx3=0x%x, %d\n", ebx3, ebx3);
             printf(" ebx4=0x%x, %d\n", ebx4, ebx4);
             printf(" ebx5=0x%x, %d\n", ebx5, ebx5);
         }
     }

     return 0;
}

/*
  * Local variables:
  * mode: C
  * c-file-style: "BSD"
  * c-basic-offset: 4
  * indent-tabs-mode: nil
  * End:
  */
build1:~/tmp/zz-div>gcc -g -o zz-div zz-div.c
build1:~/tmp/zz-div>./zz-div
start=0x3b9aca00, 1000000000

build1:~/tmp/zz-div>


    -Don Slutz




>
>
> Jan
>

  reply	other threads:[~2014-09-12 17:46 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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
2014-09-11 18:36 ` [PATCH v4 02/16] tools: Add vmware_hw support Don Slutz
2014-09-11 21:09   ` Andrew Cooper
2014-09-16 16:20     ` Don Slutz
2014-09-11 18:36 ` [PATCH v4 03/16] vmware: Add VMware provided include files Don Slutz
2014-09-11 18:36 ` [PATCH v4 04/16] xen: Add is_vmware_port_enabled Don Slutz
2014-09-11 21:22   ` Andrew Cooper
2014-09-16 16:20     ` Don Slutz
2014-09-12 13:08   ` Boris Ostrovsky
2014-09-16 12:08     ` Slutz, Donald Christopher
2014-09-17 15:56       ` Boris Ostrovsky
2014-09-17 18:23         ` Slutz, Donald Christopher
2014-09-18  9:14           ` Jan Beulich
2014-09-19 12:48             ` Slutz, Donald Christopher
2014-09-18 22:53           ` Boris Ostrovsky
2014-09-19 13:24             ` Slutz, Donald Christopher
2014-09-19 15:50               ` Boris Ostrovsky
2014-09-19 17:00                 ` Slutz, Donald Christopher
2014-09-11 18:36 ` [PATCH v4 05/16] tools: Add vmware_port support Don Slutz
2014-09-11 18:36 ` [PATCH v4 06/16] xen: Convert vmware_port to xentrace usage Don Slutz
2014-09-12 13:10   ` Boris Ostrovsky
2014-09-12 23:57     ` Don Slutz
2014-09-11 18:36 ` [PATCH v4 07/16] tools: " Don Slutz
2014-09-12 13:15   ` Boris Ostrovsky
2014-09-13  0:01     ` Don Slutz
2014-09-11 18:36 ` [PATCH v4 08/16] xen: Add limited support of VMware's hyper-call rpc Don Slutz
2014-09-12 13:37   ` Boris Ostrovsky
2014-09-12 14:27     ` Jan Beulich
2014-09-16 12:38       ` Slutz, Donald Christopher
2014-09-16 12:46         ` Jan Beulich
2014-09-16 13:47           ` Slutz, Donald Christopher
2014-09-16 13:17     ` Slutz, Donald Christopher
2014-09-11 18:36 ` [PATCH v4 09/16] tools: " Don Slutz
2014-09-11 18:36 ` [PATCH v4 10/16] Add VMware tool's triggers Don Slutz
2014-09-11 18:36 ` [PATCH v4 11/16] Add live migration of VMware's hyper-call RPC Don Slutz
2014-09-12 13:54   ` Boris Ostrovsky
2014-09-16 15:48     ` Don Slutz
2014-09-11 18:36 ` [PATCH v4 12/16] Add dump of HVM_SAVE_CODE(VMPORT) to xen-hvmctx Don Slutz
2014-09-11 18:36 ` [PATCH v4 13/16] Add xen-hvm-param Don Slutz
2014-09-11 18:36 ` [PATCH v4 14/16] Add xen-vmware-guestinfo Don Slutz
2014-09-11 18:36 ` [PATCH v4 15/16] Add xen-list-vmware-guestinfo Don Slutz
2014-09-11 18:36 ` [PATCH v4 16/16] Add xen-hvm-send-trigger Don Slutz
  -- strict thread matches above, loose matches on Subject: below --
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
2014-09-22 19:55   ` Eric Shelton

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=54133185.9070203@terremark.com \
    --to=dslutz@verizon.com \
    --cc=Aravind.Gopalakrishnan@amd.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=eddie.dong@intel.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.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 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.