|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v8 3/6] Kconfig: Make cpu hotplug configurable
For the purposes of certification, we want as little code as possible to
be unconditionally compiled in. Make CPU hotplug and SMT operations
configurable to ease the process. This will also help with introducing
CPU hotplug on Arm, where it needs to be configurable.
Signed-off-by: Mykyta Poturai <mykyta_poturai@xxxxxxxx>
---
v7->v8:
* fix style
* s/CPU_HOTPLUG/CPU_ONLINE_OFFLINE/
v6->v7:
* new patch
---
xen/arch/x86/platform_hypercall.c | 12 ++++++++++++
xen/arch/x86/smp.c | 3 +++
xen/arch/x86/sysctl.c | 12 ++++++++++++
xen/common/Kconfig | 8 ++++++++
4 files changed, 35 insertions(+)
diff --git a/xen/arch/x86/platform_hypercall.c
b/xen/arch/x86/platform_hypercall.c
index 0431f875af..3f6789c8b7 100644
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -735,6 +735,12 @@ ret_t do_platform_op(
{
int cpu = op->u.cpu_ol.cpuid;
+ if ( !IS_ENABLED(CONFIG_CPU_ONLINE_OFFLINE) )
+ {
+ ret = -EOPNOTSUPP;
+ break;
+ }
+
ret = xsm_resource_plug_core(XSM_HOOK);
if ( ret )
break;
@@ -761,6 +767,12 @@ ret_t do_platform_op(
{
int cpu = op->u.cpu_ol.cpuid;
+ if ( !IS_ENABLED(CONFIG_CPU_ONLINE_OFFLINE) )
+ {
+ ret = -EOPNOTSUPP;
+ break;
+ }
+
ret = xsm_resource_unplug_core(XSM_HOOK);
if ( ret )
break;
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 7936294f5f..9046c826f8 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -418,6 +418,7 @@ void cf_check call_function_interrupt(void)
smp_call_function_interrupt();
}
+#ifdef CONFIG_CPU_ONLINE_OFFLINE
long cf_check cpu_up_helper(void *data)
{
unsigned int cpu = (unsigned long)data;
@@ -445,8 +446,10 @@ long cf_check cpu_down_helper(void *data)
{
int cpu = (unsigned long)data;
int ret = cpu_down(cpu);
+
/* Have one more go on EBUSY. */
if ( ret == -EBUSY )
ret = cpu_down(cpu);
return ret;
}
+#endif
diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c
index 0fbbdd8b28..1d0857b502 100644
--- a/xen/arch/x86/sysctl.c
+++ b/xen/arch/x86/sysctl.c
@@ -53,6 +53,12 @@ static long cf_check smt_up_down_helper(void *data)
unsigned int cpu, sibling_mask = boot_cpu_data.x86_num_siblings - 1;
int ret = 0;
+ if ( !IS_ENABLED(CONFIG_CPU_ONLINE_OFFLINE) )
+ {
+ ASSERT_UNREACHABLE();
+ return -EOPNOTSUPP;
+ }
+
opt_smt = up;
for_each_present_cpu ( cpu )
@@ -121,6 +127,12 @@ long arch_do_sysctl(
long (*fn)(void *data);
void *hcpu;
+ if ( !IS_ENABLED(CONFIG_CPU_ONLINE_OFFLINE) )
+ {
+ ret = -EOPNOTSUPP;
+ break;
+ }
+
switch ( op )
{
case XEN_SYSCTL_CPU_HOTPLUG_ONLINE:
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 0a20aa0a12..9fc53fde48 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -636,6 +636,14 @@ config SYSTEM_SUSPEND
If unsure, say N.
+config CPU_ONLINE_OFFLINE
+ bool "CPU online/offline support"
+ depends on X86
+ default y
+ help
+ Enable support for bringing CPUs online and offline at runtime. On
+ X86 this is required for disabling SMT.
+
menu "Supported hypercall interfaces"
visible if EXPERT
--
2.51.2
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |