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

This reverts commit 6d8b9f574b which is
commit bca1a1004615efe141fd78f360ecc48c60bc4ad5 upstream.

It breaks the kernel api and isn't anything that is relevant for Android
systems as it was already fixed in Android in a different way, so it can
be reverted.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I49bf9cf61438dbd002eaf89dc0c1ce514fd66e17
This commit is contained in:
Greg Kroah-Hartman 2022-06-22 16:58:18 +02:00
parent 829ffaa71c
commit bba1b765b9
2 changed files with 6 additions and 14 deletions

View File

@ -82,11 +82,11 @@ static void msg_submit(struct mbox_chan *chan)
exit: exit:
spin_unlock_irqrestore(&chan->lock, flags); spin_unlock_irqrestore(&chan->lock, flags);
if (!err && (chan->txdone_method & TXDONE_BY_POLL)) {
/* kick start the timer immediately to avoid delays */ /* kick start the timer immediately to avoid delays */
spin_lock_irqsave(&chan->mbox->poll_hrt_lock, flags); if (!err && (chan->txdone_method & TXDONE_BY_POLL)) {
/* but only if not already active */
if (!hrtimer_active(&chan->mbox->poll_hrt))
hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL); hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL);
spin_unlock_irqrestore(&chan->mbox->poll_hrt_lock, flags);
} }
} }
@ -120,26 +120,20 @@ static enum hrtimer_restart txdone_hrtimer(struct hrtimer *hrtimer)
container_of(hrtimer, struct mbox_controller, poll_hrt); container_of(hrtimer, struct mbox_controller, poll_hrt);
bool txdone, resched = false; bool txdone, resched = false;
int i; int i;
unsigned long flags;
for (i = 0; i < mbox->num_chans; i++) { for (i = 0; i < mbox->num_chans; i++) {
struct mbox_chan *chan = &mbox->chans[i]; struct mbox_chan *chan = &mbox->chans[i];
if (chan->active_req && chan->cl) { if (chan->active_req && chan->cl) {
resched = true;
txdone = chan->mbox->ops->last_tx_done(chan); txdone = chan->mbox->ops->last_tx_done(chan);
if (txdone) if (txdone)
tx_tick(chan, 0); tx_tick(chan, 0);
else
resched = true;
} }
} }
if (resched) { if (resched) {
spin_lock_irqsave(&mbox->poll_hrt_lock, flags);
if (!hrtimer_is_queued(hrtimer))
hrtimer_forward_now(hrtimer, ms_to_ktime(mbox->txpoll_period)); hrtimer_forward_now(hrtimer, ms_to_ktime(mbox->txpoll_period));
spin_unlock_irqrestore(&mbox->poll_hrt_lock, flags);
return HRTIMER_RESTART; return HRTIMER_RESTART;
} }
return HRTIMER_NORESTART; return HRTIMER_NORESTART;
@ -506,7 +500,6 @@ int mbox_controller_register(struct mbox_controller *mbox)
hrtimer_init(&mbox->poll_hrt, CLOCK_MONOTONIC, hrtimer_init(&mbox->poll_hrt, CLOCK_MONOTONIC,
HRTIMER_MODE_REL); HRTIMER_MODE_REL);
mbox->poll_hrt.function = txdone_hrtimer; mbox->poll_hrt.function = txdone_hrtimer;
spin_lock_init(&mbox->poll_hrt_lock);
} }
for (i = 0; i < mbox->num_chans; i++) { for (i = 0; i < mbox->num_chans; i++) {

View File

@ -83,7 +83,6 @@ struct mbox_controller {
const struct of_phandle_args *sp); const struct of_phandle_args *sp);
/* Internal to API */ /* Internal to API */
struct hrtimer poll_hrt; struct hrtimer poll_hrt;
spinlock_t poll_hrt_lock;
struct list_head node; struct list_head node;
}; };