Unverified Commit dc9ab87d authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!15802 hrtimers: Handle CPU state correctly on hotplug

parents c81b4f78 616ab35d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -545,6 +545,7 @@ extern void __init hrtimers_init(void);
extern void sysrq_timer_list_show(void);

int hrtimers_prepare_cpu(unsigned int cpu);
int hrtimers_cpu_starting(unsigned int cpu);
#ifdef CONFIG_HOTPLUG_CPU
int hrtimers_cpu_dying(unsigned int cpu);
#else
+8 −1
Original line number Diff line number Diff line
@@ -1713,9 +1713,16 @@ static struct cpuhp_step cpuhp_hp_states[] = {
	 * Please ensure that there are no other steps with teardown handler
	 * between smpcfd:dying and cpu:teardown.
	 */
	/*
	 * In the past, the implementation of CPUHP_AP_HRTIMERS_DYING is deleted because
	 * the Kabi is fixed. The teardown operation and teardown of CPUHP_AP_SMPCFD_DYING
	 * are combined into smpcfd_and_hrtimer_dying_cpu. The startup operation of
	 * CPUHP_AP_SMPCFD_DYING is empty. Therefore, the startup operation of
	 * hrtimers_cpu_starting is set to the startup operation of CPUHP_AP_SMPCFD_DYING.
	 */
	[CPUHP_AP_SMPCFD_DYING] = {
		.name			= "smpcfd:dying",
		.startup.single		= NULL,
		.startup.single		= hrtimers_cpu_starting,
		.teardown.single	= smpcfd_and_hrtimer_dying_cpu,
	},

+10 −1
Original line number Diff line number Diff line
@@ -2136,6 +2136,15 @@ int hrtimers_prepare_cpu(unsigned int cpu)
	}

	cpu_base->cpu = cpu;
	hrtimer_cpu_base_init_expiry_lock(cpu_base);
	return 0;
}

int hrtimers_cpu_starting(unsigned int cpu)
{
	struct hrtimer_cpu_base *cpu_base = this_cpu_ptr(&hrtimer_bases);

	/* Clear out any left over state from a CPU down operation */
	cpu_base->active_bases = 0;
	cpu_base->hres_active = 0;
	cpu_base->hang_detected = 0;
@@ -2144,7 +2153,6 @@ int hrtimers_prepare_cpu(unsigned int cpu)
	cpu_base->expires_next = KTIME_MAX;
	cpu_base->softirq_expires_next = KTIME_MAX;
	cpu_base->online = 1;
	hrtimer_cpu_base_init_expiry_lock(cpu_base);
	return 0;
}

@@ -2222,6 +2230,7 @@ int hrtimers_cpu_dying(unsigned int dying_cpu)
void __init hrtimers_init(void)
{
	hrtimers_prepare_cpu(smp_processor_id());
	hrtimers_cpu_starting(smp_processor_id());
	open_softirq(HRTIMER_SOFTIRQ, hrtimer_run_softirq);
}