Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp24948ybb; Tue, 7 Apr 2020 16:00:57 -0700 (PDT) X-Google-Smtp-Source: APiQypK5EBSpq05qoiqLoEowtV50+fwP76VfTRqrvipvw73lSXj198TfnJrImyOYnd4DcFPlv17F X-Received: by 2002:a05:6830:2318:: with SMTP id u24mr3520422ote.106.1586300457793; Tue, 07 Apr 2020 16:00:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586300457; cv=none; d=google.com; s=arc-20160816; b=edHFA2w7Mpp9+nS5MVPHY7fbkWJY/L0zATsNkRmirQ8E4sxmwBcD5XeOxaN6Y98uxj yXUB9JTjXnE8n6z8nzEQAGpIrG9bAFB/Wi4JhwbsrNIcffHGLBy9M2HmirD727hi7HjO mNRpDvXMRQov76GApZAu7piRc+IKkFN7AVYj2idcHp0tWyQuRz9YZMt2kaiBEUUBWs5Y k2gpHKrZa/IJ3IPIBpPd4zl5z3a7uoQAbAhzFf3hRPiRAz07qDaHbj3IVQfgHRm2v1mM kDx9gT9J+8rxn6OCbULneKorjsCnJo9C7gbisxoVXQ75tNxdjnA/rmLzbrKxXh+5ely6 Ugew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=SCZqNjd3i3AXnsdgqxjB0zBNvisnVUii4KRTbEvYcZs=; b=qhAVXsEhDHPo5FWAvQuzaB44/VXIMf1coScm7bH/34eJj9ezpigNQztc25UQ1tXVor 0nCBDu0jqXw51nS9MxkMwPGJ3X3kDZgUjsaA+/tuUTzJgWGT69To+OHpnZ2X8NJHQcj2 HmWRCJ4slv87rPa5Mergn0onoDBqW4BCDwO2tBQ6ksCJr/EcDCLMk3aV1AcrbmlG8Ks+ ms8kEAAi9xj8QwXAQPipwGwZZevWACgcbdYrw/jfZ7OpjIURPre85lR48t4sYMGNHgQp 6ClH+X5JClh9Jk4kshnvZAccwSVsMp9PMijYBPO/rN7Lf3TLKtWuN5KJtgZdFCSCmCCG /Csg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=vyQd9zN4; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h10si1736764otm.153.2020.04.07.16.00.42; Tue, 07 Apr 2020 16:00:57 -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=fail header.i=@mg.codeaurora.org header.s=smtp header.b=vyQd9zN4; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726444AbgDGXAD (ORCPT + 99 others); Tue, 7 Apr 2020 19:00:03 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:49814 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726386AbgDGXAC (ORCPT ); Tue, 7 Apr 2020 19:00:02 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1586300402; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=SCZqNjd3i3AXnsdgqxjB0zBNvisnVUii4KRTbEvYcZs=; b=vyQd9zN4FCUfpBQ1QqSPtLKrw2o6jJyHvG+IMEa3bmXqyBxl0rxGG2lDMhcsuIvfpsx9llid pIdQnlT9DjMblZ5WrhTrueu2rGmI4zG8X2+L5arQrzUQqr3be4HbYiWstyp9RpahB8XlPeoB K/wlb/EEQqEucSdRMbMdcNAxkik= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5e8d05f0.7f94bf1a3110-smtp-out-n03; Tue, 07 Apr 2020 23:00:00 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id AD0B2C43636; Tue, 7 Apr 2020 22:59:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: rishabhb) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1A0CCC433D2; Tue, 7 Apr 2020 22:59:59 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 07 Apr 2020 15:59:59 -0700 From: rishabhb@codeaurora.org To: Bjorn Andersson 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 In-Reply-To: <20200407222958.GL20625@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> Message-ID: X-Sender: rishabhb@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > 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