]> xenbits.xensource.com Git - people/dwmw2/xen.git/commit
libxc/x86: avoid certain overflows in CPUID APIC ID adjustments
authorJan Beulich <jbeulich@suse.com>
Tue, 24 Sep 2019 08:50:33 +0000 (10:50 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 24 Sep 2019 08:50:33 +0000 (10:50 +0200)
commitdf29d03f1d97bdde1bc0cea8ef8538d4f524b3ec
treec3697efa063a1b35380d6fc42000c59dc463d0af
parentb8443cb39b04a6449e0d093b62f10c5a89775a78
libxc/x86: avoid certain overflows in CPUID APIC ID adjustments

Recent AMD processors may report up to 128 logical processors in CPUID
leaf 1. Doubling this value produces 0 (which OSes sincerely dislike),
as the respective field is only 8 bits wide. Suppress doubling the value
(and its leaf 0x80000008 counterpart) in such a case.

Note that while there's a similar overflow in intel_xc_cpuid_policy(),
that one is being left alone for now.

Note further that while it was considered to suppress the multiplication
by 2 altogether if the host topology already provides at least one bit
of thread ID within APIC IDs, it was decided to avoid more change here
than really needed at this point.

Also zap leaf 4 (and at the same time leaf 2) EDX output for AMD, as it
should have been from the beginning.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
tools/libxc/xc_cpuid_x86.c