lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 8 Jul 2019 22:40:06 +0200
From:   Jens Wiklander <jens.wiklander@...aro.org>
To:     Rouven Czerwinski <r.czerwinski@...gutronix.de>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "tee-dev @ lists . linaro . org" <tee-dev@...ts.linaro.org>
Subject: Re: [PATCH] tee: optee: add might_sleep for RPC requests

Hi Rouven,

On Wed, Jul 3, 2019 at 12:04 PM Rouven Czerwinski
<r.czerwinski@...gutronix.de> wrote:
>
> 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 regulary to the kernel due to timer
> interrrupts, 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@...gutronix.de>
> ---
>  drivers/tee/optee/call.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c
> index aa942703ae65..13b0269a0abc 100644
> --- a/drivers/tee/optee/call.c
> +++ b/drivers/tee/optee/call.c
> @@ -148,6 +148,7 @@ u32 optee_do_call_with_arg(struct tee_context *ctx, phys_addr_t parg)
>                          */
>                         optee_cq_wait_for_completion(&optee->call_queue, &w);
>                 } else if (OPTEE_SMC_RETURN_IS_RPC(res.a0)) {
> +                       might_sleep();
>                         param.a0 = res.a0;
>                         param.a1 = res.a1;
>                         param.a2 = res.a2;
> --
> 2.20.1
>

Looks good. I'll pick this up and fix the spell errors in the commit message.

Thanks,
Jens

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ