Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5156484ybl; Wed, 22 Jan 2020 11:22:07 -0800 (PST) X-Google-Smtp-Source: APXvYqyVHS9ZsQr+JQ6F/IxVOnNQsHhMVsWJ1h2qnM0he+PleV5nZ0ERIN2/zR6v01mKFTutnj+2 X-Received: by 2002:a9d:7ccc:: with SMTP id r12mr8802171otn.22.1579720927480; Wed, 22 Jan 2020 11:22:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579720927; cv=none; d=google.com; s=arc-20160816; b=FEGpiupqVgT/ZaF8eGRM3wkdMtrPl+JSXCPUxqRVjRCmEu6Fj2pMzdyuPGvT4P+ZNn T6oajo9C0+ZfqciZlwTtg63F0DwqhQrb438/J5Nvp6Q9CiRA70YKBt9/R7acjKKzO0or O0IuzKeD4UXZyjo3oxob9Ax93TkirWJouSL0O66Fs06rwuDe4BBKaxRVgb9gm4ANxA22 E3Wlx5gOO9Pg2mhrQmL1x3UWebNyvkT1zM+fvMKbHMhuhSOfEi6n3hRl2JhGN1Bi7oMH fkzGA0Yov7sDm6/ZbRQtx4l53Zb5wBWonxYXN1z8oOis0sbyn366wwwNinxeJr8xiIW8 Iskw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=mpnp2dBUwgiSXJqBkhUdFPkzPC82dAX2Dn/bzDab9OI=; b=sesgTIWOqFzwM6mGwBeD+cHQEamf8Yg6yTJNo2uG7rPfSFuzf6Mo6ZWevm738LiSNt +HVnm06VziPlRCmXOJdnJ3pLxsA0ETmcB5XrD99GYd7f6LwykI83aVrFbd63e/twFnpy wbGp68PN5iVub+oldHUt1NQ7c+yiCSnQbjFKndXFQDWXn4OFaqipq7Gim/mXfYDLlavr hfTnWxYPSBNJOj3i4cGZgbuh6zwGlWSCDi8PG6mIgQ4ONpPrRcw4loOCTvJaQ70XfBKb IpR/H8WejIGseoI0KpC9pBvjZ0d2VkD0enEgeN3AnT9rNwOH7RW2W56IscUbDUQGXSJP OG5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TwoKubR7; 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 l25si23928800otn.69.2020.01.22.11.21.51; Wed, 22 Jan 2020 11:22:07 -0800 (PST) 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=TwoKubR7; 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 S1728928AbgAVTUW (ORCPT + 99 others); Wed, 22 Jan 2020 14:20:22 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:42701 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbgAVTUV (ORCPT ); Wed, 22 Jan 2020 14:20:21 -0500 Received: by mail-pl1-f194.google.com with SMTP id p9so184188plk.9 for ; Wed, 22 Jan 2020 11:20:20 -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=mpnp2dBUwgiSXJqBkhUdFPkzPC82dAX2Dn/bzDab9OI=; b=TwoKubR7jNDC4FclY67lUleRt7BkY0+OB6iyNEzor/uNZSPiIrXIXbVINxc/qzjB2/ orFLFxkbQBij/x+q2bSzp8dFpk6zF/y2rOm3kjZKMPKMe9foOSjjaogA/6DtOoLLoPDo CfJcIuhiXScG3eQdaxDxRwz8XaAJgBAUkgMuvw3WKcPAzFEzATmkX+2hI57agzEyDhYe Zl7X2nlFkxbyzB3rhlRCBTg24HqN6LGz740918w1ctTE460zXSILedH6AE2gmqgvj0md 42Ihe9mcJaSvEd0ZCW01Xs7bOgTgfuvM03QU36WVyywF3QvGmk6wgRAZsqc98UC63LXM d2iA== 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=mpnp2dBUwgiSXJqBkhUdFPkzPC82dAX2Dn/bzDab9OI=; b=UKvWGXxaN9AROawWgvLce1zzCkfIPV0GfI3P3FmO3tcZz8L1oE9QL8/zTThwN+xMtc ftIMMDr/7yzfZrccz69sBKn/Xezc5nC8HbCj+kyl8kA9eU+Z/Vhv8bU2LRtZND4IBb78 YcK0PXDGy5UZVNePD9E7FCQo1eKklVM/Pxe88KsJiE24YIdE5wU1ffyXrqzqQvfCybOH h43/Vn42YnKhfFXCYCKkL4ZapN21iptok5Yw3hhRb3ZvbI+GE9ypVTylbIWX1JWsDuWe 3l1p5zwyrBLBl4dxUd04SysilJoafNIfkkPmEtcpd/UYz5lHHKgjmjdzVrzpgQyU7CU4 SqbQ== X-Gm-Message-State: APjAAAUJODrv9F4n+tHy3e+2r27V3yHtTHQUgvHsIs7Gz3pUqGt3z4Dv 0PvqTSfJKth3bBSYLQeCcnR/Rg== X-Received: by 2002:a17:902:7291:: with SMTP id d17mr12134051pll.227.1579720820090; Wed, 22 Jan 2020 11:20:20 -0800 (PST) Received: from ripper (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id a15sm49191872pfh.169.2020.01.22.11.20.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 11:20:19 -0800 (PST) Date: Wed, 22 Jan 2020 11:19:46 -0800 From: Bjorn Andersson To: Mathieu Poirier Cc: Rob Herring , Mark Rutland , Ohad Ben-Cohen , linux-arm-msm , devicetree@vger.kernel.org, Linux Kernel Mailing List , linux-remoteproc , Sibi Sankar , Rishabh Bhatnagar Subject: Re: [PATCH v2 2/8] remoteproc: qcom: Introduce driver to store pil info in IMEM Message-ID: <20200122191946.GA3261042@ripper> References: <20191227053215.423811-1-bjorn.andersson@linaro.org> <20191227053215.423811-3-bjorn.andersson@linaro.org> <20200110211846.GA11555@xps15> <20200122020234.GT1511@yoga> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 22 Jan 11:04 PST 2020, Mathieu Poirier wrote: > On Tue, 21 Jan 2020 at 19:02, Bjorn Andersson > wrote: > > > > On Fri 10 Jan 13:18 PST 2020, Mathieu Poirier wrote: > > > On Thu, Dec 26, 2019 at 09:32:09PM -0800, Bjorn Andersson wrote: > > [..] > > > > diff --git a/drivers/remoteproc/qcom_pil_info.c b/drivers/remoteproc/qcom_pil_info.c > > > > new file mode 100644 > > > > index 000000000000..b0897ae9eae5 > > > > --- /dev/null > > > > +++ b/drivers/remoteproc/qcom_pil_info.c > > > > @@ -0,0 +1,150 @@ > > > > +// SPDX-License-Identifier: GPL-2.0-only > > > > +/* > > > > + * Copyright (c) 2019 Linaro Ltd. > > > > + */ > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > > > These should be in alphabetical order if there is no depencencies > > > between them, something checkpatch complains about. > > > > > > > Of course. > > > > > > + > > > > +struct pil_reloc_entry { > > > > + char name[8]; > > > > > > Please add a #define for the name length and reuse it in qcom_pil_info_store() > > > > > > > Ok > > > > [..] > > > > +void qcom_pil_info_store(const char *image, phys_addr_t base, size_t size) > > > > +{ > > > > + struct pil_reloc_entry *entry; > > > > + int idx = -1; > > > > + int i; > > > > + > > > > + mutex_lock(&reloc_mutex); > > > > + if (!_reloc) > > > > > > Since it is available, I would use function qcom_pil_info_available(). Also > > > checkpatch complains about indentation problems related to the 'if' condition > > > but I can't see what makes it angry. > > > > > > > Sure thing, and I'll double check the indentation. > > > > > > + goto unlock; > > > > + > > > > + for (i = 0; i < PIL_INFO_ENTRIES; i++) { > > > > + if (!_reloc->entries[i].name[0]) { > > > > + if (idx == -1) > > > > + idx = i; > > > > + continue; > > > > + } > > > > + > > > > + if (!strncmp(_reloc->entries[i].name, image, 8)) { > > > > + idx = i; > > > > + goto found; > > > > + } > > > > + } > > > > + > > > > + if (idx == -1) { > > > > + dev_warn(_reloc->dev, "insufficient PIL info slots\n"); > > > > + goto unlock; > > > > > > Given how this function is used in the next patch I think an error should be > > > reported to the caller. > > > > > > > Just to clarify, certain global errors will cause the entire device to > > be reset and allow memory contents to be extracted for analysis in post > > mortem tools. This patch ensures that this information contains > > (structured) information about where each remote processor is loaded. > > Afaict the purpose of propagating errors from this function would be for > > the caller to abort the launching of a remote processor. > > > > I think it's better to take the risk of having insufficient data for the > > post mortem tools than to fail booting a remote processor for a reason > > that won't affect normal operation. > > I understand the reasoning. In that case it is probably best to let > the caller decide what to do with the returned error than deal with it > locally, especially since this is an exported function. When using > qcom_pil_info_store(), I would write a comment that justifies the > reason for ignoring the return value (what you have above is quite > good). Otherwise it is just a matter of time before automated tools > pickup on the anomaly and send patches to fix it. > You're right, moving the decision to the remoteproc drivers will result in the decision being implemented in the right place. I will respin it accordingly. Thanks! Bjorn