public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Alexander Gerasiov <gq@cs.msu.su>
Cc: linux-rt-users@vger.kernel.org, zlobin_d@redlab-i.ru
Subject: Re: Problem with hrtimer_cancel() does not cancel timer
Date: Wed, 1 Mar 2017 16:01:04 +0100	[thread overview]
Message-ID: <20170301150103.4ttnvz72d4jsgui6@linutronix.de> (raw)
In-Reply-To: <20170218011522.09d42119@brick.gerasiov.net>

On 2017-02-18 01:15:22 [+0300], Alexander Gerasiov wrote:
> Hello folks,
Hi,

> I met some problem with preempt version of kernel 4.4.
> 
> I have hrtimer which runs callback, it forwards time and returns
> HRTIMER_RESTART. Very common scheme. When I stop the routine I call
> hrtimer_cancel(). It should wait for callback completion if any and
> unqueue any future timers.

Could you please check if the hunk here fixes the problem you see?

diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -455,7 +455,10 @@ static inline int hrtimer_is_queued(struct hrtimer *timer)
  */
 static inline int hrtimer_callback_running(const struct hrtimer *timer)
 {
-	return timer->base->cpu_base->running == timer;
+	if ((timer->base->cpu_base->running == timer) ||
+	    (timer->base->cpu_base->running_soft == timer))
+		return 1;
+	return 0;
 }
 
 /* Forward a hrtimer so it expires after now: */

Sebastian

  parent reply	other threads:[~2017-03-01 15:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-17 22:15 Problem with hrtimer_cancel() does not cancel timer Alexander Gerasiov
2017-02-21 14:15 ` Dmitry
2017-02-28 13:02 ` Alexander Gerasiov
2017-03-01 15:01 ` Sebastian Andrzej Siewior [this message]
2017-03-01 23:48   ` Alexander Gerasiov
2017-03-02  8:19     ` Sebastian Andrzej Siewior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170301150103.4ttnvz72d4jsgui6@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=gq@cs.msu.su \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=zlobin_d@redlab-i.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox