Skip to content

Commit 576ac4a

Browse files
committed
Revert "mailbox: avoid timer start from callback"
This reverts commit 6dc15642c8b830d384fd3e6c9ea63144202b8932. The Pi 400 shutdown/poweroff mechanism relies on being able to set a GPIO on the expander in the pm_power_off handler, something that requires two mailbox calls - GET_GPIO_STATE and SET_GPIO_STATE. A recent kernel change introduces a reasonable possibility that the GET call doesn't completes, and bisecting led to a commit from October that changes the timer usage of the mailbox. My theory is that there is a race condition in the new code that breaks the poll timer, but that it normally goes unnoticed because subsequent mailbox activity wakes it up again. The power-off mailbox calls happen at a time when other subsystems have been shut down, so if one of them fails then there is nothing to allow it to recover. Revert 6dc15642 as (at least) a workaround. See: raspberrypi#3941 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
1 parent c5e512a commit 576ac4a

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

‎drivers/mailbox/mailbox.c‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,9 @@ static void msg_submit(struct mbox_chan *chan)
8282
exit:
8383
spin_unlock_irqrestore(&chan->lock, flags);
8484

85-
/* kick start the timer immediately to avoid delays */
86-
if (!err && (chan->txdone_method & TXDONE_BY_POLL)) {
87-
/* but only if not already active */
88-
if (!hrtimer_active(&chan->mbox->poll_hrt))
89-
hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL);
90-
}
85+
if (!err && (chan->txdone_method & TXDONE_BY_POLL))
86+
/* kick start the timer immediately to avoid delays */
87+
hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL);
9188
}
9289

9390
static void tx_tick(struct mbox_chan *chan, int r)
@@ -125,10 +122,11 @@ static enum hrtimer_restart txdone_hrtimer(struct hrtimer *hrtimer)
125122
struct mbox_chan *chan = &mbox->chans[i];
126123

127124
if (chan->active_req && chan->cl) {
128-
resched = true;
129125
txdone = chan->mbox->ops->last_tx_done(chan);
130126
if (txdone)
131127
tx_tick(chan, 0);
128+
else
129+
resched = true;
132130
}
133131
}
134132

0 commit comments

Comments
 (0)