]> xenbits.xensource.com Git - libvirt.git/commitdiff
S390: Fixed core identification for s390
authorViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Fri, 22 Jun 2012 11:50:13 +0000 (13:50 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 25 Jun 2012 14:43:18 +0000 (16:43 +0200)
For the s390x architecture the sysfs core_id alone is not unique. As a
result it can happen that libvirt thinks there are less host CPUs available
than really present.
Currently, a logical CPU is equivalent to a core for s390x. We therefore
produce a fake core id from the CPU number.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
src/nodeinfo.c

index 7eb5ae5463373d9d155c19078a4c4d048e48288e..819f9541b3327a57dcdb45b646b205105e5a53fb 100644 (file)
@@ -355,7 +355,13 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
         nodeinfo->cpus++;
 
         /* Parse core */
+# if defined(__s390__) || \
+    defined(__s390x__)
+    /* logical cpu is equivalent to a core on s390 */
+        core = cpu;
+# else
         core = virNodeGetCpuValue(sysfs_cpudir, cpu, "topology/core_id", false);
+# endif
         if (!CPU_ISSET(core, &core_mask)) {
             CPU_SET(core, &core_mask);
             nodeinfo->cores++;