[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4e5c2634-b3a4-4dae-ab1e-fa11d4329417@collabora.com>
Date: Thu, 18 Jul 2024 16:34:00 +0200
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
To: jason-jh.lin@...iatek.com, Jassi Brar <jassisinghbrar@...il.com>,
CK Hu <ck.hu@...iatek.com>
Cc: Jassi Brar <jaswinder.singh@...aro.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Singo Chang <singo.chang@...iatek.com>, Nancy Lin <nancy.lin@...iatek.com>,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org,
Project_Global_Chrome_Upstream_Group@...iatek.com
Subject: Re: [PATCH v3] mailbox: mtk-cmdq: Move
devm_mbox_controller_register() after devm_pm_runtime_enable()
Il 18/07/24 16:17, Jason-JH.Lin via B4 Relay ha scritto:
> From: "Jason-JH.Lin" <jason-jh.lin@...iatek.com>
>
> When mtk-cmdq unbinds, a WARN_ON message with condition
> pm_runtime_get_sync() < 0 occurs.
>
> According to the call tracei below:
> cmdq_mbox_shutdown
> mbox_free_channel
> mbox_controller_unregister
> __devm_mbox_controller_unregister
> ...
>
> The root cause can be deduced to be calling pm_runtime_get_sync() after
> calling pm_runtime_disable() as observed below:
> 1. CMDQ driver uses devm_mbox_controller_register() in cmdq_probe()
> to bind the cmdq device to the mbox_controller, so
> devm_mbox_controller_unregister() will automatically unregister
> the device bound to the mailbox controller when the device-managed
> resource is removed. That means devm_mbox_controller_unregister()
> and cmdq_mbox_shoutdown() will be called after cmdq_remove().
> 2. CMDQ driver also uses devm_pm_runtime_enable() in cmdq_probe() after
> devm_mbox_controller_register(), so that devm_pm_runtime_disable()
> will be called after cmdq_remove(), but before
> devm_mbox_controller_unregister().
>
> To fix this problem, cmdq_probe() needs to move
> devm_mbox_controller_register() after devm_pm_runtime_enable() to make
> devm_pm_runtime_disable() be called after
> devm_mbox_controller_unregister().
>
> Fixes: 623a6143a845 ("mailbox: mediatek: Add Mediatek CMDQ driver")
> Signed-off-by: Jason-JH.Lin <jason-jh.lin@...iatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
Powered by blists - more mailing lists