[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.11] x86: Don't increase ApicIdCoreSize past 7



commit 0d91d9decb54543518c3a0cb978c9bf366362b70
Author:     George Dunlap <george.dunlap@xxxxxxxxxx>
AuthorDate: Wed Dec 11 15:25:24 2019 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Dec 11 15:25:24 2019 +0100

    x86: Don't increase ApicIdCoreSize past 7
    
    Changeset ca2eee92df44 ("x86, hvm: Expose host core/HT topology to HVM
    guests") attempted to "fake up" a topology which would induce guest
    operating systems to not treat vcpus as sibling hyperthreads.  This
    involved actually reporting hyperthreading as available, but giving
    vcpus every other ApicId; which in turn led to doubling the ApicIds
    per core by bumping the ApicIdCoreSize by one.  In particular, Ryzen
    3xxx series processors, and reportedly EPYC "Rome" cpus -- have an
    ApicIdCoreSize of 7; the "fake" topology increases this to 8.
    
    Unfortunately, Windows running on modern AMD hardware -- including
    Ryzen 3xxx series processors, and reportedly EPYC "Rome" cpus --
    doesn't seem to cope with this value being higher than 7.  (Linux
    guests have so far continued to cope.)
    
    A "proper" fix is complicated and it's too late to fix it either for
    4.13, or to backport to supported branches.  As a short-term fix,
    limit this value to 7.
    
    This does mean that a Linux guest, booted on such a system without
    this change, and then migrating to a system with this change, with
    more than 64 vcpus, would see an apparent topology change.  This is a
    low enough risk in practice that enabling this limit unilaterally, to
    allow other guests to boot without manual intervention, is worth it.
    
    Reported-by: Steven Haigh <netwiz@xxxxxxxxx>
    Reported-by: Andreas Kinzler <hfp@xxxxxxxxx>
    Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
    master commit: 8c79c129a6db2220c1089e0ce5fa49e7298b1d3e
    master date: 2019-11-26 10:33:52 +0000
---
 tools/libxc/xc_cpuid_x86.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index 60d111abf7..4464fd8091 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -352,10 +352,15 @@ static void amd_xc_cpuid_policy(xc_interface *xch,
          * - going out of sync with leaf 1 EBX[23:16],
          * - incrementing ApicIdCoreSize when it's zero (which changes the
          *   meaning of bits 7:0).
+         *
+         * UPDATE: In addition to avoiding overflow, some
+         * proprietary operating systems have trouble with
+         * apic_id_size values greater than 7.  Limit the value to
+         * 7 for now.
          */
         if ( (regs[2] & 0xffu) < 0x7fu )
         {
-            if ( (regs[2] & 0xf000u) && (regs[2] & 0xf000u) != 0xf000u )
+            if ( (regs[2] & 0xf000u) && (regs[2] & 0xf000u) < 0x7000u )
                 regs[2] = ((regs[2] + 0x1000u) & 0xf000u) | (regs[2] & 0xffu);
             regs[2] = (regs[2] & 0xf000u) | ((regs[2] & 0x7fu) << 1) | 1u;
         }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.