From 83a88d46b7d97e86bb038c981bc9a48f2097edfe Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Thu, 9 Nov 2017 15:34:41 +0100 Subject: [PATCH] dde_linux: remove timer optimization Instead of storing whether the first item in the timeout list was already programmed using the timer service, just program the first timeout in the list unconditionally. In the past we lost a timeout at least when using the usb ethernet driver on hw/arndale sporadically. --- repos/dde_linux/src/lib/lxip/timer_handler.cc | 19 ++----------------- repos/dde_linux/src/lx_kit/timer.cc | 19 ++----------------- 2 files changed, 4 insertions(+), 34 deletions(-) diff --git a/repos/dde_linux/src/lib/lxip/timer_handler.cc b/repos/dde_linux/src/lib/lxip/timer_handler.cc index 9b19af79f7..fc7b21c4f6 100644 --- a/repos/dde_linux/src/lib/lxip/timer_handler.cc +++ b/repos/dde_linux/src/lib/lxip/timer_handler.cc @@ -57,7 +57,6 @@ class Lx::Timer void *timer; bool pending { false }; unsigned long timeout { INVALID_TIMEOUT }; /* absolute in jiffies */ - bool programmed { false }; Context(struct timer_list *timer) : type(LIST), timer(timer) { } @@ -111,11 +110,6 @@ class Lx::Timer /** * Program the first timer in the list - * - * The first timer is programmed if the 'programmed' flag was not set - * before. The second timer is flagged as not programmed as - * 'Timer::trigger_once' invalidates former registered one-shot - * timeouts. */ void _program_first_timer() { @@ -123,19 +117,10 @@ class Lx::Timer if (!ctx) return; - if (ctx->programmed) - return; - /* calculate relative microseconds for trigger */ unsigned long us = ctx->timeout > jiffies ? jiffies_to_msecs(ctx->timeout - jiffies) * 1000 : 0; _timer_conn.trigger_once(us); - - ctx->programmed = true; - - /* possibly programmed successor must be reprogrammed later */ - if (Context *next = ctx->next()) - next->programmed = false; } /** @@ -150,10 +135,10 @@ class Lx::Timer ctx->timeout = expires; ctx->pending = true; - ctx->programmed = false; + /* * Also write the timeout value to the expires field in - * struct timer_list because the checks + * struct timer_list because some code the checks * it directly. */ ctx->expires(expires); diff --git a/repos/dde_linux/src/lx_kit/timer.cc b/repos/dde_linux/src/lx_kit/timer.cc index dd94ab49dc..503fb54971 100644 --- a/repos/dde_linux/src/lx_kit/timer.cc +++ b/repos/dde_linux/src/lx_kit/timer.cc @@ -44,7 +44,6 @@ class Lx_kit::Timer : public Lx::Timer void *timer; bool pending { false }; unsigned long timeout { INVALID_TIMEOUT }; /* absolute in jiffies */ - bool programmed { false }; Context(struct timer_list *timer) : type(LIST), timer(timer) { } Context(struct hrtimer *timer) : type(HR), timer(timer) { } @@ -101,11 +100,6 @@ class Lx_kit::Timer : public Lx::Timer /** * Program the first timer in the list - * - * The first timer is programmed if the 'programmed' flag was not set - * before. The second timer is flagged as not programmed as - * 'Timer::trigger_once' invalidates former registered one-shot - * timeouts. */ void _program_first_timer() { @@ -113,19 +107,10 @@ class Lx_kit::Timer : public Lx::Timer if (!ctx) return; - if (ctx->programmed) - return; - /* calculate relative microseconds for trigger */ unsigned long us = ctx->timeout > _jiffies ? jiffies_to_msecs(ctx->timeout - _jiffies) * 1000 : 0; _timer_conn.trigger_once(us); - - ctx->programmed = true; - - /* possibly programmed successor must be reprogrammed later */ - if (Context *next = ctx->next()) - next->programmed = false; } /** @@ -140,10 +125,10 @@ class Lx_kit::Timer : public Lx::Timer ctx->timeout = expires; ctx->pending = true; - ctx->programmed = false; + /* * Also write the timeout value to the expires field in - * struct timer_list because the wireless stack checks + * struct timer_list because some code the checks * it directly. */ ctx->expires(expires);