[PATCH OLK-6.6 0/2] arm64: Add config switch and kernel parameter for

Some features depend on cpu0. Cpu0 offline may cause some problems or malfunctions. Known dependency may be: MegaRAID Tri-Mode SAS3508 may block the reboot process after offline CPU0. Add config switch and kernel parameter for CPU0 hotplug to avoid these issues for arm64 platform. Zheng Zengkai (2): arm64: Add config switch and kernel parameter for CPU0 hotplug config: disable config ARM64_BOOTPARAM_HOTPLUG_CPU0 by default .../admin-guide/kernel-parameters.txt | 8 ++++++ arch/arm64/Kconfig | 28 +++++++++++++++++++ arch/arm64/configs/openeuler_defconfig | 1 + arch/arm64/kernel/setup.c | 21 ++++++++++++-- 4 files changed, 56 insertions(+), 2 deletions(-) -- 2.20.1

反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/3598 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/W... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/3598 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/W...

hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8RJPO CVE: NA ------------------------------------------------- New config switch CONFIG_ARM64_BOOTPARAM_HOTPLUG_CPU0 sets whether default state of arm64_cpu0_hotpluggable is on or off. If the config switch is off, arm64_cpu0_hotpluggable is off by default. But arm64_cpu0_hotpluggable can still be turned on by kernel parameter arm64_cpu0_hotplug at boot. If the config switch is on, arm64_cpu0_hotpluggable is always on. whether CPU0 is hotpluggable depends on cpu_can_disable(0) and arm64_cpu0_hotpluggable. The default value of the config switch is off. Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com> --- .../admin-guide/kernel-parameters.txt | 8 ++++++ arch/arm64/Kconfig | 28 +++++++++++++++++++ arch/arm64/kernel/setup.c | 21 ++++++++++++-- 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 022a06068306..f552d3cfae79 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -3973,6 +3973,14 @@ parameter, xsave area per process might occupy more memory on xsaves enabled systems. + arm64_cpu0_hotplug [ARM64] Turn on arm64_cpu0_hotpluggable when + CONFIG_ARM64_BOOTPARAM_HOTPLUG_CPU0 is off. + Some features depend on CPU0. Known dependency is: + MegaRAID Tri-Mode SAS3508 may block the reboot process + after offline CPU0. + If the dependencies are under your control, you can + turn on arm64_cpu0_hotplug. + nps_mtm_hs_ctr= [KNL,ARC] This parameter sets the maximum duration, in cycles, each HW thread of the CTOP can run diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 2aca373a7038..c312ee68d674 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -1456,6 +1456,34 @@ config HOTPLUG_CPU Say Y here to experiment with turning CPUs off and on. CPUs can be controlled through /sys/devices/system/cpu. +config ARM64_BOOTPARAM_HOTPLUG_CPU0 + bool "Set default setting of arm64_cpu0_hotpluggable" + default n + depends on HOTPLUG_CPU + help + Set whether default state of arm64_cpu0_hotpluggable is on or off. + + Say Y here to set arm64_cpu0_hotpluggable on by default. If this + switch is turned on, there is no need to give arm64_cpu0_hotplug + kernel parameter and arm64_cpu0_hotpluggable is on by default. + + Please note: there may be some CPU0 dependencies if you want + to enable the CPU0 hotplug feature either by this switch or by + arm64_cpu0_hotplug kernel parameter. + + For example: + We found the following issue related to CPU0 dependency: + 1. echo 0 > /sys/devices/system/cpu/cpu0/online + 2. reboot + MegaRAID Tri-Mode SAS3508 may block the reboot process. + + Please make sure the dependencies are under your control before + you enable this feature. + + Say N if you don't want to enable CPU0 hotplug feature by default. + You still can set arm64_cpu0_hotpluggable on at boot by kernel + parameter arm64_cpu0_hotplug. + # Common NUMA Features config NUMA bool "NUMA Memory Allocation and Scheduler Support" diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index 417a8a86b2db..e7da611769ce 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -57,6 +57,19 @@ static int num_standard_resources; static struct resource *standard_resources; +#ifdef CONFIG_ARM64_BOOTPARAM_HOTPLUG_CPU0 +static int arm64_cpu0_hotpluggable = 1; +#else +static int arm64_cpu0_hotpluggable; +static int __init arm64_enable_cpu0_hotplug(char *str) +{ + arm64_cpu0_hotpluggable = 1; + return 1; +} + +__setup("arm64_cpu0_hotplug", arm64_enable_cpu0_hotplug); +#endif + phys_addr_t __fdt_pointer __initdata; u64 mmu_enabled_at_boot __initdata; @@ -396,8 +409,12 @@ static inline bool cpu_can_disable(unsigned int cpu) #ifdef CONFIG_HOTPLUG_CPU const struct cpu_operations *ops = get_cpu_ops(cpu); - if (ops && ops->cpu_can_disable) - return ops->cpu_can_disable(cpu); + if (ops && ops->cpu_can_disable) { + if (cpu == 0) + return ops->cpu_can_disable(0) && arm64_cpu0_hotpluggable; + else + return ops->cpu_can_disable(cpu); + } #endif return false; } -- 2.20.1

hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8RJPO CVE: NA ------------------------------------------------- Disable config ARM64_BOOTPARAM_HOTPLUG_CPU0 in openeuler_defconfig by default. Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com> --- arch/arm64/configs/openeuler_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/configs/openeuler_defconfig b/arch/arm64/configs/openeuler_defconfig index 9297e3ca9f92..f5f5743898d6 100644 --- a/arch/arm64/configs/openeuler_defconfig +++ b/arch/arm64/configs/openeuler_defconfig @@ -427,6 +427,7 @@ CONFIG_SCHED_CLUSTER=y CONFIG_SCHED_SMT=y CONFIG_NR_CPUS=4096 CONFIG_HOTPLUG_CPU=y +# CONFIG_ARM64_BOOTPARAM_HOTPLUG_CPU0 is not set CONFIG_NUMA=y CONFIG_NODES_SHIFT=7 # CONFIG_HZ_100 is not set -- 2.20.1
participants (2)
-
patchwork bot
-
Zheng Zengkai