From 4e1224407af4f553a69e467559c2c342f1be39a4 Mon Sep 17 00:00:00 2001 From: Satya Durga Srinivasu Prabhala Date: Mon, 25 Feb 2019 13:06:12 -0800 Subject: [PATCH] watchdog: use per_cpu_ptr() in watchdog_disable() 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. Change-Id: Id1a59c4c88044c7570457fb55abb2dcc13de3c11 Signed-off-by: Satya Durga Srinivasu Prabhala --- kernel/watchdog.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 3154a257c2bd..378bbb91b52a 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -519,14 +519,12 @@ void watchdog_enable(unsigned int cpu) void watchdog_disable(unsigned int cpu) { - struct hrtimer *hrtimer = this_cpu_ptr(&watchdog_hrtimer); - unsigned int *enabled = this_cpu_ptr(&watchdog_en); + 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 @@ -534,7 +532,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