hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8JEVI
--------------------------------
Commit baecdf2dbe73 ("hrtimers: Push pending hrtimers away from outgoing CPU earlier") add a new step in enum cpuhp_state breaks kabi.
In order to fix the kabi breakage, we had to move the hrtimers:dying step into smpcfd:dying and create a new function smpcfd_and_hrtimer_dying_cpu().
Signed-off-by: Yu Liao liaoyu15@huawei.com --- include/linux/cpuhotplug.h | 1 - include/linux/hrtimer.h | 2 +- include/linux/smp.h | 1 + kernel/cpu.c | 19 +++++++++++++------ kernel/smp.c | 8 ++++++++ 5 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index b0b4efe227f8..b540e5a60ea9 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -154,7 +154,6 @@ enum cpuhp_state { CPUHP_AP_ARM_CORESIGHT_CTI_STARTING, CPUHP_AP_ARM64_ISNDEP_STARTING, CPUHP_AP_SMPCFD_DYING, - CPUHP_AP_HRTIMERS_DYING, CPUHP_AP_X86_TBOOT_DYING, CPUHP_AP_ARM_CACHE_B15_RAC_DYING, CPUHP_AP_ONLINE, diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index c1459b7974c5..cfc62d447fa0 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -545,7 +545,7 @@ int hrtimers_prepare_cpu(unsigned int cpu); #ifdef CONFIG_HOTPLUG_CPU int hrtimers_cpu_dying(unsigned int cpu); #else -#define hrtimers_cpu_dying NULL +static inline int hrtimers_cpu_dying(unsigned int cpu) { return 0; } #endif
#endif diff --git a/include/linux/smp.h b/include/linux/smp.h index 84a0b4828f66..812c26f61300 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h @@ -278,5 +278,6 @@ int smp_call_on_cpu(unsigned int cpu, int (*func)(void *), void *par, int smpcfd_prepare_cpu(unsigned int cpu); int smpcfd_dead_cpu(unsigned int cpu); int smpcfd_dying_cpu(unsigned int cpu); +int smpcfd_and_hrtimer_dying_cpu(unsigned int cpu);
#endif /* __LINUX_SMP_H */ diff --git a/kernel/cpu.c b/kernel/cpu.c index f38ef9be6da1..89a8e7b9fdac 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1676,17 +1676,24 @@ static struct cpuhp_step cpuhp_hp_states[] = { .startup.single = NULL, .teardown.single = rcutree_dying_cpu, }, + /* + * In order to fix the kabi breakage, we had to move the hrtimers:dying + * step into smpcfd:dying and create a new function smpcfd_and_hrtimer_dying_cpu(). + * Please ensure that there are no other steps with teardown handler + * between smpcfd:dying and cpu:teardown. + */ [CPUHP_AP_SMPCFD_DYING] = { .name = "smpcfd:dying", .startup.single = NULL, - .teardown.single = smpcfd_dying_cpu, - }, - [CPUHP_AP_HRTIMERS_DYING] = { - .name = "hrtimers:dying", - .startup.single = NULL, - .teardown.single = hrtimers_cpu_dying, + .teardown.single = smpcfd_and_hrtimer_dying_cpu, },
+ /* + * Attention: Please do not add steps between smpcfd:dying + * and ap:online. Please refer to the above for specific + * reasons. + */ + /* Entry state on starting. Interrupts enabled from here on. Transient * state for synchronsization */ [CPUHP_AP_ONLINE] = { diff --git a/kernel/smp.c b/kernel/smp.c index 114776d0d11e..863cf7e2dbdc 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -75,6 +75,14 @@ int smpcfd_dead_cpu(unsigned int cpu) return 0; }
+int smpcfd_and_hrtimer_dying_cpu(unsigned int cpu) +{ + hrtimers_cpu_dying(cpu); + smpcfd_dying_cpu(cpu); + + return 0; +} + int smpcfd_dying_cpu(unsigned int cpu) { /*