Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7158278ybi; Mon, 8 Jul 2019 15:50:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwBHIjUv7aQvEMKbje+43kv7IzO0Qqtv98tQNSZnKmeJ4NKrcKC6+OIqUediZLR5FcHEmFz X-Received: by 2002:a17:902:b196:: with SMTP id s22mr26031421plr.245.1562626211697; Mon, 08 Jul 2019 15:50:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562626211; cv=none; d=google.com; s=arc-20160816; b=G49xnT4MIXgWyeU5NtiLMQYXCY9HCbigs4zXfK5R2x6DHqD1vVYjSEn+2TZIp5Pw8c wL84BTNMq79OL2LxaOIa0fuBdg87wmsi7hrdgbc1vnfSao9VxfqA3IMn6KQ8p8N7mpCT jx9KIkrERcFcweSOsiAvEtFRqKivfyJWuIJYjS+r2gPqxfdBUU5i8V8Fid3lOv/7gqUI dKlEXzf8oCVZ7XUtkdcnWZseUDXPcO7xr7u4k6nirsqo7lXOqgq1WLGwMdKPeYT0g4c0 Vl8GDx58TaOLIXyv7SwI8aPj7XFgoijrGGam0CDDm2ufF3js26d70DQRiuEx0BoKoWUj 2XqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=o0JMAMSSYy4GxSN2yix27wmYhn/WlIZxfCVDhGj0R7o=; b=SYlb+bCnCMxWBH/pA+xTgmeemGkwjn3W6RMLUTckDVhqnZMiutSRBg4Ck5Jk1ZefJn AvZj5OG/EeQEZUhP35j0ihpViYktY88Dld3PmHp0deMWdkEuFnU+J4JFeYKQICejYJe8 p/9GA2nrNbBkdP0qIaZNzCEaEDRaZYUl9o8A5L7twIxgYfZW+S2ru0QjxyKidSJaDC4u p7KO7i/WtuzUIF1L7/J9sIB8wKSOSIik1ulOBUVFKc8ss9Z8cY6Y/aIJdUR4TfoAIcKj 5cc9G1GivL4TRoAL8dGZSLtsKUQekH0ryeezSJiTlCvGg+tQwonlXo7Vwxr7GE8D3+7E HAsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VrhrRyUs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9si91752pls.201.2019.07.08.15.49.57; Mon, 08 Jul 2019 15:50:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VrhrRyUs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405114AbfGHUkS (ORCPT + 99 others); Mon, 8 Jul 2019 16:40:18 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:44906 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729212AbfGHUkS (ORCPT ); Mon, 8 Jul 2019 16:40:18 -0400 Received: by mail-io1-f65.google.com with SMTP id s7so38311199iob.11 for ; Mon, 08 Jul 2019 13:40:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=o0JMAMSSYy4GxSN2yix27wmYhn/WlIZxfCVDhGj0R7o=; b=VrhrRyUspaRe/rJ+uDjJUK9XdWrRYfBMXl7rSykuozBRuSENQdCySqCjCsPiVS0W5N jZwgHbF3MXLC+Q0HPRE29Ek1KI3CW+6GF3eEhj3ZZbMkwZA4MQD3DkYAzcrmZ+rwKuF1 DWjv+d5FZS1e7FZthcx+GNLMN7/rCN0sZV90Suux+LQJOH9zHtAg4kFXOWqDF7sQtcrC AccHghWrcEcX0eYwZ0FCXZF8yaD1PmA4e9Dh+KvRaNBOxXNBG0jLoublhyNuwtTPotlp pVWHjYB4Kq2kVm03vA6Dh+Shc4nhx7zJLDBFNeNUWSFpmZnkVbtH5Q+xGkTo/QWBY+eb igDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=o0JMAMSSYy4GxSN2yix27wmYhn/WlIZxfCVDhGj0R7o=; b=lKjvrfevCECZQjJ0xBxM1fkooyvwoMF9jJpin+KbbUImbAXrg6pU/i6riUJL5+lskC LIJI51YcOJ2UEK5DSeRUDgnTY7Q8QBEvUrCBjHRaEWLQwhr/F+v3tcjpdAlwbyXRgR75 ISIeuynVhsV6ldGnhEQDTlCCDDKY2PKpgnJHwF7vCPHrJ4dEuqGe5UUYLNeTMTOsI8po oIFvQ4627jVxyetO+mBSA8hgpuh9iZvrt9a8UIdf1AHwb9G+RwxQg55rZUF81HpHOvL9 I+OV9zspDiV6SgwcEZz+R7dNuvnVOpCYrgoGCCojGIOFBSbrVqT4+wczzDOnxUTH6Y0M a7Hg== X-Gm-Message-State: APjAAAUsJztoOZSqn/rN9uJpxminB0qWYBEM64ZRsmWU8alM26+hmcSx M/TE/uPVBGEE0UozzowtKpgte5dOR4EAECWJbEIMqmIV5gk= X-Received: by 2002:a5e:8618:: with SMTP id z24mr21944628ioj.174.1562618417361; Mon, 08 Jul 2019 13:40:17 -0700 (PDT) MIME-Version: 1.0 References: <20190703100349.12893-1-r.czerwinski@pengutronix.de> In-Reply-To: <20190703100349.12893-1-r.czerwinski@pengutronix.de> From: Jens Wiklander Date: Mon, 8 Jul 2019 22:40:06 +0200 Message-ID: Subject: Re: [PATCH] tee: optee: add might_sleep for RPC requests To: Rouven Czerwinski Cc: Linux Kernel Mailing List , "tee-dev @ lists . linaro . org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rouven, On Wed, Jul 3, 2019 at 12:04 PM Rouven Czerwinski 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 > --- > 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