From: Jinjian Song <jinjian.song@fibocom.com>
To: ryazanov.s.a@gmail.com, Jinjian Song <jinjian.song@fibocom.com>,
chandrashekar.devegowda@intel.com,
chiranjeevi.rapolu@linux.intel.com, haijun.liu@mediatek.com,
ricardo.martinez@linux.intel.com, loic.poulain@linaro.org,
johannes@sipsolutions.net, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com
Cc: andrew+netdev@lunn.ch, angelogioacchino.delregno@collabora.com,
corbet@lwn.net, danielwinkler@google.com, helgaas@kernel.org,
horms@kernel.org, korneld@google.com,
linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
matthias.bgg@gmail.com, netdev@vger.kernel.org
Subject: Re: [net v2] net: wwan: t7xx: Fix FSM command timeout issue
Date: Mon, 16 Dec 2024 21:53:22 +0800 [thread overview]
Message-ID: <20241216135322.4533-1-jinjian.song@fibocom.com> (raw)
In-Reply-To: <da90f64c-260a-4329-87bf-1f9ff20a5951@gmail.com>
From: Sergey Ryazanov <ryazanov.s.a@gmail.com>
>> Fixes: d785ed945de6 ("net: wwan: t7xx: PCIe reset rescan")
>
>The completion waiting was introduced in a different commit. I believe,
>the fix tag should be 13e920d93e37 ("net: wwan: t7xx: Add core components")
>
Got it.
[...]
>> if (cmd->flag & FSM_CMD_FLAG_WAIT_FOR_COMPLETION) {
>> *cmd->ret = result;
>
>The memory for the result storage is allocated on the stack as well. And
>writing it unconditionally can cause unexpected consequences.
>
Got it.
[...]
>> wait_ret = wait_for_completion_timeout(&done,
>> msecs_to_jiffies(FSM_CMD_TIMEOUT_MS));
>> - if (!wait_ret)
>> + if (!wait_ret) {
>> + cmd->done = NULL;
>
>We cannot access the command memory here, since fsm_finish_command()
>could release it already.
>
Got it.
[...]
>Here we have an ownership transfer problem and a driver author has tried
>to solve it, but as noticed, we are still experiencing issues in case of
>timeout.
>
>The command completion routine should not release the command memory
>unconditionally. Looks like the references counting approach should help
>us here. E.g.
>1. grab a reference before we put a command into the queue
>1.1. grab an extra reference if we are going to wait the completion
>2. release the reference as soon as we are done with the command execution
>3. in case of completion waiting release the reference as soon as we are
>done with waiting due to completion or timeout
>
>Could you try the following patch? Please note, besides the reference
>counter introduction it also moves completion and result storage inside
>the command structure as advised by the completion documentation.
>
Yes, please let me try the following patch.
[...]
Thanks.
Jinjian,
Best Regards.
next prev parent reply other threads:[~2024-12-16 13:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-13 6:47 [net v2] net: wwan: t7xx: Fix FSM command timeout issue Jinjian Song
2024-12-15 2:17 ` Sergey Ryazanov
2024-12-16 13:53 ` Jinjian Song [this message]
2024-12-20 8:50 ` Jinjian Song
2024-12-22 21:04 ` Sergey Ryazanov
2024-12-23 2:24 ` Jinjian Song
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=20241216135322.4533-1-jinjian.song@fibocom.com \
--to=jinjian.song@fibocom.com \
--cc=andrew+netdev@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chandrashekar.devegowda@intel.com \
--cc=chiranjeevi.rapolu@linux.intel.com \
--cc=corbet@lwn.net \
--cc=danielwinkler@google.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=haijun.liu@mediatek.com \
--cc=helgaas@kernel.org \
--cc=horms@kernel.org \
--cc=johannes@sipsolutions.net \
--cc=korneld@google.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=loic.poulain@linaro.org \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ricardo.martinez@linux.intel.com \
--cc=ryazanov.s.a@gmail.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