From fe4c36c11bedf8768e8589fdced23d120150ca63 Mon Sep 17 00:00:00 2001 From: Stephen Dickey Date: Fri, 9 Apr 2021 13:55:16 -0700 Subject: [PATCH] sched/walt: core_ctl init out of order core_ctl is launching a kthread which uses a spinlock, prior to initializing the spinlock. This creates a race, and a lockup. Change-Id: I170a77addc6e4c2cc90b6683b50723008760f2f4 Signed-off-by: Stephen Dickey --- kernel/sched/walt/core_ctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/sched/walt/core_ctl.c b/kernel/sched/walt/core_ctl.c index f1d2e09b95ae..d6e9d28298e7 100644 --- a/kernel/sched/walt/core_ctl.c +++ b/kernel/sched/walt/core_ctl.c @@ -1327,14 +1327,14 @@ int core_ctl_init(void) struct walt_sched_cluster *cluster; int ret; - /* initialize our single kthread */ + spin_lock_init(&core_ctl_pending_lock); + + /* initialize our single kthread, after spin lock init */ core_ctl_thread = kthread_run(try_core_ctl, NULL, "core_ctl"); if (IS_ERR(core_ctl_thread)) return PTR_ERR(core_ctl_thread); - spin_lock_init(&core_ctl_pending_lock); - sched_setscheduler_nocheck(core_ctl_thread, SCHED_FIFO, ¶m); for_each_sched_cluster(cluster) {