x86/smt: Support for enabling/disabling SMT at runtime
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 28 Mar 2019 14:37:00 +0000 (14:37 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 9 Apr 2019 18:34:41 +0000 (19:34 +0100)
commit2bed1bc241f51d6ac4baa3c991e2637728e4da6d
treea3e6db2e80748071a9ddd827f3e3acc001bcecf1
parent48dab9767d2eb173495707cb1fd8ceaf73604ac1
x86/smt: Support for enabling/disabling SMT at runtime

Currently, a user can in principle combine the output of `xl info -n`, the
APCI tables, and some manual CPUID data to figure out which CPU numbers to
feed into `xen-hptool cpu-offline` to effectively disable SMT at runtime.

A more convenient option is to teach Xen how to perform this action.

Extend XEN_SYSCTL_cpu_hotplug with two new operations.  Introduce a new
smt_up_down_helper() which wraps the cpu_{up,down}_helper() helpers with logic
which understands siblings based on their APIC_ID.

Add libxc stubs, and extend xen-hptool with smt-{enable,disable} options.
These are intended to be shorthands for a loop over cpu-{online,offline}.

To simplify the implemention, they will strictly enable/disable secondary
siblings (those with a non-zero thread id).  This functionality is intended
for use in production scenarios where debugging options such as `maxcpus=` or
other manual plug/unplug configuration has not been used.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libxc/include/xenctrl.h
tools/libxc/xc_cpu_hotplug.c
tools/misc/xen-hptool.c
xen/arch/x86/sysctl.c
xen/include/public/sysctl.h