Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp823283pxj; Fri, 28 May 2021 17:16:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPQq7rlcIv38+wHL+Ja5YlY1pC+f8ZNK6ZV6vA49uVVxdxViRc8648dPghVsBYeQER5BQA X-Received: by 2002:a17:906:a203:: with SMTP id r3mr11637433ejy.361.1622247378268; Fri, 28 May 2021 17:16:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622247378; cv=none; d=google.com; s=arc-20160816; b=xYTK5RTzIMR0TXBZuFOEK3klD4G52+1G2ksLa62Lv/pgOHGkE4RNizHDC4XatbX9vJ WV8xjfVFBfCSxV4aOV1EoIcZjgLMdTw8jhIe9NwUzUCg8UQSI1ffF3WOEWyOjP2erf0u iIDuvJjpNtE+WAZxWR1ITHlLp0xNm95DQzj+2PjICHdTbMFriL2ERhvbgWbyRqbiUDnl Aiy/3yiHXjYTR222nJl4TdQryZkQl2NvJ2X8kfqZnBk+8qPJzOAMibNl1KNU1TvhGj4a OTSdbcnRymFJc9w654b5730Q/2i4pZVzbdsgVx0yQxOWMynbA2OY7nzkw32o0yUHIWTQ BJ3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dmarc-filter:sender:dkim-signature; bh=uA1faYC+OFMBrwWX6UJIZ7G7z3bJUu+EjVNftvOSgcA=; b=aDkwYHJhTvRua6eQPy+vQywZYNiV4xiRmpuGp1syLD5j4zKEqH0enKAD4I/ghb1BhG Um1I2iFrvl6DgIUMMXS0n58RAL1ki9fsY09Ycc0EjbgZSkRE0EwRSHGjNP6jTR/kXNQP JFIeWLu7pvM6ZJGWyiCkK9aZspeWv9HlO7zHfjUSI6Z8FWJgtiRuuX4X5fm+qnoH6N9K UeubS38xepzPK6trGFZEgE/Cg1rohaA1aSyHeyuYkgPEHb84X/Y3vENgMdyqzq3ddGCb qLSFuSqx0RsKyGnwSkYNUZDD1dje7Rj0i75YQ0gqEA8U95Gia4hMSqxoB45bTJpNromz bDbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=VVMYEM5u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j10si1696750ejv.206.2021.05.28.17.15.40; Fri, 28 May 2021 17:16:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=VVMYEM5u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229541AbhE2ANr (ORCPT + 99 others); Fri, 28 May 2021 20:13:47 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:12719 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229528AbhE2ANq (ORCPT ); Fri, 28 May 2021 20:13:46 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1622247131; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=uA1faYC+OFMBrwWX6UJIZ7G7z3bJUu+EjVNftvOSgcA=; b=VVMYEM5uZL9xdgfM8bfKN2hH/4B1OA1L5AHfQL0+oOhw4sDFFCB0WjWmNOcxQblX3TSdVDLi X+MS1zyo5SEP/bAUqIN+FO1FfCSZyMBiF/Xnm1c9ZRspGcwzBr1CGOkBOG6NZjmdGoME9mJN oXAiBcXyFPsD+jDdo3KxpnJ8hIM= X-Mailgun-Sending-Ip: 198.61.254.9 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 smtp-out-n02.prod.us-west-2.postgun.com with SMTP id 60b186daea2aacd7297cc952 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Sat, 29 May 2021 00:12:10 GMT Sender: sidgup=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id DD13DC4338A; Sat, 29 May 2021 00:12:09 +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=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00, NICE_REPLY_A,SPF_FAIL,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from [192.168.1.10] (cpe-75-83-25-192.socal.res.rr.com [75.83.25.192]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sidgup) by smtp.codeaurora.org (Postfix) with ESMTPSA id 051A1C433D3; Sat, 29 May 2021 00:12:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 051A1C433D3 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=sidgup@codeaurora.org Subject: Re: [PATCH 1/1] remoteproc: use freezable workqueue for crash notifications To: Bjorn Andersson , Alex Elder Cc: ohad@wizery.com, mathieu.poirier@linaro.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210519234418.1196387-1-elder@linaro.org> <20210519234418.1196387-2-elder@linaro.org> From: Siddharth Gupta Message-ID: Date: Fri, 28 May 2021 17:12:08 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/27/2021 8:55 PM, Bjorn Andersson wrote: > On Wed 19 May 18:44 CDT 2021, Alex Elder wrote: > >> When a remoteproc has crashed, rproc_report_crash() is called to >> handle whatever recovery is desired. This can happen at almost any >> time, often triggered by an interrupt, though it can also be >> initiated by a write to debugfs file remoteproc/remoteproc*/crash. >> >> When a crash is reported, the crash handler worker is scheduled to >> run (rproc_crash_handler_work()). One thing that worker does is >> call rproc_trigger_recovery(), which calls rproc_stop(). That calls >> the ->stop method for any remoteproc subdevices before making the >> remote processor go offline. >> >> The Q6V5 modem remoteproc driver implements an SSR subdevice that >> notifies registered drivers when the modem changes operational state >> (prepare, started, stop/crash, unprepared). The IPA driver >> registers to receive these notifications. >> >> With that as context, I'll now describe the problem. >> >> There was a situation in which buggy modem firmware led to a modem >> crash very soon after system (AP) resume had begun. The crash caused >> a remoteproc SSR crash notification to be sent to the IPA driver. >> The problem was that, although system resume had begun, it had not >> yet completed, and the IPA driver was still in a suspended state. >> >> This scenario could happen to any driver that registers for these >> SSR notifications, because they are delivered without knowledge of >> the (suspend) state of registered recipient drivers. >> >> This patch offers a simple fix for this, by having the crash >> handling worker function run on the system freezable workqueue. >> This workqueue does not operate if user space is frozen (for >> suspend). As a result, the SSR subdevice only delivers its >> crash notification when the system is fully operational (i.e., >> neither suspended nor in suspend/resume transition). >> > This makes sense to me; both that it ensures that we spend our resources > on the actual system resume and that it avoids surprises from this > happening while the system still is in a funky state... > > Reviewed-by: Bjorn Andersson > > But it would be nice to get some input from other users of the > framework. This patch sounds like a good idea for cases where the request_firmware() APIs fallback to userspace firmware loading. Will test out this patch and report back. Thanks, Sid > > Regards, > Bjorn > >> Signed-off-by: Alex Elder >> --- >> drivers/remoteproc/remoteproc_core.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c >> index 39cf44cb08035..6bedf2d2af239 100644 >> --- a/drivers/remoteproc/remoteproc_core.c >> +++ b/drivers/remoteproc/remoteproc_core.c >> @@ -2724,8 +2724,8 @@ void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type) >> dev_err(&rproc->dev, "crash detected in %s: type %s\n", >> rproc->name, rproc_crash_to_string(type)); >> >> - /* create a new task to handle the error */ >> - schedule_work(&rproc->crash_handler); >> + /* Have a worker handle the error; ensure system is not suspended */ >> + queue_work(system_freezable_wq, &rproc->crash_handler); >> } >> EXPORT_SYMBOL(rproc_report_crash); >> >> -- >> 2.27.0 >>