Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12:Update
xen.10697
5b508775-3-x86-cmdline-opt-to-avoid-use-of-seco...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 5b508775-3-x86-cmdline-opt-to-avoid-use-of-secondary-HTs.patch of Package xen.10697
# Commit d8f974f1a646c0200b97ebcabb808324b288fadb # Date 2018-07-19 13:43:33 +0100 # Author Jan Beulich <JBeulich@suse.com> # Committer Andrew Cooper <andrew.cooper3@citrix.com> x86: command line option to avoid use of secondary hyper-threads Shared resources (L1 cache and TLB in particular) present a risk of information leak via side channels. Provide a means to avoid use of hyperthreads in such cases. Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> --- a/docs/misc/xen-command-line.markdown +++ b/docs/misc/xen-command-line.markdown @@ -1004,6 +1004,13 @@ Set the serial transmit buffer size. Flag to enable Supervisor Mode Execution Protection +### smt (x86) +> `= <boolean>` + +Default: `true` + +Control bring up of multiple hyper-threads per CPU core. + ### snb\_igd\_quirk > `= <boolean>` --- a/xen/arch/x86/platform_hypercall.c +++ b/xen/arch/x86/platform_hypercall.c @@ -53,10 +53,6 @@ static long cpu_frequency_change_helper( return cpu_frequency_change(this_cpu(freq)); } -/* from sysctl.c */ -long cpu_up_helper(void *data); -long cpu_down_helper(void *data); - /* from core_parking.c */ long core_parking_helper(void *data); uint32_t get_cur_idle_nums(void); --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -62,6 +62,9 @@ integer_param("maxcpus", max_cpus); static bool_t __initdata disable_smep; invbool_param("smep", disable_smep); +int8_t __read_mostly opt_smt = -1; +boolean_param("smt", opt_smt); + /* **** Linux config option: propagated to domain0. */ /* "acpi=off": Sisables both ACPI table parsing and interpreter. */ /* "acpi=force": Override the disable blacklist. */ @@ -1405,7 +1408,10 @@ void __init __start_xen(unsigned long mb int ret = cpu_up(i); if ( ret != 0 ) printk("Failed to bring up CPU %u (error %d)\n", i, ret); - else if ( num_online_cpus() > max_cpus ) + else if ( num_online_cpus() > max_cpus || + (!opt_smt && + cpu_data[i].compute_unit_id == BAD_APICID && + cpumask_weight(per_cpu(cpu_sibling_mask, i)) > 1) ) { ret = cpu_down(i); if ( !ret ) --- a/xen/arch/x86/sysctl.c +++ b/xen/arch/x86/sysctl.c @@ -24,6 +24,7 @@ #include <asm/hvm/hvm.h> #include <asm/hvm/support.h> #include <asm/processor.h> +#include <asm/setup.h> #include <asm/numa.h> #include <xen/nodemask.h> #include <xen/cpu.h> @@ -33,14 +34,27 @@ long cpu_up_helper(void *data) { - int cpu = (unsigned long)data; + unsigned int cpu = (unsigned long)data; int ret = cpu_up(cpu); + if ( ret == -EBUSY ) { /* On EBUSY, flush RCU work and have one more go. */ rcu_barrier(); ret = cpu_up(cpu); } + + if ( !ret && !opt_smt && + cpu_data[cpu].compute_unit_id == BAD_APICID && + cpumask_weight(per_cpu(cpu_sibling_mask, cpu)) > 1 ) + { + ret = cpu_down_helper(data); + if ( ret ) + printk("Could not re-offline CPU%u (%d)\n", cpu, ret); + else + ret = -EPERM; + } + return ret; } --- a/xen/include/asm-x86/setup.h +++ b/xen/include/asm-x86/setup.h @@ -51,4 +51,6 @@ extern uint8_t kbd_shift_flags; extern unsigned long highmem_start; #endif +extern int8_t opt_smt; + #endif --- a/xen/include/asm-x86/smp.h +++ b/xen/include/asm-x86/smp.h @@ -59,6 +59,9 @@ int hard_smp_processor_id(void); void __stop_this_cpu(void); +long cpu_up_helper(void *data); +long cpu_down_helper(void *data); + #endif /* !__ASSEMBLY__ */ #endif
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor