]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commit
Use closest CPU model when decoding from CPUID
authorJiri Denemark <jdenemar@redhat.com>
Fri, 15 Jan 2010 15:58:59 +0000 (16:58 +0100)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Mon, 18 Jan 2010 01:40:41 +0000 (02:40 +0100)
commit322707ba8a3504278652d56b33b199ed90689416
tree9aa39e4961cc4546c23c3d800cc9b24b7d7e48db
parent3c58896eb72579ae8e2f905db2ca1b723bbffe4b
Use closest CPU model when decoding from CPUID

Current implementation of x86Decode() used for CPUID -> model+features
translation does not always select the closest CPU model. When walking
through all models from cpu_map.xml the function considers a new
candidate as a better choice than a previously selected candidate only
if the new one is a superset of the old one. In case the new candidate
is closer to host CPU but lacks some feature comparing to the old
candidate, the function does not choose well.

This patch changes the algorithm so that the closest model is always
selected. That is, the model which requires the lowest number of
additional features to describe host CPU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/cpu/cpu_x86.c