diff mbox series

[SRU,G/raspi] UBUNTU: SAUCE: Revert "mailbox: avoid timer start from callback"

Message ID 20201214074024.633315-1-juergh@canonical.com
State New
Headers show
Series [SRU,G/raspi] UBUNTU: SAUCE: Revert "mailbox: avoid timer start from callback" | expand

Commit Message

Juerg Haefliger Dec. 14, 2020, 7:40 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1907432

This reverts commit 186734a27698abec8f1dec2adb819ceccebf2ffc to fix
a shutdown issue on the Pi 400.

See: https://github.com/raspberrypi/linux/issues/3941

Signed-off-by: Juerg Haefliger <juergh@canonical.com>
---
 drivers/mailbox/mailbox.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

Comments

Colin Ian King Dec. 14, 2020, 2:27 p.m. UTC | #1
On 14/12/2020 07:40, Juerg Haefliger wrote:
> BugLink: https://bugs.launchpad.net/bugs/1907432
> 
> This reverts commit 186734a27698abec8f1dec2adb819ceccebf2ffc to fix
> a shutdown issue on the Pi 400.
> 
> See: https://github.com/raspberrypi/linux/issues/3941
> 
> Signed-off-by: Juerg Haefliger <juergh@canonical.com>
> ---
>  drivers/mailbox/mailbox.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
> index 3e7d4b20ab34..0b821a5b2db8 100644
> --- a/drivers/mailbox/mailbox.c
> +++ b/drivers/mailbox/mailbox.c
> @@ -82,12 +82,9 @@ static void msg_submit(struct mbox_chan *chan)
>  exit:
>  	spin_unlock_irqrestore(&chan->lock, flags);
>  
> -	/* kick start the timer immediately to avoid delays */
> -	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);
> -	}
> +	if (!err && (chan->txdone_method & TXDONE_BY_POLL))
> +		/* kick start the timer immediately to avoid delays */
> +		hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL);
>  }
>  
>  static void tx_tick(struct mbox_chan *chan, int r)
> @@ -125,10 +122,11 @@ static enum hrtimer_restart txdone_hrtimer(struct hrtimer *hrtimer)
>  		struct mbox_chan *chan = &mbox->chans[i];
>  
>  		if (chan->active_req && chan->cl) {
> -			resched = true;
>  			txdone = chan->mbox->ops->last_tx_done(chan);
>  			if (txdone)
>  				tx_tick(chan, 0);
> +			else
> +				resched = true;
>  		}
>  	}
>  
> 
Seems OK to me.

Acked-by: Colin Ian King <colin.king@canonical.com>
Kleber Sacilotto de Souza Dec. 15, 2020, 10:44 a.m. UTC | #2
On 14.12.20 08:40, Juerg Haefliger wrote:
> BugLink: https://bugs.launchpad.net/bugs/1907432
> 
> This reverts commit 186734a27698abec8f1dec2adb819ceccebf2ffc to fix
> a shutdown issue on the Pi 400.
> 
> See: https://github.com/raspberrypi/linux/issues/3941
> 
> Signed-off-by: Juerg Haefliger <juergh@canonical.com>

Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>

> ---
>   drivers/mailbox/mailbox.c | 12 +++++-------
>   1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
> index 3e7d4b20ab34..0b821a5b2db8 100644
> --- a/drivers/mailbox/mailbox.c
> +++ b/drivers/mailbox/mailbox.c
> @@ -82,12 +82,9 @@ static void msg_submit(struct mbox_chan *chan)
>   exit:
>   	spin_unlock_irqrestore(&chan->lock, flags);
>   
> -	/* kick start the timer immediately to avoid delays */
> -	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);
> -	}
> +	if (!err && (chan->txdone_method & TXDONE_BY_POLL))
> +		/* kick start the timer immediately to avoid delays */
> +		hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL);
>   }
>   
>   static void tx_tick(struct mbox_chan *chan, int r)
> @@ -125,10 +122,11 @@ static enum hrtimer_restart txdone_hrtimer(struct hrtimer *hrtimer)
>   		struct mbox_chan *chan = &mbox->chans[i];
>   
>   		if (chan->active_req && chan->cl) {
> -			resched = true;
>   			txdone = chan->mbox->ops->last_tx_done(chan);
>   			if (txdone)
>   				tx_tick(chan, 0);
> +			else
> +				resched = true;
>   		}
>   	}
>   
>
Ian May Dec. 18, 2020, 9:08 p.m. UTC | #3
Applied to groovy/linux-raspi

Thanks,
Ian

On 2020-12-14 08:40:24 , Juerg Haefliger wrote:
> BugLink: https://bugs.launchpad.net/bugs/1907432
> 
> This reverts commit 186734a27698abec8f1dec2adb819ceccebf2ffc to fix
> a shutdown issue on the Pi 400.
> 
> See: https://github.com/raspberrypi/linux/issues/3941
> 
> Signed-off-by: Juerg Haefliger <juergh@canonical.com>
> ---
>  drivers/mailbox/mailbox.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
> index 3e7d4b20ab34..0b821a5b2db8 100644
> --- a/drivers/mailbox/mailbox.c
> +++ b/drivers/mailbox/mailbox.c
> @@ -82,12 +82,9 @@ static void msg_submit(struct mbox_chan *chan)
>  exit:
>  	spin_unlock_irqrestore(&chan->lock, flags);
>  
> -	/* kick start the timer immediately to avoid delays */
> -	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);
> -	}
> +	if (!err && (chan->txdone_method & TXDONE_BY_POLL))
> +		/* kick start the timer immediately to avoid delays */
> +		hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL);
>  }
>  
>  static void tx_tick(struct mbox_chan *chan, int r)
> @@ -125,10 +122,11 @@ static enum hrtimer_restart txdone_hrtimer(struct hrtimer *hrtimer)
>  		struct mbox_chan *chan = &mbox->chans[i];
>  
>  		if (chan->active_req && chan->cl) {
> -			resched = true;
>  			txdone = chan->mbox->ops->last_tx_done(chan);
>  			if (txdone)
>  				tx_tick(chan, 0);
> +			else
> +				resched = true;
>  		}
>  	}
>  
> -- 
> 2.25.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
diff mbox series

Patch

diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index 3e7d4b20ab34..0b821a5b2db8 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -82,12 +82,9 @@  static void msg_submit(struct mbox_chan *chan)
 exit:
 	spin_unlock_irqrestore(&chan->lock, flags);
 
-	/* kick start the timer immediately to avoid delays */
-	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);
-	}
+	if (!err && (chan->txdone_method & TXDONE_BY_POLL))
+		/* kick start the timer immediately to avoid delays */
+		hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL);
 }
 
 static void tx_tick(struct mbox_chan *chan, int r)
@@ -125,10 +122,11 @@  static enum hrtimer_restart txdone_hrtimer(struct hrtimer *hrtimer)
 		struct mbox_chan *chan = &mbox->chans[i];
 
 		if (chan->active_req && chan->cl) {
-			resched = true;
 			txdone = chan->mbox->ops->last_tx_done(chan);
 			if (txdone)
 				tx_tick(chan, 0);
+			else
+				resched = true;
 		}
 	}