Skip to contentSkip to conversation

libxc: set CPUID topology leaf as unsupported for PV guests

PATCH In review David Vrabel 4 participants 5 messages Jul 14, 2011 – Jul 15, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxc: set CPUID topology leaf as unsupported for PV guests

# HG changeset patch
# User David Vrabel <[email protected]>
# Date 1310643124 -3600
# Branch cpuid
# Node ID b3705aae543b95fd7f6bb38c21b5f1edd2b70609 # Parent 98701b1276c034b2bbbc8c7a975cf4c361caaa63
libxc: set CPUID topology leaf as unsupported for PV guests

The result of a CPUID Extended Topology Enumeration leaf for PV guests is invalid as the level in ECX is ignored. This can cause some guests to loop endlessly when trying to enumerate the topology.

Since the physical topology isn't useful to PV guests set the topology leaf as unsupported.

Guests affected include Linux kernels prior 2.6.32 where a workaround was applied ("xen: mask extended topology info in cpu", 82d6469916c6fcfa345636a49004c9d1753905d1).

tools/libxc/xc_cpuid_x86.c +5 -0
diff -r 98701b1276c0 -r b3705aae543b tools/libxc/xc_cpuid_x86.c
@@ -487,6 +487,11 @@ static void xc_cpuid_pv_policy(
         regs[0] = regs[2] = regs[3] = 0;
         break;
 
+    case 0x0000000b:
+        /* Extended Topology Enumeration leaf is unsupported. */
+        regs[0] = regs[1] = regs[2] = regs[3] = 0;
+        break;
+
     case 0x0000000d:
         xc_cpuid_config_xsave(xch, domid, xfeature_mask, input, regs);
         break;
#1 lore raw
Quoted 8 lines · David Vrabel

# HG changeset patch
# User David Vrabel <[email protected]>
# Date 1310643124 -3600
# Branch cpuid
# Node ID b3705aae543b95fd7f6bb38c21b5f1edd2b70609 # Parent 98701b1276c034b2bbbc8c7a975cf4c361caaa63
libxc: set CPUID topology leaf as unsupported for PV guests

Quoted 6 lines

The result of a CPUID Extended Topology Enumeration leaf for PV guests is invalid as the level in ECX is ignored. This can cause some guests to loop endlessly when trying to enumerate the topology.

Since the physical topology isn't useful to PV guests set the topology leaf as unsupported.

For future reference, you also need to modify
xen/arch/x86/traps.c:pv_cpuid(), for dom0.

-- Keir

Quoted 26 lines

Guests affected include Linux kernels prior 2.6.32 where a workaround was applied ("xen: mask extended topology info in cpu", 82d6469916c6fcfa345636a49004c9d1753905d1).

diff -r 98701b1276c0 -r b3705aae543b tools/libxc/xc_cpuid_x86.c

tools/libxc/xc_cpuid_x86.c Thu Jul 14 12:32:04 2011 +0100 renamed from tools/libxc/xc_cpuid_x86.c Thu Jul 14 09:43:37 2011 +0100 +5 -0
@@ -487,6 +487,11 @@ static void xc_cpuid_pv_policy(
         regs[0] = regs[2] = regs[3] = 0;
         break;
 
+    case 0x0000000b:
+        /* Extended Topology Enumeration leaf is unsupported. */
+        regs[0] = regs[1] = regs[2] = regs[3] = 0;
+        break;
+
     case 0x0000000d:
         xc_cpuid_config_xsave(xch, domid, xfeature_mask, input, regs);
         break;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
Quoted 14 lines · Keir Fraser
Quoted 12 lines · David Vrabel

# HG changeset patch
# User David Vrabel <[email protected]>
# Date 1310643124 -3600
# Branch cpuid
# Node ID b3705aae543b95fd7f6bb38c21b5f1edd2b70609 # Parent 98701b1276c034b2bbbc8c7a975cf4c361caaa63
libxc: set CPUID topology leaf as unsupported for PV guests

The result of a CPUID Extended Topology Enumeration leaf for PV guests is invalid as the level in ECX is ignored. This can cause some guests to loop endlessly when trying to enumerate the topology.

Quoted 5 lines
Quoted 2 lines

Since the physical topology isn't useful to PV guests set the topology leaf as unsupported.

For future reference, you also need to modify
xen/arch/x86/traps.c:pv_cpuid(), for dom0.

Aside: the cases of that switch are taking inconsistency to a new level:

$ grep -A 121 pv_cpuid\(struct xen/arch/x86/traps.c  | grep case
    case 1:
    case 7:
    case 0x80000001:
    case 0xd: /* XSAVE */
    case 5: /* MONITOR/MWAIT */
    case 0xa: /* Architectural Performance Monitor Features */
    case 0x8000000a: /* SVM revision and features */
    case 0x8000001b: /* Instruction Based Sampling */
    case 0x8000001c: /* Light Weight Profiling */
    case 0x8000001e: /* Extended topology reporting */

Yeah!

Ian.

Quoted 36 lines

-- Keir

Quoted 22 lines

Guests affected include Linux kernels prior 2.6.32 where a workaround was applied ("xen: mask extended topology info in cpu", 82d6469916c6fcfa345636a49004c9d1753905d1).

diff -r 98701b1276c0 -r b3705aae543b tools/libxc/xc_cpuid_x86.c

tools/libxc/xc_cpuid_x86.c Thu Jul 14 12:32:04 2011 +0100 renamed from tools/libxc/xc_cpuid_x86.c Thu Jul 14 09:43:37 2011 +0100 +5 -0
@@ -487,6 +487,11 @@ static void xc_cpuid_pv_policy(
         regs[0] = regs[2] = regs[3] = 0;
         break;
 
+    case 0x0000000b:
+        /* Extended Topology Enumeration leaf is unsupported. */
+        regs[0] = regs[1] = regs[2] = regs[3] = 0;
+        break;
+
     case 0x0000000d:
         xc_cpuid_config_xsave(xch, domid, xfeature_mask, input, regs);
         break;
Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw
In reply to Keir Fraser
Quoted 8 lines · Keir Fraser
Quoted 6 lines · David Vrabel

libxc: set CPUID topology leaf as unsupported for PV guests

The result of a CPUID Extended Topology Enumeration leaf for PV guests is invalid as the level in ECX is ignored. This can cause some guests to loop endlessly when trying to enumerate the topology.

Quoted 5 lines
Quoted 2 lines

Since the physical topology isn't useful to PV guests set the topology leaf as unsupported.

For future reference, you also need to modify
xen/arch/x86/traps.c:pv_cpuid(), for dom0.

Looking at the code it looks like dom0 would at least see valid data for the the topology leaf. But I guess the info makes no sense to dom0 as well as domU guests. Patch sent if you've not already fixed it up.

David

#4 lore raw
Quoted 13 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 11 lines · Keir Fraser
Quoted 8 lines · David Vrabel

libxc: set CPUID topology leaf as unsupported for PV guests

The result of a CPUID Extended Topology Enumeration leaf for PV guests is invalid as the level in ECX is ignored. This can cause some guests to loop endlessly when trying to enumerate the topology.

Since the physical topology isn't useful to PV guests set the topology leaf as unsupported.

Quoted 6 lines
Quoted 2 lines

For future reference, you also need to modify
xen/arch/x86/traps.c:pv_cpuid(), for dom0.

Looking at the code it looks like dom0 would at least see valid data for the the topology leaf. But I guess the info makes no sense to dom0 as well as domU guests. Patch sent if you've not already fixed it up.

It may make limited sense to Dom0 if "dom0_vcpus_pin" is in effect.

Jan