From: Chris Lew <quic_clew@quicinc.com>
To: Tao Zhang <quic_taozhan@quicinc.com>, <andersson@kernel.org>,
<konrad.dybcio@linaro.org>
Cc: <linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<kernel@quicinc.com>
Subject: Re: [PATCH] qcom: smem: remove hwspinlock from item get routine
Date: Fri, 26 Jan 2024 16:23:43 -0800 [thread overview]
Message-ID: <065cbefc-031e-7595-9d48-f869585dfcd3@quicinc.com> (raw)
In-Reply-To: <20240102022512.999635-1-quic_taozhan@quicinc.com>
On 1/1/2024 6:25 PM, Tao Zhang wrote:
> During an SSR(Sub-System Restart) process, the remoteproc driver will
> try to read the crash reason from SMEM. The qcom_smem_get() backing such
> operations does however take the hwspinlock (tcsr mutex), which might be
> held by the dying remoteproc.
>
> The associated timeout on the hwspin_lock_timeout_irqsave() would take
> care of the system not hanging forever, but the get operation will fail,
> unnecessarily delaying the process for the 'HWSPINLOCK_TIMEOUT' duration
> (currently is '1s'), and finally resulting in failure to get crash
> information from SMEM.
>
> This timeout can be avoided by removing the hwspinlock in the
> qcom_smem_get routine. SMEM ensures that the allocated item will only be
> visible after the new item is safe to use by following a specific order
> of updates.
>
> In the private partition case, qcom_smem_get_private() will use
> 'offset_free_uncached' as a loop boundary when looking for existing
> allocated items. The corresponding allocation will only update
> offset_free_uncached once the item is fully initialized.
>
> hdr->canary = SMEM_PRIVATE_CANARY;
> hdr->item = cpu_to_le16(item);
> hdr->size = cpu_to_le32(ALIGN(size, 8));
> hdr->padding_data = cpu_to_le16(le32_to_cpu(hdr->size) - size);
> hdr->padding_hdr = 0;
>
> wmb();
> le32_add_cpu(&phdr->offset_free_uncached, alloc_size);
>
> The global partition is similar but uses the "entry->allocated" variable
> to ensure the item is not visible to qcom_smem_get_global().
>
> Signed-off-by: Tao Zhang <quic_taozhan@quicinc.com>
> ---
Reviewed-by: Chris Lew <quic_clew@quicinc.com>
next prev parent reply other threads:[~2024-01-27 0:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-02 2:25 Tao Zhang
2024-01-27 0:23 ` Chris Lew [this message]
2024-01-28 17:45 ` Bjorn Andersson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=065cbefc-031e-7595-9d48-f869585dfcd3@quicinc.com \
--to=quic_clew@quicinc.com \
--cc=andersson@kernel.org \
--cc=kernel@quicinc.com \
--cc=konrad.dybcio@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_taozhan@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®