History

mailbox: forward the hrtimer if not queued and under a lock

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.

Björn Ardö committed 4 years ago

Commit bca1a101 parent c25f7782 files · +14 −6Browse files

Showing the changes to include (1 of 2 files). Show all

Unified · Split

include/linux/mailbox_controller.h+1−0
@@ -83,6 +83,7 @@ struct mbox_controller { · 82 unmodified lines
83 const struct of_phandle_args *sp);83 const struct of_phandle_args *sp);
84 /* Internal to API */84 /* Internal to API */
85 struct hrtimer poll_hrt;85 struct hrtimer poll_hrt;
86 spinlock_t poll_hrt_lock;
86 struct list_head node;87 struct list_head node;
87};88};
88 89