From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 42C0DC433EF for ; Mon, 7 Feb 2022 17:36:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=S+wMDXIDwfm6HWr3FyhQiBDU2CgWxSVr39sYnZhkrN4=; b=b9BmkT3R6vKr7f xboIQmm0PknJ+0ciU/UjKF43IMWYYIQPweCdYH3xJdHTcVNa3LjxqGuJYTHui6PH49JU+eU/D0gib qnYP/o2AQBU/EVE1GfwppVa2FauCps6bE3dLAP7Hz2n84Z3Z/zA9eFVc/OijCD1Ge9pmWDqROTebf mIfB1Xxo6YiOjzEPVyyR8NDKoa9gP8uNmGSSLRggCjW4xn3wCmYBE4uD5tB+uxecXRDeEQMxWHe52 6xJLV/1Cl6YxW5k2cqjH8nZO1/0a27mVrO8iTYCLPloQ6689vV40AJie8GaC6nqvxVz7UvWTBLgp1 J2M5xcNCHgxES/tBnMrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nH7us-00BIoe-CM; Mon, 07 Feb 2022 17:35:06 +0000 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nH7un-00BIma-DF for linux-arm-kernel@lists.infradead.org; Mon, 07 Feb 2022 17:35:03 +0000 Received: by mail-pf1-x432.google.com with SMTP id u130so14194829pfc.2 for ; Mon, 07 Feb 2022 09:35:00 -0800 (PST) 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=+F8Z93ydaAZwGiy3/15vH3eFEMPs2AfvJMctmWhsG70=; b=TjzITW+3Z0nAL0osm0ypAygxlkHOt0JRm2p0UnMGlkOfPRS/Q4pyFimH413PWRFwcD 6VT8tpGXL+a/3TITw/4dU4HGCjpwJlOubIMRf/hNzS+IkbhiSgV2NS53E8UmaIoNIo7H lHu0kFMC4nJA7FCVtlrenQD1cdvOHwI0dHxKmRzxJG/v3dWaWYmjApzQfR4MnHn6Nj7B 8q47yl06Q0g/88BvblgYmcrAWe/7uk+/Wym+UMKOE8qrvg9oCp003WbD9HDXGdn6U3q+ s3kakdwh3iKLtOfL8QVuXddsXT8VKlo+dPRXP2I83ymJhQ/D79gAkITZWoUFhhkDKjzC B+eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=+F8Z93ydaAZwGiy3/15vH3eFEMPs2AfvJMctmWhsG70=; b=6J2c9GIUi5gNffWqauDSid2WwBtC2KHd5VYxT67qU9I9Ksyd7Y4yg8d/EQTU1DQLAL C/07MNYiC+LVdwAxNUPXvYsGrH5fQDKeRg5Dm1iNoV7Q+EJvogkapBNvHlNG/B3gFDKM qN7VnPuUyStSqUtctayda48JhBwZ9fh5mMsm7G3mWAbZpgLLPkVSGnfsyMER/yQDQMm4 72i+dUMx+mTISt6J7b6rmjuTuwO9IfarLzS727yn9AbnlCibDrHSSPHzx0Hd0V8Iep7q 9wDWJrhce30sWJSmIA3IGeDw/0CW7G7pz8PnGx6Gz7WORDwwStgfaLcUzMugoKOuqwbt BE+A== X-Gm-Message-State: AOAM531/RqY9Tm9MENC576twVsswmG3zK/fS5CaSzZQbI2DC5mcXCwjA XxAk4roKyt9mXQIwFOqECIolJyl33nMBrQ== X-Google-Smtp-Source: ABdhPJxB+G3fd5zZI61qSXLsymCHjEJIsm+xb88Amu75Oq49JeaJN63RBJgI/Xa7ueVXFlieDoMg3A== X-Received: by 2002:a65:4286:: with SMTP id j6mr348633pgp.619.1644255299825; Mon, 07 Feb 2022 09:34:59 -0800 (PST) Received: from p14s (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id e20sm12236492pfn.4.2022.02.07.09.34.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Feb 2022 09:34:58 -0800 (PST) Date: Mon, 7 Feb 2022 10:34:56 -0700 From: Mathieu Poirier To: Peng Fan , arnaud.pouliquen@foss.st.com, hnagalla@ti.com Cc: "Peng Fan (OSS)" , "bjorn.andersson@linaro.org" , "linux-remoteproc@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH V2] remoteproc: support self recovery after rproc crash Message-ID: <20220207173456.GA3355405@p14s> References: <20220126085120.3397450-1-peng.fan@oss.nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220207_093501_476488_128505F8 X-CRM114-Status: GOOD ( 33.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Feb 07, 2022 at 01:31:07AM +0000, Peng Fan wrote: > > Subject: [PATCH V2] remoteproc: support self recovery after rproc crash > > Any comments? Well... At this time there is two patchsets on the mailing list that are introducing serious changes to the subsystem - yours and Arnaud's virtio refactoring work: . [PATCH V2] remoteproc: support self recovery after rproc crash . [RFC PATCH v3 0/4] remoteproc: restructure the remoteproc VirtIO device Both patchsets have ramifications for NXP, ST and TI. As such I am expecting you, Arnaud and Hari to review those before I start looking at them. > > Thanks, > Peng. > > > > > From: Peng Fan > > > > Current logic only support main processor to stop/start the remote processor > > after rproc crash. However to SoC, such as i.MX8QM/QXP, the remote > > processor could do self recovery after crash and trigger watchdog reboot. It > > does not need main processor to load image, stop/start M4 core. > > > > This patch add a new flag to indicate whether the SoC has self recovery > > capability. And introduce two functions: rproc_self_recovery, > > rproc_assisted_recovery for the two cases. Assisted recovery is as before, let > > main processor to help recovery, while self recovery is recover itself withou > > help. To self recovery, we only do detach and attach. > > > > Signed-off-by: Peng Fan > > --- > > > > V2: > > Nothing change in V2. > > Only move this patch out from > > https://patchwork.kernel.org/project/linux-remoteproc/list/?series=604364 > > > > drivers/remoteproc/remoteproc_core.c | 66 ++++++++++++++++++++-------- > > include/linux/remoteproc.h | 2 + > > 2 files changed, 49 insertions(+), 19 deletions(-) > > > > diff --git a/drivers/remoteproc/remoteproc_core.c > > b/drivers/remoteproc/remoteproc_core.c > > index 69f51acf235e..4bd5544dab8f 100644 > > --- a/drivers/remoteproc/remoteproc_core.c > > +++ b/drivers/remoteproc/remoteproc_core.c > > @@ -1887,6 +1887,49 @@ static int __rproc_detach(struct rproc *rproc) > > return 0; > > } > > > > +static int rproc_self_recovery(struct rproc *rproc) { > > + int ret; > > + > > + mutex_unlock(&rproc->lock); > > + ret = rproc_detach(rproc); > > + mutex_lock(&rproc->lock); > > + if (ret) > > + return ret; > > + > > + if (atomic_inc_return(&rproc->power) > 1) > > + return 0; > > + return rproc_attach(rproc); > > +} > > + > > +static int rproc_assisted_recovery(struct rproc *rproc) { > > + const struct firmware *firmware_p; > > + struct device *dev = &rproc->dev; > > + int ret; > > + > > + ret = rproc_stop(rproc, true); > > + if (ret) > > + return ret; > > + > > + /* generate coredump */ > > + rproc->ops->coredump(rproc); > > + > > + /* load firmware */ > > + ret = request_firmware(&firmware_p, rproc->firmware, dev); > > + if (ret < 0) { > > + dev_err(dev, "request_firmware failed: %d\n", ret); > > + return ret; > > + } > > + > > + /* boot the remote processor up again */ > > + ret = rproc_start(rproc, firmware_p); > > + > > + release_firmware(firmware_p); > > + > > + return ret; > > +} > > + > > /** > > * rproc_trigger_recovery() - recover a remoteproc > > * @rproc: the remote processor > > @@ -1901,7 +1944,6 @@ static int __rproc_detach(struct rproc *rproc) > > */ > > int rproc_trigger_recovery(struct rproc *rproc) { > > - const struct firmware *firmware_p; > > struct device *dev = &rproc->dev; > > int ret; > > > > @@ -1915,24 +1957,10 @@ int rproc_trigger_recovery(struct rproc *rproc) > > > > dev_err(dev, "recovering %s\n", rproc->name); > > > > - ret = rproc_stop(rproc, true); > > - if (ret) > > - goto unlock_mutex; > > - > > - /* generate coredump */ > > - rproc->ops->coredump(rproc); > > - > > - /* load firmware */ > > - ret = request_firmware(&firmware_p, rproc->firmware, dev); > > - if (ret < 0) { > > - dev_err(dev, "request_firmware failed: %d\n", ret); > > - goto unlock_mutex; > > - } > > - > > - /* boot the remote processor up again */ > > - ret = rproc_start(rproc, firmware_p); > > - > > - release_firmware(firmware_p); > > + if (rproc->self_recovery) > > + ret = rproc_self_recovery(rproc); > > + else > > + ret = rproc_assisted_recovery(rproc); > > > > unlock_mutex: > > mutex_unlock(&rproc->lock); > > diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index > > e0600e1e5c17..b32ef46f8aa4 100644 > > --- a/include/linux/remoteproc.h > > +++ b/include/linux/remoteproc.h > > @@ -529,6 +529,7 @@ struct rproc_dump_segment { > > * @elf_machine: firmware ELF machine > > * @cdev: character device of the rproc > > * @cdev_put_on_release: flag to indicate if remoteproc should be > > shutdown on @char_dev release > > + * @self_recovery: flag to indicate if remoteproc support self recovery > > */ > > struct rproc { > > struct list_head node; > > @@ -568,6 +569,7 @@ struct rproc { > > u16 elf_machine; > > struct cdev cdev; > > bool cdev_put_on_release; > > + bool self_recovery; > > }; > > > > /** > > -- > > 2.25.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel