Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp44652ybb; Tue, 7 Apr 2020 16:27:49 -0700 (PDT) X-Google-Smtp-Source: APiQypLFagGQ5WXC1iQF7qHaInyMXjbglYvHIA+HpR15dti8lMaQ8d2JBovZqbN8a0H//om82+if X-Received: by 2002:a9d:6950:: with SMTP id p16mr3604316oto.199.1586302069531; Tue, 07 Apr 2020 16:27:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586302069; cv=none; d=google.com; s=arc-20160816; b=GDEhk5wtN47CkugOwwTsHIb+mKr7QxQe5ns4iOlWX3L73+X4UvPbBN9v8hMURwqprl YZ3kH5NbsrIWi04nytouER3c7Nt2PB22lT+LBUL2/RdRz13p4IQsbckvPDR0jjB+OIWP TXPEzz9Ml4t8B6f7iW+CHnxYnyB//P0E347QX4K/b86+Z07w4OvMTBdF88Co9EG5r1DN 0ChiOQjQT0Qc9+reo/g/f3CwoxulFUvSgZwVf9nImup5JouSh1bYYhyVdrt3ekxUGjYB WiAKQ/CDOOMmSwN3fCNPtDtFT/KIRSN3BgM/qZhZd172UK0aSkGl5ERFagDeIImVh+Q/ 8M3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=y5LS3MU2ajrGhRzRJXtmecDXDze15/f8wGbcQHqh5n4=; b=YTsQ8zyWx0PPalHUrJCSUsE1d9K/O4++UwIVxjFkV6kIv4+K5pvSTgkPorovRhYWcb YnnSctQL+WK2tZBxJ3fP7Wwx0V6MI1GAjXQ1rwXF00yfTapGUvfXQwRAALbMImh7Gu9y 9TC3vmNq+RgRrDJavL9WaCdMWg0xmQNzXTi8d7l1cksdovOXg6Lr0ARLeh7/F4H+fNst 65mQ9mcSKVjAcLlFHqvbkSVbOkUh7v4E3B7lnHAKMMwrbsXc45txSchaKjzYINkI5EIK 81b1cfwWghnQeRw6XJXYiVOUnyd0i0rv6SQSg7j0RGU1tCX7pFfUr6EwADOTOVV27uCC iahA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NmOHvzsw; 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 t23si1774315otm.97.2020.04.07.16.27.30; Tue, 07 Apr 2020 16:27:49 -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=NmOHvzsw; 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 S1726428AbgDGX0z (ORCPT + 99 others); Tue, 7 Apr 2020 19:26:55 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:35557 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726393AbgDGX0z (ORCPT ); Tue, 7 Apr 2020 19:26:55 -0400 Received: by mail-pl1-f193.google.com with SMTP id c12so1829771plz.2 for ; Tue, 07 Apr 2020 16:26:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=y5LS3MU2ajrGhRzRJXtmecDXDze15/f8wGbcQHqh5n4=; b=NmOHvzswUt9XYTE1FH4pjMmmWuJs4RiOc30XXNe/xawQjAVjxF4k/O55uZbflAP5xM Cp6qLKTEtUR08ztRXxhoxXQwdkviEYF6dxtYh3Wsj+o+3nZYQ7xU8rFfKOhcZk+Bhpi4 HP77kgIUYAYgSknWgI4gvHP0DUvuUf7JCBS8hsEq7nffrAmL0nVkPQaYeiOygFEkzl5N Xr+erFsD2lXoxBmsReXKP0EOl2MT2F927ooDWplLYCf2yJeovnK18pDwJ9cmht2aFcQ9 X5+ayPRdsmUfBW4r2RobojK4RPdw7PUgVsjP2Sa/7mBENcUociKnoa7TEd1ltawkCZDl 0T3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=y5LS3MU2ajrGhRzRJXtmecDXDze15/f8wGbcQHqh5n4=; b=dR/Wn4ErQAGPyTEWrvy+tRZAobT+AGyLU3GEM0huzSNe6ATGQ5kaD8e0PQ0y8iW/37 YHMwFppVClit28NwVB6pIxdG9SRhtBwybKfgychynAd/VOSWKkRM0KQ3V6ipxT2WZljl BhtUpWGcgSJxCbQAgcXKs6+pMAbAq6ex8iQPCApqyCSdu4/G/cW5dM+YW++8LHVnRXyG eTSOhWvmzndUHHTUljtaedGAlLNi5Vk0UZtoLJb8Prx4F7yoiexHcSe4mTmqAydRWSmc QB15gSdriThQKVPtAZRk/yaHxw+YDe3vIFk0VeW+RzIjxJF8SkHMHAerrXNZHC9lfXY2 izWQ== X-Gm-Message-State: AGi0PuaG90xR+Lfsdaqa4aPpl+ae1N5fOh23QO5F+w7rl/qCRGdX70l8 G5ju9tuhuPL1UVTWfFQYp+JueA== X-Received: by 2002:a17:90a:be0b:: with SMTP id a11mr1977543pjs.56.1586302014257; Tue, 07 Apr 2020 16:26:54 -0700 (PDT) Received: from builder.lan (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id q12sm14143932pgi.86.2020.04.07.16.26.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 16:26:53 -0700 (PDT) Date: Tue, 7 Apr 2020 16:26:59 -0700 From: Bjorn Andersson To: rishabhb@codeaurora.org Cc: Siddharth Gupta , ohad@wizery.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tsoni@codeaurora.org, psodagud@codeaurora.org, linux-remoteproc-owner@vger.kernel.org Subject: Re: [PATCH 2/2] remoteproc: core: Prevent sleep when rproc crashes Message-ID: <20200407232659.GM20625@builder.lan> References: <1582164713-6413-1-git-send-email-sidgup@codeaurora.org> <1582164713-6413-3-git-send-email-sidgup@codeaurora.org> <20200407222958.GL20625@builder.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 07 Apr 15:59 PDT 2020, rishabhb@codeaurora.org wrote: > On 2020-04-07 15:29, Bjorn Andersson wrote: > > On Wed 19 Feb 18:11 PST 2020, Siddharth Gupta wrote: > > > > > Remoteproc recovery should be fast and any delay will have an impact > > > on the > > > user-experience. Use power management APIs (pm_stay_awake and > > > pm_relax) to > > > ensure that the system does not go to sleep. > > > > > > Signed-off-by: Siddharth Gupta > > > --- > > > drivers/remoteproc/remoteproc_core.c | 4 ++++ > > > 1 file changed, 4 insertions(+) > > > > > > diff --git a/drivers/remoteproc/remoteproc_core.c > > > b/drivers/remoteproc/remoteproc_core.c > > > index 5ab65a4..52e318c 100644 > > > --- a/drivers/remoteproc/remoteproc_core.c > > > +++ b/drivers/remoteproc/remoteproc_core.c > > > @@ -1712,6 +1712,8 @@ static void rproc_crash_handler_work(struct > > > work_struct *work) > > > > > > if (!rproc->recovery_disabled) > > > rproc_trigger_recovery(rproc); > > > + > > > + pm_relax(&rproc->dev); > > > } > > > > > > /** > > > @@ -2242,6 +2244,8 @@ void rproc_report_crash(struct rproc *rproc, > > > enum rproc_crash_type type) > > > return; > > > } > > > > > > + pm_stay_awake(&rproc->dev); > > > > Following Mathieu's question I was expecting you to do this on > > rproc->dev.parent. > > > > But looking at the implementation of pm_stay_awake(), it ends up being a > > nop if dev->power.wakeup isn't specified. This in turn seems to come > > from device_wakeup_enable(), which will bail if dev->power.can_wakeup is > > not set. But I don't see where this would be set for either the platform > > driver or the remoteproc's struct device - and neither one of them have > > a "wakeup" attribute in sysfs. > > > > Is there some additional plumbing needed for this? > We should be able to create a standalone wakeup source using > wakeup_source_init. > Then we can use _pm_stay_awake and _pm_relax on it. Afaict the way to do this would be to call device_wakeup_enable() on either the remoteproc or platform driver's struct device. Given that the resources related to waking up the system are associated with the platform driver I think this should be done on the platform driver's struct device and these calls should operate on the rproc's parent. Regards, Bjorn > > > > Regards, > > Bjorn > > > > > + > > > dev_err(&rproc->dev, "crash detected in %s: type %s\n", > > > rproc->name, rproc_crash_to_string(type)); > > > > > > -- > > > Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > > > a Linux Foundation Collaborative Project