Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp556674pxj; Fri, 28 May 2021 09:52:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzC1JkpA0wcLK6XEaTPFo3IlRFYj8ngdGBfwgx6kwmCcCSqYrxou3pFnoJNUtDCe+81qLmY X-Received: by 2002:a17:906:e210:: with SMTP id gf16mr10066239ejb.472.1622220743546; Fri, 28 May 2021 09:52:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622220743; cv=none; d=google.com; s=arc-20160816; b=VAfSDqbQv/Euzz6ISDlArWV5J4GfqaVorx+4mSx2KseEjiU30+LJz8D/ZIv2T00Lhz /wptcrlOLHRk30mutUi+lJnvasJBvS9WZQdiw+BCNnlN/wgvVNTER7/SJoY8hTKxRqah xna40vSh0crlEtS1XlDDBwmyNctdBIFkeIC/+cemCqMPRiTgE6WHAddGFvAuksfiMsPP RGpQJO+xk9wEVmAI0iry2uRd8ANmlDy+u/8m6riet45V8uVhktBph82983nrPRij8xiT ocpYITklC+19Tof8G1IM/iwZb9ALRkX7DC083pfcbXUTs6KU9TD0gv+3Zt2+ai71EPv4 u2zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=COCYNxlGniVWLUglCEtbTut6ZdY+Pq4JgW48n0IpT84=; b=JutnZ6BXhmCnv10gJo2Ev+9bERfMvUl9hwUDICZu8jS06odNNSoZLc7Ha9Orf0dJVz AQ3HOeYGUeqal3D+GbZyGTNOULmpU44aHdPitgBILtaJEezDx+25zrpCqqHslwPN9/CI 2+xoi+u9tPGRmvXSSU3tEGxj7ypTOe2eOhHoN8aeJPairLCaraYvnXaAkFsyn7kBHDl9 dQvBoNzFTINPxaesPkGXdXvYvTGMZjOHSFIQjUgkvVq63/Wr/37WHSAdljcKYXgmeC/Q pkpy/Uo7P8ZYzAh+AKD1z1yc5Ru0L2Vk615OgzKZjGwQ0H1/pLYsb70NZQzLXWNQsfEe FwCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="WTxda/Cp"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p26si4825758edy.402.2021.05.28.09.51.47; Fri, 28 May 2021 09:52:23 -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=@linaro.org header.s=google header.b="WTxda/Cp"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232839AbhE1PKw (ORCPT + 99 others); Fri, 28 May 2021 11:10:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230131AbhE1PKu (ORCPT ); Fri, 28 May 2021 11:10:50 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E69F1C06174A for ; Fri, 28 May 2021 08:09:15 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id v13so1752704ple.9 for ; Fri, 28 May 2021 08:09:15 -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=COCYNxlGniVWLUglCEtbTut6ZdY+Pq4JgW48n0IpT84=; b=WTxda/Cp1mXnp/85bXAtFPvlw6RdyQBPOXugOPV0EJpEOxBma2Z5c6LJKbLEpIo7pR 3EgrsQMEED2Ofj9ZyjvxDdOf0jW9WEqUSoOUuCL72kSxv6VocWBHhSWQ9b3ciC11mKZM b9AOElpQAYzFk33+5/7FUMAY6Snk1YBcwstg3pyaqk4L7kQ5a5hldGWfWzNll7CHC9Ev pr+nlv4ha1GtzyS/R7YC5U0scTUNqBnT0Za5UZpdVIB0rUotqEYWxerD3O9vJAMNNK3P qd4c23wLokVP9DXm4QBHz6NaVr8iEsfI+yNDER2p1dott3ZYRWwPbLssE3bj1CHWl69G ADxg== 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=COCYNxlGniVWLUglCEtbTut6ZdY+Pq4JgW48n0IpT84=; b=ue8AyxhHHRmmu6MO9R7V6Tx73zQSdRmJEH5CUskhAOp5NAhqTXHbxGsn57ixQeAM52 Q1JAaY9I/scXSKfJRKdxpLM42uZWrRM+s4hMGWWGBWt8g9XG3Qj+K5FdDwxJebDydGi2 jJmDOCv4Cw7cWGdNM+TBi5QA/KbXTAzRvXbepI6fz0gbLwBsqFsZ2AxfHvBgo+/XjBiW NyN56BH7sC6+Hk/XK/riPF1cfpiTOeEpnIFfGR1nP76Y5C+tLR/oKsG3PG9g6dyKiZA8 CgNww+0/ukGCbLj4oug9Tp9+EDmrOH66y2V/dfToX/melrp8EYVsoeryJguJ77aid2uM ++uQ== X-Gm-Message-State: AOAM533IqcnrkKDsI2bGfmaz3KXbTk1Kn7XNzfQf7ci8cr4gJfPcppjP PudgDqBjQ3DiydO+LOLDS3/YCM5KwALEHg== X-Received: by 2002:a17:90a:898c:: with SMTP id v12mr2134356pjn.72.1622214555324; Fri, 28 May 2021 08:09:15 -0700 (PDT) Received: from xps15 (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id y129sm4382096pfy.123.2021.05.28.08.09.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 May 2021 08:09:13 -0700 (PDT) Date: Fri, 28 May 2021 09:09:12 -0600 From: Mathieu Poirier To: Bjorn Andersson Cc: Alex Elder , ohad@wizery.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] remoteproc: use freezable workqueue for crash notifications Message-ID: <20210528150912.GA1354763@xps15> References: <20210519234418.1196387-1-elder@linaro.org> <20210519234418.1196387-2-elder@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 27, 2021 at 10:55:05PM -0500, 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 is in my review queue - I should be able to get to it by the end of next week. > 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 > >