kernel/watchdog: clear softlockup_completion when queue work failed

The watchdog queue the feed dog work to migrate task when cpu started.
The cpuhp_hp_states could guarantee the migrate task is actived when
watchdog queue the feed dog work. But the frequently plug and unplug
cpu may corrutp that sequence guarantee, and result in feed dog not
to work. So we add the success check to resolve this problem.

Signed-off-by: Bin Lai <robinlai@tencent.com>
Reviewed-by: Liu Chun <kaicliu@tencent.com>
Signed-off-by: Yongliang Gao <leonylgao@tencent.com>
Signed-off-by: Jianping Liu <frankjpliu@tencent.com>
This commit is contained in:
Bin Lai 2024-02-22 13:24:34 +08:00 committed by Jianping Liu
parent 3987ebe9b2
commit 3d766fdae0
1 changed files with 9 additions and 3 deletions

View File

@ -378,10 +378,16 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
/* kick the softlockup detector */
if (completion_done(this_cpu_ptr(&softlockup_completion))) {
bool success;
reinit_completion(this_cpu_ptr(&softlockup_completion));
stop_one_cpu_nowait(smp_processor_id(),
softlockup_fn, NULL,
this_cpu_ptr(&softlockup_stop_work));
success = stop_one_cpu_nowait(smp_processor_id(), softlockup_fn, NULL,
this_cpu_ptr(&softlockup_stop_work));
if (!success) {
__touch_watchdog();
complete(this_cpu_ptr(&softlockup_completion));
}
}
/* .. and repeat */