Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1995375imw; Sat, 16 Jul 2022 21:34:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v8yfag9v09+it+lR7ztAAZMHhH+vIjP/6fS4u9DNAXS042l8uR8sMqxiI5tN/AFGMjtgSx X-Received: by 2002:a17:906:8a5a:b0:72b:6b60:2d9f with SMTP id gx26-20020a1709068a5a00b0072b6b602d9fmr20921277ejc.324.1658032468716; Sat, 16 Jul 2022 21:34:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658032468; cv=none; d=google.com; s=arc-20160816; b=vV9tnvjs81YyAnyC7eNn33NWM7IfryZBPIJJVklmD0cnZJ/1M6FusEhAPA3izJeB5Q 3iQnCW4ar+/rZfMWqZfeMwjKnP18kmfvAGLdkiHpBLErDbMYfjVuBQfotQJpr8Eh3A7p gUM/4U09nYV5basHRIBEQ43mJpBbagY7sBRZM066JTBD0btiBUn9Jlk++Vf8XylqGfB8 I2NofVrXhnzNIF4BtRl7cbbf1S4Udc0PUonQx0g9GsaI+Tt3whZzI1b7N2qsDwD4NY81 EHjeySS0vh4yUzGsDzMWtWNyiGKQcBQ1zSGv/wZdODfKpPQVIxS5lhg6MbGmKaMgZv1D qfSg== 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=7maQPp/4L1DRl1i7L7WTXN1f8HRR3AHs0CFk6kAGA8Q=; b=0wrh/9PuvvYLOKi8WnAuFTnDtYDoTBgkVl/vLW6xpNE3jbZpj9E4aKCrvL2+fYMReA xYOVhi0cqmqw5/E4S1VhWlbxpPSQJWSI9NYIxGJBG4CgJ41bC/8+jb68dHpRR9CNOLeS Apzynmag5NbFphV9PGNBdw0ywlX9uqjIniKr12byryAeEu0oz+TjI1vFzsyKX3wb1zOs EL7FZSg42UeJsPFpK22E7pZdwMYzIKdzE4nU4g/wGuuD+mx/JcsdUsROvDog8INx4kE/ kSqKDWPCp0kWfkRWqrAwaLMcIB7azoFbX4QvlCupgg0egedTweGQ1jGnkfEUvXqUA55R k5mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i1XgxSFl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn2-20020a17090794c200b0072f09e70939si7337190ejc.131.2022.07.16.21.33.56; Sat, 16 Jul 2022 21:34:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i1XgxSFl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232549AbiGQEH2 (ORCPT + 99 others); Sun, 17 Jul 2022 00:07:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbiGQEH0 (ORCPT ); Sun, 17 Jul 2022 00:07:26 -0400 Received: from mail-oa1-x29.google.com (mail-oa1-x29.google.com [IPv6:2001:4860:4864:20::29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6A591EC58 for ; Sat, 16 Jul 2022 21:07:25 -0700 (PDT) Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-10c0430e27dso15829174fac.4 for ; Sat, 16 Jul 2022 21:07:25 -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=7maQPp/4L1DRl1i7L7WTXN1f8HRR3AHs0CFk6kAGA8Q=; b=i1XgxSFl0g91RDOuxsh9q01eMgRrA8bv2u7c2UnsQMI5vi4DxPAtRaiEeOUbyTP44p tSdWldY8Uz84HdD1Oran6Ckr6GSVx+bnQh79xSSKOzhgYknyul7NwCOWUbksJ5dQKI9O cNoWTV0OxpVNeOvL8FL1Wx41LfoVW9ALmGPvuipft/j31vt+xs1OExAYLdk/iMLLo8fl GuzU/1mn0+U+G+CdjWXLSaMbajEQEVj2pNkkPkjA3JNuqk2YN64WcyLplcjYzUb8if2d llyoNn4PzA98R2PuE2+9G18mWebPGfYMZ4IFms2JMfRfYs0nnGp2D1ClbI5WCdIr7afp X/ow== 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=7maQPp/4L1DRl1i7L7WTXN1f8HRR3AHs0CFk6kAGA8Q=; b=Z41mymkaExyvKODy5oXFWr97FD51WGT/Mx2K0aXMKu37MWRrIBR9BKvxs5LCSwGcQB BQsOAA8OgXTQU2IneHR0h1pnTrQCoby8Ik2ilLkIyhaktKF1lacQpFMPQRdl9NVoSdgc hepInnkQfSWbCQwMhiw4A95TMMS5WuI2bMzQJvueFXwEgG+Pfx/bLYnnrRqEjldqVnta xqJBPsIHtaCmqRLEF/CsOGRRVOLoYdnSUR3jSr7/kKaPzMF2lR+LfnlUXz7CkcyUIkIo Vw0iZ5Z+C4mKEJnovexatPk7p9WU6Yu+L3l8st9c4MY38uG0fYpsZR5KsmpyMQ8VZdXJ 0Zdw== X-Gm-Message-State: AJIora9K/xIEcwLraYmYdgJ9wKUfakc6vvnMFs2uU1+UntyvxzGDxARt d4YutHarZL9SddCvia5bSGtOPA== X-Received: by 2002:a05:6870:2490:b0:101:d94b:c9fd with SMTP id s16-20020a056870249000b00101d94bc9fdmr10910528oaq.73.1658030845116; Sat, 16 Jul 2022 21:07:25 -0700 (PDT) Received: from builder.lan (104-57-184-186.lightspeed.austtx.sbcglobal.net. [104.57.184.186]) by smtp.gmail.com with ESMTPSA id w21-20020a9d6755000000b0061c9c7813d4sm547368otm.24.2022.07.16.21.07.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Jul 2022 21:07:23 -0700 (PDT) Date: Sat, 16 Jul 2022 23:07:21 -0500 From: Bjorn Andersson To: "Peng Fan (OSS)" Cc: mathieu.poirier@linaro.org, linux-imx@nxp.com, linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan Subject: Re: [PATCH] remoteproc: core: check state in rproc_boot Message-ID: References: <20220519064111.3244079-1-peng.fan@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220519064111.3244079-1-peng.fan@oss.nxp.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 19 May 01:41 CDT 2022, Peng Fan (OSS) wrote: > From: Peng Fan > > If remote processor has already been in RUNNING or ATTACHED > state, report it. Not just increment the power counter and return > success. > > Without this patch, if m7 is in RUNNING state, and start it again, > nothing output to console. > If wanna to stop the m7, we need write twice 'stop'. > > This patch is to improve that the 2nd start would show some useful > info. > > Signed-off-by: Peng Fan > --- > > Not sure to keep power counter or not. > I did discuss this with Mathieu, whom argued in favor of keeping the refcount mechanism. I can see that there could be a scenario where multiple user-space components keep the remotproc running while they are, and if there is any such user this ABI change would be a breakage. That said, it's more than once that I accidentally have bumped the refcount and then assumed that a single stop would tear down the remoteproc... > drivers/remoteproc/remoteproc_core.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c > index 02a04ab34a23..f37e0758c096 100644 > --- a/drivers/remoteproc/remoteproc_core.c > +++ b/drivers/remoteproc/remoteproc_core.c > @@ -2005,6 +2005,12 @@ int rproc_boot(struct rproc *rproc) > goto unlock_mutex; > } > > + if (rproc->state == RPROC_RUNNING || rproc->state == RPROC_ATTACHED) { If we were to do this would it make sense to boot it out of anything but RPROC_OFFLINE? Regards, Bjorn > + ret = -EINVAL; > + dev_err(dev, "%s already booted\n", rproc->name); > + goto unlock_mutex; > + } > + > /* skip the boot or attach process if rproc is already powered up */ > if (atomic_inc_return(&rproc->power) > 1) { > ret = 0; > -- > 2.25.1 >