x86/cpu: Improvements to get_cpu_vendor()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 16 Dec 2016 17:36:22 +0000 (17:36 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 3 Jan 2017 13:33:16 +0000 (13:33 +0000)
commite34bc403c3c7dc0075111fa9cd29e2a385bc66ed
tree4b67d7af585d918b046fdd20b8a277d9b5d6c480
parent291dcb4dd0140fac0e439760b4d51b2892ff9264
x86/cpu: Improvements to get_cpu_vendor()

Comparing 3 integers is more efficient than using strcmp(), and is more useful
to the gcv_guest case than having to fabricate a suitable string to pass.  The
gcv_host cases have both options easily to hand, and experimentally, the
resulting code is more efficient.

Update the cpu_dev structure to be more efficient.  c_vendor[] only needs to
be 8 bytes long to cover all the CPU drivers Xen has, which avoids storing an
8-byte pointer to 8 bytes of data.  Drop c_ident[1] as we have no CPU drivers
with a second ident string, and turn it into an anonymous union to allow
access to the integer values directly.

This avoids all need for the vendor_id union in update_domain_cpuid_info().

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/cpu/common.c
xen/arch/x86/cpu/cpu.h
xen/arch/x86/domctl.c
xen/include/asm-x86/processor.h