[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YMnhllR8fatx1MRD@hirez.programming.kicks-ass.net>
Date: Wed, 16 Jun 2021 13:33:42 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Frederic Weisbecker <frederic@...nel.org>
Cc: Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>,
"Eric W . Biederman" <ebiederm@...ssion.com>,
Oleg Nesterov <oleg@...hat.com>, Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH 4/6] posix-cpu-timers: Force next_expiration recalc after
timer reset
On Wed, Jun 16, 2021 at 01:21:11PM +0200, Frederic Weisbecker wrote:
> On Wed, Jun 16, 2021 at 11:23:33AM +0200, Peter Zijlstra wrote:
> > On Fri, Jun 04, 2021 at 01:31:57PM +0200, Frederic Weisbecker wrote:
> >
> > > @@ -647,8 +651,6 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags,
> > > if (unlikely(timer->it.cpu.firing)) {
> > > timer->it.cpu.firing = -1;
> > > ret = TIMER_RETRY;
> > > - } else {
> > > - cpu_timer_dequeue(ctmr);
> > > }
> > >
> > > /*
> > > @@ -713,9 +715,13 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags,
> > > * For a timer with no notification action, we don't actually
> > > * arm the timer (we'll just fake it for timer_gettime).
> > > */
> > > - cpu_timer_setexpires(ctmr, new_expires);
> > > - if (new_expires != 0 && val < new_expires) {
> > > - arm_timer(timer, p);
> > > + if (new_expires != 0) {
> > > + cpu_timer_dequeue(ctmr);
> > > + cpu_timer_setexpires(ctmr, new_expires);
> > > + if (val < new_expires)
> > > + arm_timer(timer, p);
> > > + } else {
> > > + disarm_timer(timer, p);
> > > }
> > >
> > > unlock_task_sighand(p, &flags);
> >
> > AFAICT there's an error path in between where you've removed
> > cpu_timer_dequeue() and added it back. This error path will now leave
> > the timer enqueued.
>
> Ah that's the case where the timer is firing. In this case it can't be queued
> anyway. Also it's a retry path so we'll eventually dequeue it in any case
> (should it be concurrently requeued after firing).
Urgh, I see.. this code is a maze :-(
Powered by blists - more mailing lists