Received: by 10.192.165.148 with SMTP id m20csp796342imm; Wed, 25 Apr 2018 07:49:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx49WaQW9VAXX0w+pXZEmd4yzRJv3xn+oFiPR967hb74mF49rZ7LT26dngHnx74Lnizj65xi8 X-Received: by 10.99.6.66 with SMTP id 63mr23978299pgg.10.1524667787649; Wed, 25 Apr 2018 07:49:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524667787; cv=none; d=google.com; s=arc-20160816; b=vWQrpPF01JQDk8M8FqH5Ny6kVOxx0p4bTWepkG+ydfFjWM7yvpdRt/uQ3u1xg05e5C zPtC2qxdRqRR5DeaITf3bP7/zplO5PjEpTsCov2h/8G7MEsssxyxqUvd61kJ8JpLGAp9 PGCf6jJLzJUqwN0m2zQ5Au+yAK1nX4c9+crm+uaQpisBl5aoDrtuG/E5/LczaDUqwW1i GpLXdAcjxJnpwmBsVSD+lKCX0qqyEz6Jwkl2WgSJ6h1GD6QmUCCH+mhF0nbC7Ox8yC+o YosCP3W3ZGNxgWrM+isxTL/LXOV8BWDRALQcamH3ppomgNUIJrcmIClS9jDLGFiB5XPI J5AQ== 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:dkim-signature :arc-authentication-results; bh=4xg4B3zD6hh9tDjJdfZkqwnCj9xCPecun5z/m0iOBRc=; b=rYT8YMnCIn5zuR1ShljkCn+fq4KRbWTEFkt4A4JKvAx60cKG468WFLsc/i2dGP1p2L irA2i++HHyFVJdqCctuI9JTfMHWPB/RRdXWKHzfGQnydQUAh+D13ATI/XFkczlBQ8Hhn 3AgKRzc0iZYmyo+y/QO3Q7cKR8vk8Rc5fCp+NJpx599qnhSU1Lg7q3+yHwExE/E+hny8 aFitogn/u/RUf8NJ/JnJLv9kjCInq7d+aULajSYU6+8p9+wpCWJTTtb1OfrNp45+DK/H +quBfsLpYA5AL+J5EPCVWXe+L4yCy8Ij7RQYhJ+J38oWIR+PdaVjkk7NYiv593f7LbPu wEUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dmOLfJEL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t5si7960726pgp.594.2018.04.25.07.49.33; Wed, 25 Apr 2018 07:49:47 -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; dkim=pass header.i=@linaro.org header.s=google header.b=dmOLfJEL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754781AbeDYOru (ORCPT + 99 others); Wed, 25 Apr 2018 10:47:50 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:54015 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754203AbeDYOrs (ORCPT ); Wed, 25 Apr 2018 10:47:48 -0400 Received: by mail-it0-f67.google.com with SMTP id m134-v6so20303189itb.3 for ; Wed, 25 Apr 2018 07:47:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=4xg4B3zD6hh9tDjJdfZkqwnCj9xCPecun5z/m0iOBRc=; b=dmOLfJELbSUi2LVbwDSi1iQdh0ZLo7E+75wgSwbWf8gtMUAiW1y+1j9+sbiXlHk6BF VqPGzlMzi3ODrIUfhKxEYlOOriwtrycaUeSqfjzuJJ90To7za1XBQLV9SDFhBHeB15c6 w/lIIOHgqcYgIBN3HuP8zgcyX5FryCnZdx5xI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4xg4B3zD6hh9tDjJdfZkqwnCj9xCPecun5z/m0iOBRc=; b=EpNQvHFcr8ngEwNKL0YFNmZB71reRYz2LmULPJ+t1N/LEDJUFVKyjcfwFlJHM4JKRR a1MyPCHIrvPl4Zy7AthlVkJCpbDcZwAyYnckI5q1i++ZQe1OqrsVJQXJ+sj4P8NFNzyi jXJibe+RfBt8ADeKsreTn+NUE1oJMs5KxNNsEnembuvj6HKPNh5v3XSw+nkDk7le3Gsr NdWk67ViJqGJj6umy2WTdxRk5yBazQqZi/qMrnLs5rPF9Z+2JhPuLAgoD2ddVm71x/QR ZMIdHqeJVp3rG/nkxB7qvrhI0rPpXc9rVdrQRg+BsFPi33+N91H8ZbLHd5f7Tc9ggmLx 3PdQ== X-Gm-Message-State: ALQs6tAsvylGcOm+bFWJ4EOJRsOk/YInOtvNSJi7hs5aMeskDyP3d7/z rHYLIGLG/AuqE6STUU2/d4VP6mPqRfc= X-Received: by 2002:a24:6747:: with SMTP id u68-v6mr21465952itc.21.1524667667369; Wed, 25 Apr 2018 07:47:47 -0700 (PDT) Received: from [172.22.22.26] (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.googlemail.com with ESMTPSA id 202-v6sm6587109itw.16.2018.04.25.07.47.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Apr 2018 07:47:46 -0700 (PDT) Subject: Re: [PATCH] remoteproc: rename "crashed" parameter To: Arnaud Pouliquen , ohad@wizery.com, bjorn.andersson@linaro.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180425133626.11781-1-elder@linaro.org> <93951de4-3758-0293-eeb1-bba9dd561c4b@st.com> From: Alex Elder Message-ID: <31b8864a-d94e-64cf-40dd-d03d40963513@linaro.org> Date: Wed, 25 Apr 2018 09:47:46 -0500 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: <93951de4-3758-0293-eeb1-bba9dd561c4b@st.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/25/2018 08:49 AM, Arnaud Pouliquen wrote: > 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? I am unable to test it. I found the bug by inspection (perhaps as you did). However I'll give you: Acked-by: Alex Elder or Reviewed-by: Alex Elder -Alex > 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); >> >>