From 0b2169964afee8f25b75132d397f3a88afde39a9 Mon Sep 17 00:00:00 2001 From: Masamichi Takagi Date: Thu, 16 Aug 2018 16:28:12 +0900 Subject: [PATCH] futex_wait_queue_me: Spin-sleep when timeout and idle_halt is specified schedule_timeout() with idle_halt should use spin sleep because sleep with timeout is not implemented. Change-Id: Ia0bebcc10ddfb872bffeece7f13fb35a4791db18 --- kernel/futex.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/futex.c b/kernel/futex.c index 1522a836..327d36ff 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -672,8 +672,11 @@ static uint64_t futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q */ xchg4(&(cpu_local_var(current)->status), PS_INTERRUPTIBLE); - /* Indicate spin sleep */ - if (!idle_halt) { + /* Indicate spin sleep. Note that schedule_timeout() with + * idle_halt should use spin sleep because sleep with timeout + * is not implemented. + */ + if (!idle_halt || timeout) { irqstate = ihk_mc_spinlock_lock(&thread->spin_sleep_lock); thread->spin_sleep = 1; ihk_mc_spinlock_unlock(&thread->spin_sleep_lock, irqstate);