xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@amd.com>
To: Keir Fraser <keir.fraser@eu.citrix.com>,
	Nitin Kamble <nitin.a.kamble@intel.com>
Cc: xen-devel <xen-devel@lists.xensource.com>
Subject: [PATCH] libxc: remove CPUID core information mangling
Date: Wed, 25 Aug 2010 14:04:10 +0200	[thread overview]
Message-ID: <4C7506BA.4000001@amd.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 813 bytes --]

Hi,

c/s 18560:782599274bf9ae8857c55856c9c7fdf082967808 introduced CPUID 
mangling resulting in a doubled number of cores/processor exposed to the 
guest. According to comments in this patch the rationale behind this is 
to match the APIC numbering used by Xen.
In my understanding the CPUID leafs dealing with number of cores always 
talk about logical numbers and not APIC IDs. So we don't need to adjust 
the CPUID readout to match the APIC ID enumeration scheme.
If there were any serious reasons resulting in the old patch I'd love to 
hear them.

The attached patch fixes this and solves an issue I saw with certain 
NUMA guest configurations.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>

-- 
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany
Tel: +49 351 448-3567-12

[-- Attachment #2: fix_cpuid_core_mangling.patch --]
[-- Type: text/x-patch, Size: 1346 bytes --]

diff -r eccfdeb41b80 tools/libxc/xc_cpuid_x86.c
--- a/tools/libxc/xc_cpuid_x86.c	Tue Aug 24 18:42:59 2010 +0100
+++ b/tools/libxc/xc_cpuid_x86.c	Wed Aug 25 13:34:54 2010 +0200
@@ -117,9 +117,8 @@
     case 0x80000008:
         /*
          * ECX[15:12] is ApicIdCoreSize: ECX[7:0] is NumberOfCores (minus one).
-         * Update to reflect vLAPIC_ID = vCPU_ID * 2.
          */
-        regs[2] = ((regs[2] & 0xf000u) + 1) | ((regs[2] & 0xffu) << 1) | 1u;
+        regs[2] &= 0xf0ffu;
         break;
     }
 }
@@ -134,11 +133,9 @@
     case 0x00000004:
         /*
          * EAX[31:26] is Maximum Cores Per Package (minus one).
-         * Update to reflect vLAPIC_ID = vCPU_ID * 2.
          */
-        regs[0] = (((regs[0] & 0x7c000000u) << 1) | 0x04000000u |
-                   (regs[0] & 0x3ffu));
-        regs[3] &= 0x3ffu;
+        regs[0] &= 0xfc0003ffu;
+        regs[3] &= 0x00000003u;
         break;
 
     case 0x80000001: {
@@ -185,9 +182,8 @@
     case 0x00000001:
         /*
          * EBX[23:16] is Maximum Logical Processors Per Package.
-         * Update to reflect vLAPIC_ID = vCPU_ID * 2.
          */
-        regs[1] = (regs[1] & 0x0000ffffu) | ((regs[1] & 0x007f0000u) << 1);
+        regs[1] & 0x00ffffffu;
 
         regs[2] &= (bitmaskof(X86_FEATURE_XMM3) |
                     bitmaskof(X86_FEATURE_SSSE3) |

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

             reply	other threads:[~2010-08-25 12:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-25 12:04 Andre Przywara [this message]
2010-08-25 12:42 ` [PATCH] libxc: remove CPUID core information mangling Keir Fraser
2010-08-25 15:28   ` Huang2, Wei
2010-08-25 15:39     ` Keir Fraser
2010-08-25 15:53       ` Huang2, Wei
2010-08-25 16:00         ` Keir Fraser
2010-08-26 20:48           ` Andre Przywara
2010-08-25 15:25 ` [osrc-patches] " Huang2, Wei

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=4C7506BA.4000001@amd.com \
    --to=andre.przywara@amd.com \
    --cc=keir.fraser@eu.citrix.com \
    --cc=nitin.a.kamble@intel.com \
    --cc=xen-devel@lists.xensource.com \
    /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).