Commit 24aea4cc authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Frederic Weisbecker

posix-cpu-timers: Make k_itimer::it_active consistent

Posix CPU timers are not updating k_itimer::it_active which makes it
impossible to base decisions in the common posix timer code on it.

Update it when queueing or dequeueing posix CPU timers.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarFrederic Weisbecker <frederic@kernel.org>
Reviewed-by: default avatarAnna-Maria Behnsen <anna-maria@linutronix.de>
Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
parent 20f13385
...@@ -453,6 +453,7 @@ static void disarm_timer(struct k_itimer *timer, struct task_struct *p) ...@@ -453,6 +453,7 @@ static void disarm_timer(struct k_itimer *timer, struct task_struct *p)
struct cpu_timer *ctmr = &timer->it.cpu; struct cpu_timer *ctmr = &timer->it.cpu;
struct posix_cputimer_base *base; struct posix_cputimer_base *base;
timer->it_active = 0;
if (!cpu_timer_dequeue(ctmr)) if (!cpu_timer_dequeue(ctmr))
return; return;
...@@ -559,6 +560,7 @@ static void arm_timer(struct k_itimer *timer, struct task_struct *p) ...@@ -559,6 +560,7 @@ static void arm_timer(struct k_itimer *timer, struct task_struct *p)
struct cpu_timer *ctmr = &timer->it.cpu; struct cpu_timer *ctmr = &timer->it.cpu;
u64 newexp = cpu_timer_getexpires(ctmr); u64 newexp = cpu_timer_getexpires(ctmr);
timer->it_active = 1;
if (!cpu_timer_enqueue(&base->tqhead, ctmr)) if (!cpu_timer_enqueue(&base->tqhead, ctmr))
return; return;
...@@ -584,6 +586,7 @@ static void cpu_timer_fire(struct k_itimer *timer) ...@@ -584,6 +586,7 @@ static void cpu_timer_fire(struct k_itimer *timer)
{ {
struct cpu_timer *ctmr = &timer->it.cpu; struct cpu_timer *ctmr = &timer->it.cpu;
timer->it_active = 0;
if (unlikely(timer->sigq == NULL)) { if (unlikely(timer->sigq == NULL)) {
/* /*
* This a special case for clock_nanosleep, * This a special case for clock_nanosleep,
...@@ -668,6 +671,7 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags, ...@@ -668,6 +671,7 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags,
ret = TIMER_RETRY; ret = TIMER_RETRY;
} else { } else {
cpu_timer_dequeue(ctmr); cpu_timer_dequeue(ctmr);
timer->it_active = 0;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment