[<prev] [next>] [day] [month] [year] [list]
Message-ID: <3bcf5d974b98acccde89e8d5567d3ddcdfb44800.camel@mediatek.com>
Date: Thu, 11 Aug 2022 15:54:28 +0800
From: Kuyo Chang <kuyo.chang@...iatek.com>
To: Sami Tolvanen <samitolvanen@...gle.com>,
Kees Cook <keescook@...omium.org>,
Nathan Chancellor <nathan@...nel.org>,
"Nick Desaulniers" <ndesaulniers@...gle.com>,
Ingo Molnar <mingo@...hat.com>,
"Peter Zijlstra" <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
"Vincent Guittot" <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
"Ben Segall" <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
"Daniel Bristot de Oliveira" <bristot@...hat.com>,
"Paul E. McKenney" <paulmck@...nel.org>,
Josh Triplett <josh@...htriplett.org>,
Steven Rostedt <rostedt@...dmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Lai Jiangshan <jiangshanlai@...il.com>,
Joel Fernandes <joel@...lfernandes.org>, <rcu@...r.kernel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
"Daniel Lezcano" <daniel.lezcano@...aro.org>
CC: <kuyo.chang@...iatek.com>, <linux-pm@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <wsd_upstream@...iatek.com>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>, <rcu@...r.kernel.org>,
<llvm@...ts.linux.dev>
Subject: [Race condition] Race condition at cpuidle_enter_s2idle &
__cfi_slowpath_diag
Hi Sami,
During doing s2idle(Suspend-To-Idle) flow, I found a task will put into
runqueue by __cfi_slowpath_diag.
The code trace about fail case as below:
call_cpuidle_s2idle
->if (current_clr_polling_and_test()) //check resched flag
return -EBUSY;
->cpuidle_enter_s2idle
->enter_s2idle_proper
->target_state->enter_s2idle(dev, drv, index);
Meanwhile the log shows the __cfi_slowpath_diag function will wake up a
task to CPU, below is the backtrace
__cfi_slowpath_diag
find_check_fn
rcu_irq_enter
rcu_nmi_enter
rcu_cleanup_after_idle
invoke_rcu_core
raise_softirq(RCU_SOFTIRQ)
raise_softirq_irqoff
if (!in_interrupt() && should_wake_ksoftirqd())
wakeup_softirqd();
//wake up flow
wake_up_process
try_to_wake_up
ttwu_queue
ttwu_do_activate
ttwu_do_wakeup
check_preempt_curr
resched_curr
set_tsk_need_resched(curr);
So It will violate the initial check at call_cpuidle_s2idle(Now it
exists a task at rq and need reched, so it should not enter
cpuidle_enter_s2idle )
if (current_clr_polling_and_test())
return -EBUSY;
I look the racing may be related to the following patch
57cd6d1 cfi: Fix __cfi_slowpath_diag RCU usage with cpuidle
https://android.googlesource.com/kernel/common/+/57cd6d1
Do you have any suggestion for this issue?
Thank you.
Powered by blists - more mailing lists