On 05/11/2012 06:41 PM, Eric Blake wrote:
From: Osier Yang<jyang(a)redhat.com>
"Instead of developing one CPU with 12 cores, the Magny Cours is
actually two 6 core “Bulldozer” CPUs combined in to one package"
I.e, each package has two NUMA nodes, and the two numa nodes share
the same core ID set (0-6), which means parsing the cores number
from sysfs doesn't work in this case.
And the wrong CPU number could cause three problems for libvirt:
[...]
@@ -265,6 +266,23 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
&& (*p == '\0' || *p == '.' ||
c_isspace(*p)))
nodeinfo->mhz = ui;
}
+
+ if (STRPREFIX(buf, "cpu cores")) {
+ char *p;
+ unsigned int ui;
+ buf += 9;
+ while (*buf&& c_isspace(*buf))
+ buf++;
+ if (*buf != ':' || !buf[1]) {
+ nodeReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("parsing cpuinfo cpu MHz"));
Presumably were are parsing the total number of cpu cores ...
+ return -1;
+ }
+ if (virStrToLong_ui(buf+1,&p, 10,&ui) == 0
+ /* Accept trailing fractional part. */
... and they don't have fractional parts.
stepping : 1
cpu MHz : 2100.073
cache size : 512 KB
physical id : 0
siblings : 12
core id : 0
cpu cores : 12
apicid : 0
initial apicid : 0
Stefan