linux-stable/drivers/mailbox
Jassi Brar 8299f4bfa9 mailbox: avoid timer start from callback
[ Upstream commit c7dacf5b0f ]

If the txdone is done by polling, it is possible for msg_submit() to start
the timer while txdone_hrtimer() callback is running. If the timer needs
recheduling, it could already be enqueued by the time hrtimer_forward_now()
is called, leading hrtimer to loudly complain.

WARNING: CPU: 3 PID: 74 at kernel/time/hrtimer.c:932 hrtimer_forward+0xc4/0x110
CPU: 3 PID: 74 Comm: kworker/u8:1 Not tainted 5.9.0-rc2-00236-gd3520067d01c-dirty #5
Hardware name: Libre Computer AML-S805X-AC (DT)
Workqueue: events_freezable_power_ thermal_zone_device_check
pstate: 20000085 (nzCv daIf -PAN -UAO BTYPE=--)
pc : hrtimer_forward+0xc4/0x110
lr : txdone_hrtimer+0xf8/0x118
[...]

This can be fixed by not starting the timer from the callback path. Which
requires the timer reloading as long as any message is queued on the
channel, and not just when current tx is not done yet.

Fixes: 0cc67945ea ("mailbox: switch to hrtimer for tx_complete polling")
Reported-by: Da Xue <da@libre.computer>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Tested-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: Jerome Brunet <jbrunet@baylibre.com>
Tested-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-10-30 10:38:21 +01:00
..
arm_mhu.c
bcm-flexrm-mailbox.c
bcm-pdc-mailbox.c
bcm2835-mailbox.c
hi3660-mailbox.c
hi6220-mailbox.c
imx-mailbox.c mailbox: imx: Fix Tx doorbell shutdown path 2020-01-04 19:13:17 +01:00
Kconfig
mailbox-altera.c
mailbox-sti.c
mailbox-test.c mailbox: mailbox-test: fix null pointer if no mmio 2019-12-05 09:21:35 +01:00
mailbox-xgene-slimpro.c
mailbox.c mailbox: avoid timer start from callback 2020-10-30 10:38:21 +01:00
mailbox.h
Makefile
mtk-cmdq-mailbox.c mailbox: mediatek: Add check for possible failure of kzalloc 2020-01-27 14:49:56 +01:00
omap-mailbox.c
pcc.c
pl320-ipc.c
platform_mhu.c
qcom-apcs-ipc-mailbox.c mailbox: qcom-apcs: fix max_register value 2020-01-27 14:51:14 +01:00
rockchip-mailbox.c
stm32-ipcc.c mailbox: stm32_ipcc: add spinlock to fix channels concurrent access 2019-12-05 09:21:34 +01:00
tegra-hsp.c
ti-msgmgr.c mailbox: ti-msgmgr: Off by one in ti_msgmgr_of_xlate() 2020-01-27 14:50:04 +01:00