tee: optee: add might_sleep for RPC requests
authorRouven Czerwinski <r.czerwinski@pengutronix.de>
Wed, 3 Jul 2019 10:03:50 +0000 (12:03 +0200)
committerJens Wiklander <jens.wiklander@linaro.org>
Mon, 8 Jul 2019 20:38:56 +0000 (22:38 +0200)
commit9f02b8f61f29f4518581770d57bfffe99b1ea599
treee10c373b94e4904c26579c88322da8e2b46f6b9b
parent0ecfebd2b52404ae0c54a878c872bb93363ada36
tee: optee: add might_sleep for RPC requests

If the kernel is compiled with CONFIG_PREEMPT_VOLUNTARY and OP-TEE is
executing a long running workload, the following errors are raised:

[ 1705.971228] rcu: INFO: rcu_sched detected stalls on CPUs/tasks:
[ 1705.977195] rcu:     (detected by 0, t=2102 jiffies, g=51977, q=3)
[ 1705.983152] rcu: All QSes seen, last rcu_sched kthread activity 2102 (140596-138494), jiffies_till_next_fqs=1, root ->qsmask 0x0
[ 1705.994729] optee-xtest     R  running task        0   169    157 0x00000002

While OP-TEE is returning regularly to the kernel due to timer
interrupts, the OPTEE_SMC_FUNC_FOREIGN_INTR case does not contain an
explicit rescheduling point. Add a might_sleep() to the RPC request case
to ensure that the kernel can reschedule another task if OP-TEE requests
RPC handling.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
drivers/tee/optee/call.c