From 63c2034b0c63b28815f8439fe7ea329bf4d7611c Mon Sep 17 00:00:00 2001 From: Satya Durga Srinivasu Prabhala Date: Tue, 27 Sep 2022 23:21:12 +0800 Subject: [PATCH] watchdog: use per_cpu_ptr() in watchdog_disable() linux inclusion category: bugfix issue: #I5THGM CVE: NA Tested_by: Wang Jingjin Signed-off-by: Wang Jingjin ------------------------------------ Watchdog gets disabled from other CPUs when isolation is enabled. Using this_cpu_ptr() would lead to undesired issues, so, switch to per_cpu_ptr(). While at it, remove warning as it makes no sense when core isolation is enabled. Signed-off-by: Satya Durga Srinivasu Prabhala --- kernel/watchdog.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 9d3ca28c6f8d..15786f02728f 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -471,14 +471,12 @@ void watchdog_enable(unsigned int cpu) void watchdog_disable(unsigned int cpu) { - struct hrtimer *hrtimer = this_cpu_ptr(&watchdog_hrtimer); + struct hrtimer *hrtimer = per_cpu_ptr(&watchdog_hrtimer, cpu); unsigned int *enabled = per_cpu_ptr(&watchdog_en, cpu); if (!*enabled) return; - WARN_ON_ONCE(cpu != smp_processor_id()); - /* * Disable the perf event first. That prevents that a large delay * between disabling the timer and disabling the perf event causes @@ -486,7 +484,7 @@ void watchdog_disable(unsigned int cpu) */ watchdog_nmi_disable(cpu); hrtimer_cancel(hrtimer); - wait_for_completion(this_cpu_ptr(&softlockup_completion)); + wait_for_completion(per_cpu_ptr(&softlockup_completion, cpu)); /* * No need for barrier here since disabling the watchdog is -- Gitee