[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f0881f3b-036b-462a-9e0c-42ca81807b86@quicinc.com>
Date: Tue, 28 May 2024 15:50:25 -0700
From: Chris Lew <quic_clew@...cinc.com>
To: Bjorn Andersson <andersson@...nel.org>
CC: Baolin Wang <baolin.wang@...ux.alibaba.com>,
Peter Zijlstra
<peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Will Deacon
<will@...nel.org>, Waiman Long <longman@...hat.com>,
Boqun Feng
<boqun.feng@...il.com>, Jonathan Corbet <corbet@....net>,
Mathieu Poirier
<mathieu.poirier@...aro.org>,
Rob Herring <robh@...nel.org>,
Krzysztof
Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
Konrad Dybcio
<konrad.dybcio@...aro.org>,
<linux-remoteproc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-doc@...r.kernel.org>, <linux-arm-msm@...r.kernel.org>,
<devicetree@...r.kernel.org>
Subject: Re: [PATCH v2 3/4] soc: qcom: smem: Add
qcom_smem_bust_hwspin_lock_by_host()
On 5/28/2024 2:55 PM, Bjorn Andersson wrote:
> On Fri, May 24, 2024 at 06:26:42PM GMT, Chris Lew wrote:
>> Add qcom_smem_bust_hwspin_lock_by_host to enable remoteproc to bust the
>> hwspin_lock owned by smem. In the event the remoteproc crashes
>> unexpectedly, the remoteproc driver can invoke this API to try and bust
>> the hwspin_lock and release the lock if still held by the remoteproc
>> device.
>>
>> Signed-off-by: Chris Lew <quic_clew@...cinc.com>
>> ---
>> drivers/soc/qcom/smem.c | 28 ++++++++++++++++++++++++++++
>> include/linux/soc/qcom/smem.h | 2 ++
>> 2 files changed, 30 insertions(+)
>>
>> diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
>> index 7191fa0c087f..683599990387 100644
>> --- a/drivers/soc/qcom/smem.c
>> +++ b/drivers/soc/qcom/smem.c
..
>> + *
>> + * Context: Process context.
>> + *
>> + * Returns: 0 on success, otherwise negative errno.
>> + */
>> +int qcom_smem_bust_hwspin_lock_by_host(unsigned host)
>> +{
>> + if (!__smem)
>> + return -EPROBE_DEFER;
>
> This would be called at a time where -EPROBE_DEFER isn't appropriate,
> the client should invoke qcom_smem_is_available() at probe time to guard
> against this.
>
Should we keep the null pointer check to prevent null pointer
dereference and return 0? Or would it be better to allow the null
pointer deference to go through so we can catch misuse of the API and
ask clients to use qcom_smem_is_available()?
Powered by blists - more mailing lists