summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBjörn Ardö <bjorn.ardo@axis.com>2022-03-31 09:01:15 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-06-14 18:11:42 +0200
commit6d8b9f574bcac0694fb0476e8e478be2f2362e7c (patch)
treefbec2aab5f35468bccbddf467b6a59a4b4c8e2bc /include
parent49c1e32e7b3f301642a60448700ec531df981269 (diff)
downloadlinux-stable-6d8b9f574bcac0694fb0476e8e478be2f2362e7c.tar.gz
linux-stable-6d8b9f574bcac0694fb0476e8e478be2f2362e7c.tar.bz2
linux-stable-6d8b9f574bcac0694fb0476e8e478be2f2362e7c.zip
mailbox: forward the hrtimer if not queued and under a lock
[ Upstream commit bca1a1004615efe141fd78f360ecc48c60bc4ad5 ] This reverts commit c7dacf5b0f32957b24ef29df1207dc2cd8307743, "mailbox: avoid timer start from callback" The previous commit was reverted since it lead to a race that caused the hrtimer to not be started at all. The check for hrtimer_active() in msg_submit() will return true if the callback function txdone_hrtimer() is currently running. This function could return HRTIMER_NORESTART and then the timer will not be restarted, and also msg_submit() will not start the timer. This will lead to a message actually being submitted but no timer will start to check for its compleation. The original fix that added checking hrtimer_active() was added to avoid a warning with hrtimer_forward. Looking in the kernel another solution to avoid this warning is to check hrtimer_is_queued() before calling hrtimer_forward_now() instead. This however requires a lock so the timer is not started by msg_submit() inbetween this check and the hrtimer_forward() call. Fixes: c7dacf5b0f32 ("mailbox: avoid timer start from callback") Signed-off-by: Björn Ardö <bjorn.ardo@axis.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mailbox_controller.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/mailbox_controller.h b/include/linux/mailbox_controller.h
index 36d6ce673503..6fee33cb52f5 100644
--- a/include/linux/mailbox_controller.h
+++ b/include/linux/mailbox_controller.h
@@ -83,6 +83,7 @@ struct mbox_controller {
const struct of_phandle_args *sp);
/* Internal to API */
struct hrtimer poll_hrt;
+ spinlock_t poll_hrt_lock;
struct list_head node;
};