[RESEND PATCH] pinctrl: mediatek: use spin lock in mtk_rmw
Andy Shevchenko
andy.shevchenko at gmail.com
Mon Apr 19 09:31:14 BST 2021
On Mon, Apr 19, 2021 at 8:32 AM Tzung-Bi Shih <tzungbi at google.com> wrote:
>
> Commit 42a46434e9b1 ("pinctrl: add lock in mtk_rmw function.") uses
> mutex lock in mtk_rmw. However the function is possible called from
> atomic context.
>
> For example call trace:
Please, shrink it to the necessary minimum.
> mutex_lock+0x28/0x64
> mtk_rmw+0x38/0x80
> mtk_hw_set_value+0x100/0x138
> mtk_gpio_set+0x48/0x58
> gpiod_set_raw_value_commit+0xf4/0x110
> gpiod_set_value_nocheck+0x4c/0x80
> gpiod_set_value+0x4c/0x6c
> max98357a_daiops_trigger+0x8c/0x9c
> soc_pcm_trigger+0x5c/0x10c
>
> The max98357a_daiops_trigger() could run in either atomic or non-atomic
> context. As a result, dmesg shows some similar messages: "BUG: sleeping
> function called from invalid context at kernel/locking/mutex.c:254".
>
> Uses spin lock in mtk_rmw instead.
It's nice, but now the question is, can you have this function be
called in a non-IRQ context concurrently with IRQ accessing registers?
--
With Best Regards,
Andy Shevchenko
More information about the Linux-mediatek
mailing list