Received: by 10.192.165.148 with SMTP id m20csp728739imm; Wed, 25 Apr 2018 06:51:28 -0700 (PDT) X-Google-Smtp-Source: AIpwx48bLPmulLY3QFoqAMBWrmcApGTZ9+YHjFLjLLgwJzNl2/W12N1IdJqXWa6MricbsJKYEafY X-Received: by 10.99.119.206 with SMTP id s197mr23266188pgc.272.1524664288679; Wed, 25 Apr 2018 06:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524664288; cv=none; d=google.com; s=arc-20160816; b=qfqePhNBJAHnfl4Tb7IKE/xdwRZ5FQaiwzXlMfMVtouDhgf30YjESEf8ipOnc1c5kn 07LPwdy0Z0sp6f3lKtc7H3xGYctvnqGliWstATo1FaQIrMJT4JeMdIdgrZjbj6WX34X5 l12W6mjobKvPPVVEpQU5EG3lAKwU2iTdbEKD4CCE3fRB/zKx5jvMl4OrLqQVlP86Hge6 g8KfO8iiqSaHQSV7smA/ZCwpCbGvNjnwhjCsdCFjlLZKbueBYP+SVU7i7Lh1FGTZH1ZL cW0pBcWBuyQAK4V4xmcAK7pqMPEjva5NGuS+iEbzVl/4SIJhkIGFMrcaN+Tsq4flSrPX 6pSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=SbzYPvmQMk7lP2VxzLR6EOcYdw18093A3ziabtQVys0=; b=wNKYSIodKmM9n5xd9Fjxesu4gZivwl/e/2OkMfQqwQdEshRvtuZq4R2ODPp376BiML R94H9O+uwDn6o0uZIn7fksSaCWRzQL2ki0koKx+9rUAxd23qSiHQVXwilDf/x/nPMVVM /3LIwsJh1/f0L+8FuvKaJcfM/j5z00MlB/Y0HXAEFles+HtcyYjueaMTG+VjTe8Kq2FT b32l7DyHvgYHv2i5YmHDtbUu8+nj/BxyZNd8Neeq/zj8iGSMMfy4gZRUi4J+CWSQ6zvF +srFRCe8lXShziOicDJE49pxaGB22XmOC4lsVbj5f4Pb7HSuVi/oWsWgCDpxS8VfR0z1 OpSg== ARC-Authentication-Results: i=1; mx.google.com; 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 d14si14417707pfl.122.2018.04.25.06.51.13; Wed, 25 Apr 2018 06:51:28 -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; 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 S1754473AbeDYNta (ORCPT + 99 others); Wed, 25 Apr 2018 09:49:30 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:45168 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754043AbeDYNt2 (ORCPT ); Wed, 25 Apr 2018 09:49:28 -0400 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w3PDnPj1018444; Wed, 25 Apr 2018 15:49:26 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2hj2m1x68k-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 25 Apr 2018 15:49:26 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 32FAA34; Wed, 25 Apr 2018 13:49:26 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag3node1.st.com [10.75.127.7]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 11B1C4DC0; Wed, 25 Apr 2018 13:49:26 +0000 (GMT) Received: from [10.201.23.162] (10.75.127.47) by SFHDAG3NODE1.st.com (10.75.127.7) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Wed, 25 Apr 2018 15:49:25 +0200 Subject: Re: [PATCH] remoteproc: rename "crashed" parameter To: Alex Elder , , CC: , References: <20180425133626.11781-1-elder@linaro.org> From: Arnaud Pouliquen Message-ID: <93951de4-3758-0293-eeb1-bba9dd561c4b@st.com> Date: Wed, 25 Apr 2018 15:49:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180425133626.11781-1-elder@linaro.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.75.127.47] X-ClientProxiedBy: SFHDAG5NODE1.st.com (10.75.127.13) To SFHDAG3NODE1.st.com (10.75.127.7) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-25_04:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Alex, I have already proposed it few weeks ago. https://lkml.org/lkml/2018/4/10/192 could you ack it, if you test it on your side? Thanks, Arnaud On 04/25/2018 03:36 PM, Alex Elder wrote: > The last commit to "remoteproc_core.c": > 880f5b388252 remoteproc: eAPass type of shutdown to subdev remove > added a Boolean flag to the subdevice remove method, to distinguish > between graceful shutdown and a crash. Unfortunately, the names of > the parameters were inconsistent, and in fact have opposite meanings. > > In most cases, the parameter is named "crashed", but rproc_add_subdev() > names the parameter "graceful" in the prototype for the remove method. > > The remove method is ultimately called (and supplied with the Boolean > flag value) by rproc_remove_subdevices(). That is only called by > rproc_stop(), and in the two spots where that is used, "graceful" is > the right name for the flag: > rproc_shutdown() passes true, indicating a graceful shutdown > rproc_trigger_recovery() passes false, indicating a crash > > The fix is to make the parameter name consistent, and making the > name and sense of the parameter to always be "crashed" produces the > smallest change. So that's what this patch does. > > To verify this change, rproc_add_subdev() is called in five spots: > - qcom_add_glink_subdev() passes glink_subdev_remove() > - qcom_add_smd_subdev() passes smd_subdev_remove() > - qcom_add_ssr_subdev() passes ssr_notify_stop() > - qcom_add_sysmon_subdev() passes sysmon_stop() > - rproc_handle_vdev() passes rproc_vdev_do_remove() > > Of these, only sysmon_stop() uses its "crashed" parameter. And it > clearly assumes that "crashed" is the intended meaning: > > /* Don't request graceful shutdown if we've crashed */ > if (crashed) > return; > > So this function (added after the "crashed" parameter was added) > exhibited buggy behavior, which is now fixed by this patch. > > Signed-off-by: Alex Elder > --- > drivers/remoteproc/remoteproc_core.c | 4 ++-- > include/linux/remoteproc.h | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c > index 6d9c5832ce47..a9609d971f7f 100644 > --- a/drivers/remoteproc/remoteproc_core.c > +++ b/drivers/remoteproc/remoteproc_core.c > @@ -1163,7 +1163,7 @@ int rproc_trigger_recovery(struct rproc *rproc) > if (ret) > return ret; > > - ret = rproc_stop(rproc, false); > + ret = rproc_stop(rproc, true); > if (ret) > goto unlock_mutex; > > @@ -1316,7 +1316,7 @@ void rproc_shutdown(struct rproc *rproc) > if (!atomic_dec_and_test(&rproc->power)) > goto out; > > - ret = rproc_stop(rproc, true); > + ret = rproc_stop(rproc, false); > if (ret) { > atomic_inc(&rproc->power); > goto out; > diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h > index d09a9c7af109..dfdaede9139e 100644 > --- a/include/linux/remoteproc.h > +++ b/include/linux/remoteproc.h > @@ -569,7 +569,7 @@ static inline struct rproc *vdev_to_rproc(struct virtio_device *vdev) > void rproc_add_subdev(struct rproc *rproc, > struct rproc_subdev *subdev, > int (*probe)(struct rproc_subdev *subdev), > - void (*remove)(struct rproc_subdev *subdev, bool graceful)); > + void (*remove)(struct rproc_subdev *subdev, bool crashed)); > > void rproc_remove_subdev(struct rproc *rproc, struct rproc_subdev *subdev); > >