* [net-next v1] net: wwan: t7xx: Fix FSM command timeout issue
@ 2024-12-12 10:55 Jinjian Song
2024-12-12 11:01 ` Mateusz Polchlopek
2024-12-12 16:15 ` Bjorn Helgaas
0 siblings, 2 replies; 5+ messages in thread
From: Jinjian Song @ 2024-12-12 10:55 UTC (permalink / raw)
To: chandrashekar.devegowda, chiranjeevi.rapolu, haijun.liu,
m.chetan.kumar, ricardo.martinez, loic.poulain, ryazanov.s.a,
johannes, davem, edumazet, kuba, pabeni
Cc: linux-kernel, netdev, linux-doc, angelogioacchino.delregno,
linux-arm-kernel, matthias.bgg, corbet, linux-mediatek, helgaas,
danielwinkler, korneld, andrew+netdev, horms, Jinjian Song
When driver processes the internal state change command, it use
asynchronous thread to process the command operation. If the main
thread detects that the task has timed out, the asynchronous thread
will panic when executing te completion notification because the
main thread completion object is released.
BUG: unable to handle page fault for address: fffffffffffffff8
PGD 1f283a067 P4D 1f283a067 PUD 1f283c067 PMD 0
Oops: 0000 [#1] PREEMPT SMP NOPTI
RIP: 0010:complete_all+0x3e/0xa0
[...]
Call Trace:
<TASK>
? __die_body+0x68/0xb0
? page_fault_oops+0x379/0x3e0
? exc_page_fault+0x69/0xa0
? asm_exc_page_fault+0x22/0x30
? complete_all+0x3e/0xa0
fsm_main_thread+0xa3/0x9c0 [mtk_t7xx (HASH:1400 5)]
? __pfx_autoremove_wake_function+0x10/0x10
kthread+0xd8/0x110
? __pfx_fsm_main_thread+0x10/0x10 [mtk_t7xx (HASH:1400 5)]
? __pfx_kthread+0x10/0x10
ret_from_fork+0x38/0x50
? __pfx_kthread+0x10/0x10
ret_from_fork_asm+0x1b/0x30
</TASK>
[...]
CR2: fffffffffffffff8
---[ end trace 0000000000000000 ]---
After the main thread determines that the task has timed out, mark
the completion invalid, and add judgment in the asynchronous task.
Signed-off-by: Jinjian Song <jinjian.song@fibocom.com>
---
drivers/net/wwan/t7xx/t7xx_state_monitor.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wwan/t7xx/t7xx_state_monitor.c b/drivers/net/wwan/t7xx/t7xx_state_monitor.c
index 3931c7a13f5a..57f1a7730fff 100644
--- a/drivers/net/wwan/t7xx/t7xx_state_monitor.c
+++ b/drivers/net/wwan/t7xx/t7xx_state_monitor.c
@@ -108,7 +108,8 @@ static void fsm_finish_command(struct t7xx_fsm_ctl *ctl, struct t7xx_fsm_command
{
if (cmd->flag & FSM_CMD_FLAG_WAIT_FOR_COMPLETION) {
*cmd->ret = result;
- complete_all(cmd->done);
+ if (cmd->done)
+ complete_all(cmd->done);
}
kfree(cmd);
@@ -503,8 +504,10 @@ int t7xx_fsm_append_cmd(struct t7xx_fsm_ctl *ctl, enum t7xx_fsm_cmd_state cmd_id
wait_ret = wait_for_completion_timeout(&done,
msecs_to_jiffies(FSM_CMD_TIMEOUT_MS));
- if (!wait_ret)
+ if (!wait_ret) {
+ cmd->done = NULL;
return -ETIMEDOUT;
+ }
return ret;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [net-next v1] net: wwan: t7xx: Fix FSM command timeout issue
2024-12-12 10:55 [net-next v1] net: wwan: t7xx: Fix FSM command timeout issue Jinjian Song
@ 2024-12-12 11:01 ` Mateusz Polchlopek
2024-12-13 2:55 ` Jinjian Song
2024-12-12 16:15 ` Bjorn Helgaas
1 sibling, 1 reply; 5+ messages in thread
From: Mateusz Polchlopek @ 2024-12-12 11:01 UTC (permalink / raw)
To: Jinjian Song, chandrashekar.devegowda, chiranjeevi.rapolu,
haijun.liu, m.chetan.kumar, ricardo.martinez, loic.poulain,
ryazanov.s.a, johannes, davem, edumazet, kuba, pabeni
Cc: linux-kernel, netdev, linux-doc, angelogioacchino.delregno,
linux-arm-kernel, matthias.bgg, corbet, linux-mediatek, helgaas,
danielwinkler, korneld, andrew+netdev, horms
On 12/12/2024 11:55 AM, Jinjian Song wrote:
> When driver processes the internal state change command, it use
> asynchronous thread to process the command operation. If the main
> thread detects that the task has timed out, the asynchronous thread
> will panic when executing te completion notification because the
> main thread completion object is released.
>
> BUG: unable to handle page fault for address: fffffffffffffff8
> PGD 1f283a067 P4D 1f283a067 PUD 1f283c067 PMD 0
> Oops: 0000 [#1] PREEMPT SMP NOPTI
> RIP: 0010:complete_all+0x3e/0xa0
> [...]
> Call Trace:
> <TASK>
> ? __die_body+0x68/0xb0
> ? page_fault_oops+0x379/0x3e0
> ? exc_page_fault+0x69/0xa0
> ? asm_exc_page_fault+0x22/0x30
> ? complete_all+0x3e/0xa0
> fsm_main_thread+0xa3/0x9c0 [mtk_t7xx (HASH:1400 5)]
> ? __pfx_autoremove_wake_function+0x10/0x10
> kthread+0xd8/0x110
> ? __pfx_fsm_main_thread+0x10/0x10 [mtk_t7xx (HASH:1400 5)]
> ? __pfx_kthread+0x10/0x10
> ret_from_fork+0x38/0x50
> ? __pfx_kthread+0x10/0x10
> ret_from_fork_asm+0x1b/0x30
> </TASK>
> [...]
> CR2: fffffffffffffff8
> ---[ end trace 0000000000000000 ]---
>
> After the main thread determines that the task has timed out, mark
> the completion invalid, and add judgment in the asynchronous task.
>
> Signed-off-by: Jinjian Song <jinjian.song@fibocom.com>
> ---
> drivers/net/wwan/t7xx/t7xx_state_monitor.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wwan/t7xx/t7xx_state_monitor.c b/drivers/net/wwan/t7xx/t7xx_state_monitor.c
> index 3931c7a13f5a..57f1a7730fff 100644
> --- a/drivers/net/wwan/t7xx/t7xx_state_monitor.c
> +++ b/drivers/net/wwan/t7xx/t7xx_state_monitor.c
> @@ -108,7 +108,8 @@ static void fsm_finish_command(struct t7xx_fsm_ctl *ctl, struct t7xx_fsm_command
> {
> if (cmd->flag & FSM_CMD_FLAG_WAIT_FOR_COMPLETION) {
> *cmd->ret = result;
> - complete_all(cmd->done);
> + if (cmd->done)
> + complete_all(cmd->done);
> }
>
> kfree(cmd);
> @@ -503,8 +504,10 @@ int t7xx_fsm_append_cmd(struct t7xx_fsm_ctl *ctl, enum t7xx_fsm_cmd_state cmd_id
>
> wait_ret = wait_for_completion_timeout(&done,
> msecs_to_jiffies(FSM_CMD_TIMEOUT_MS));
> - if (!wait_ret)
> + if (!wait_ret) {
> + cmd->done = NULL;
> return -ETIMEDOUT;
> + }
>
> return ret;
> }
If this is a fix then should be targeted to net and not net-next
and probably should have Fixes: tag.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [net-next v1] net: wwan: t7xx: Fix FSM command timeout issue
2024-12-12 11:01 ` Mateusz Polchlopek
@ 2024-12-13 2:55 ` Jinjian Song
0 siblings, 0 replies; 5+ messages in thread
From: Jinjian Song @ 2024-12-13 2:55 UTC (permalink / raw)
To: mateusz.polchlopek, Jinjian Song, chandrashekar.devegowda,
chiranjeevi.rapolu, haijun.liu, m.chetan.kumar, ricardo.martinez,
loic.poulain, ryazanov.s.a, johannes, davem, edumazet, kuba,
pabeni
Cc: andrew+netdev, angelogioacchino.delregno, corbet, danielwinkler,
helgaas, horms, korneld, linux-arm-kernel, linux-doc,
linux-kernel, linux-mediatek, matthias.bgg, netdev
From: Mateusz Polchlopek <mateusz.polchlopek@intel.com>
>On 12/12/2024 11:55 AM, Jinjian Song wrote:
>> When driver processes the internal state change command, it use
>> asynchronous thread to process the command operation. If the main
>> thread detects that the task has timed out, the asynchronous thread
>> will panic when executing te completion notification because the
>> main thread completion object is released.
>>
>[...]
>If this is a fix then should be targeted to net and not net-next
>and probably should have Fixes: tag.
Hi Mateusz,
Please let me request to net and add the Fixes: tag.
Thanks.
Jinjian,
Best Regards.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [net-next v1] net: wwan: t7xx: Fix FSM command timeout issue
2024-12-12 10:55 [net-next v1] net: wwan: t7xx: Fix FSM command timeout issue Jinjian Song
2024-12-12 11:01 ` Mateusz Polchlopek
@ 2024-12-12 16:15 ` Bjorn Helgaas
2024-12-13 2:57 ` Jinjian Song
1 sibling, 1 reply; 5+ messages in thread
From: Bjorn Helgaas @ 2024-12-12 16:15 UTC (permalink / raw)
To: Jinjian Song
Cc: chandrashekar.devegowda, chiranjeevi.rapolu, haijun.liu,
m.chetan.kumar, ricardo.martinez, loic.poulain, ryazanov.s.a,
johannes, davem, edumazet, kuba, pabeni, linux-kernel, netdev,
linux-doc, angelogioacchino.delregno, linux-arm-kernel,
matthias.bgg, corbet, linux-mediatek, danielwinkler, korneld,
andrew+netdev, horms
On Thu, Dec 12, 2024 at 06:55:55PM +0800, Jinjian Song wrote:
> When driver processes the internal state change command, it use
> asynchronous thread to process the command operation. If the main
> thread detects that the task has timed out, the asynchronous thread
> will panic when executing te completion notification because the
> main thread completion object is released.
s/it use/it uses an/
s/te/the/
s/is released/has been released/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [net-next v1] net: wwan: t7xx: Fix FSM command timeout issue
2024-12-12 16:15 ` Bjorn Helgaas
@ 2024-12-13 2:57 ` Jinjian Song
0 siblings, 0 replies; 5+ messages in thread
From: Jinjian Song @ 2024-12-13 2:57 UTC (permalink / raw)
To: helgaas
Cc: andrew+netdev, angelogioacchino.delregno, chandrashekar.devegowda,
chiranjeevi.rapolu, corbet, danielwinkler, davem, edumazet,
haijun.liu, horms, jinjian.song, johannes, korneld, kuba,
linux-arm-kernel, linux-doc, linux-kernel, linux-mediatek,
loic.poulain, m.chetan.kumar, matthias.bgg, netdev, pabeni,
ricardo.martinez, ryazanov.s.a
>On Thu, Dec 12, 2024 at 06:55:55PM +0800, Jinjian Song wrote:
>> When driver processes the internal state change command, it use
>> asynchronous thread to process the command operation. If the main
>> thread detects that the task has timed out, the asynchronous thread
>> will panic when executing te completion notification because the
>> main thread completion object is released.
>
>s/it use/it uses an/
>s/te/the/
>s/is released/has been released/
>
Hi Bjorn,
Got it, please let me to correct these errors.
Thanks.
Jinjian,
Best Regards.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-12-13 2:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-12 10:55 [net-next v1] net: wwan: t7xx: Fix FSM command timeout issue Jinjian Song
2024-12-12 11:01 ` Mateusz Polchlopek
2024-12-13 2:55 ` Jinjian Song
2024-12-12 16:15 ` Bjorn Helgaas
2024-12-13 2:57 ` Jinjian Song
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox