[Skiboot] [PATCH 2/2] timer: Reschedule timer if OPAL receives early timer interrupt

Benjamin Herrenschmidt benh at kernel.crashing.org
Fri May 4 07:03:20 AEST 2018


On Thu, 2018-05-03 at 18:51 +0530, Vasant Hegde wrote:
> If we receive timer interrupt before timer expiry, we are not rescheduling
> timer again. Lets fix this by rescheduling timer.

Doesn't that mean we'll reschedule every time we call check timer in a
loop ? I'd be keen on only doing that from an actual timer interrupt
and only if we haven't already rescheduled (we could cache the
scheduled time, and clear it on interrupt entry, so we reschedule at
most once per interrupt).

> Suggested-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
> Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
> ---
>  core/timer.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/core/timer.c b/core/timer.c
> index 1c5395178..5890b203c 100644
> --- a/core/timer.c
> +++ b/core/timer.c
> @@ -203,10 +203,15 @@ static void __check_timers(uint64_t now)
>  	for (;;) {
>  		t = list_top(&timer_list, struct timer, link);
>  
> -		/* Top of list not expired ? that's it ... */
> -		if (!t || t->target > now)
> +		if (!t)
>  			break;
>  
> +		/* Top of list not expired ? re-schedule timer */
> +		if (t->target > now) {
> +			update_timer_expiry(t->target);
> +			break;
> +		}
> +
>  		/* Top of list still running, we have to delay handling
>  		 * it. For now just skip until the next poll, when we have
>  		 * SLW interrupts, we'll probably want to trip another one


More information about the Skiboot mailing list