Design document | |
---|---|
Revision | v1 |
Status | released (5.6) |
Review | create new issue |
cpuid
instruction is used to obtain a CPU’s manufacturer,
family, model, stepping and features information.base_ecx
, base_edx
, ext_ecx
and ext_edx
(after the registers used by cpuid
to store the results).base_ecx
and base_edx
). The
newer Nehalem and Westmere CPUs support extended-feature masking
as well.cpuid
to obtain the
(possibly modified) CPU info, or can obtain this information from
Xen. Masking is done only by Xen at boot time, before any domains
are loaded./boot/extlinux.conf
. After a reboot,
the mask will be enforced.Currently, the datamodel has Host_cpu
objects for each CPU core in a
host. As they are all identical, we are considering keeping just one CPU
record in the Host
object itself, and deprecating the Host_cpu
class. For backwards compatibility, the Host_cpu
objects will remain
as they are in MNR, but may be removed in subsequent releases.
Hence, there will be a new field called Host.cpu_info
, a read-only
string-string map, containing the following fixed set of keys:
Key name | Description |
---|---|
cpu_count |
The number of CPU cores in the host. |
family |
The family (number) of the CPU. |
features |
The current (possibly masked) feature vector, as given by cpuid . Format: "<base_ecx>-<base_edx>-<ext_ecx>-<ext_edx>" , 4 groups of 8 hexadecimal digits, separated by dashes. |
features_after_reboot |
The feature vector to be used after rebooting the host. This field can be modified by calling Host.set_cpu_features . Same format as features . |
flags |
The flags of the physical CPU (a decoded version of the features field). |
maskable |
Indicating whether the CPU supports Intel FlexMigration or AMD Extended Migration. There are three possible values: "no" means that masking is not possible, "base" means that only base features can be masked, and "full" means that base as well as extended features can be masked. |
model |
The model number of the CPU. |
modelname |
The model name of the CPU. |
physical_features |
The original, unmasked features. Same format as features . |
speed |
The speed of the CPU. |
stepping |
The stepping of the CPU. |
vendor |
The manufacturer of the CPU. |
Indicating whether the CPU supports Intel FlexMigration or AMD Extended
Migration. There are three possible values: "no"
means that masking is
not possible, "base"
means that only base features can be masked, and
"full"
means that base as well as extended features can be masked.
Note: When the features
and features_after_reboot
are different,
XenCenter could display a warning saying that a reboot is needed to
enforce the feature masking.
The Pool.other_config:cpuid_feature_mask
key is recognised. If this
key is present and if it contains a value in the same format as
Host.cpu_info:features
, the value is used to mask the feature vectors
before comparisons during any pool join in the pool it is defined on.
This can be used to white-list certain feature flags, i.e. to ignore
them when adding a new host to a pool. The default it
ffffff7f-ffffffff-ffffffff-ffffffff
, which white-lists the EST feature
for compatibility with XS 5.5 and earlier.
New messages:
Host.set_cpu_features
host
, new CPU feature vector
features
.Host.cpu_info:features_after_reboot
), if features
is valid.Host.reset_cpu_features
host
.xc_get_boot_cpufeatures
in libxc./etc/xensource/libexec/xen-cmdline
, which provides a
future-proof way of modifying the Xen command-line key/value pairs.
This script has the following options, where mask
is one of
cpuid_mask_ecx
, cpuid_mask_edx
, cpuid_mask_ext_ecx
or
cpuid_mask_ext_edx
, and value
is 0xhhhhhhhh
(h
is represents
a hex digit).:
--list-cpuid-masks
--set-cpuid-masks mask=value mask=value
--delete-cpuid-masks mask mask
restrict_cpu_masking
key has been added to the host licensing
restrictions map. This will be true
when the Host.edition
is
free
, and false
if it is enterprise
or platinum
.The Host.cpu_info
field is refreshed:
cpu_count
, vendor
, speed
, modelname
,
flags
, stepping
, model
, and family
are obtained from
/etc/xensource/boot_time_cpus
(and ultimately from
/proc/cpuinfo
).features
and physical_features
are obtained
from Xen and the features_after_reboot
key is made equal to the
features
field.maskable
key is determined by the CPU details.
family = 6 and (model = 1dh or (model = 17h and stepping >= 4))
(maskable = "base"
)family = 6 and ((model = 1ah and stepping > 2) or model = 1eh or model = 25h or model = 2ch or model = 2eh or model = 2fh)
(maskable = "full"
)family >= 10h
(maskable = "full"
)Host.set_cpu_features
call:
features_after_reboot
to the given feature
vector.xen-cmdline
script. The mask is represented by one or more of
the following key/value pairs (where h
represents a hex
digit):
cpuid_mask_ecx=0xhhhhhhhh
cpuid_mask_edx=0xhhhhhhhh
cpuid_mask_ext_ecx=0xhhhhhhhh
cpuid_mask_ext_edx=0xhhhhhhhh
Host.reset_cpu_features
call:
physical_features
to features_after_reboot
.xen-cmdline
script (if any).Pool.join
fails when the vendor
and feature
keys do not match,
and disregards any other key in Host.cpu_info
.
Pool.other_config:cpuid_feature_mask
. The value of this
field should have the same format as Host.cpu_info:features
.
When comparing the CPUID features of the pool and the joining
host for equality, this mask is applied before the comparison.
The default is ffffff7f-ffffffff-ffffffff-ffffffff
, which
defines the EST feature, bit 7 of the base ecx flags, as “don’t
care”.Pool.eject
clears the database (as usual), and additionally
removes the feature mask from /boot/extlinux.conf
(if any).New commands:
host-cpu-info
uuid
(optional, uses localhost if absent).Host.cpu_info
associated with the host.host-get-cpu-features
uuid
(optional, uses localhost if absent).Host.cpu_info:features]
associated with
the host.host-set-cpu-features
features
(string of 32 hexadecimal digits,
optionally containing spaces or dashes), uuid
(optional, uses
localhost if absent).Host.set_cpu_features
.host-reset-cpu-features
uuid
(optional, uses localhost if absent).Host.reset_cpu_features
.The following commands will be deprecated: host-cpu-list
,
host-cpu-param-get
, host-cpu-param-list
.
WARNING:
If the user is able to set any mask they like, they may end up disabling CPU features that are required by dom0 (and probably other guest OSes), resulting in a kernel panic when the machine restarts. Hence, using the set function is potentially dangerous.
It is apparently not easy to find out exactly which flags are safe to mask and which aren’t, so we cannot prevent an API/CLI user from making mistakes in this way. However, using XenCenter would always be safe, as XC always copies features masks from real hosts.
If a machine ends up in such a bad state, there is a way to get out of it. At the boot prompt (before Xen starts), you can type “menu.c32”, select a boot option and alter the Xen command-line to remove the feature masks, after which the machine will again boot normally (note: in our set-up, there is first a PXE boot prompt; the second prompt is the one we mean here).
The API/CLI documentation should stress the potential danger of using this functionality, and explain how to get out of trouble again.