From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-rt-users@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Steven Rostedt <rostedt@goodmis.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
stable-rt@vger.kernel.org
Subject: [PATCH RT 2/3] posix-timers: user proper timer while waiting for alarmtimer
Date: Wed, 28 Mar 2018 12:07:45 +0200 [thread overview]
Message-ID: <20180328100746.18668-2-bigeasy@linutronix.de> (raw)
In-Reply-To: <20180328100746.18668-1-bigeasy@linutronix.de>
On RT the timer can be preempted while running and therefore we wait
with timer_wait_for_callback() for the timer to complete (instead of
busy looping).
The POSIX timer has an hrtimer underneath and this hrtimer is used to
wait for its completion. The alartimer has also an hrtimer but at a
different location.
Instead of checking for ->timer_set which is the same for the alarmtimer
and the "posix-timers" I instead check for ->arm which is only used by
the "posix-timers". To match the alarmtimer I check for the alarm_clock
struct.
Cc: stable-rt@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/time/posix-timers.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index 0b568087bd64..8a16cb8f684a 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -802,8 +802,10 @@ SYSCALL_DEFINE1(timer_getoverrun, timer_t, timer_id)
static void timer_wait_for_callback(const struct k_clock *kc, struct k_itimer *timr)
{
#ifdef CONFIG_PREEMPT_RT_FULL
- if (kc->timer_set == common_timer_set)
+ if (kc->arm == common_hrtimer_arm)
hrtimer_wait_for_timer(&timr->it.real.timer);
+ else if (kc == alarm_clock)
+ hrtimer_wait_for_timer(&timr->it.alarm.alarmtimer.timer);
else
/* FIXME: Whacky hack for posix-cpu-timers */
schedule_timeout(1);
--
2.16.3
next prev parent reply other threads:[~2018-03-28 10:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-28 10:07 [PATCH RT 1/3] alarmtimer: Prevent live lock in alarm_cancel() Sebastian Andrzej Siewior
2018-03-28 10:07 ` Sebastian Andrzej Siewior [this message]
2018-03-28 10:28 ` [PATCH RT 2/3 v2] posix-timers: user proper timer while waiting for alarmtimer Sebastian Andrzej Siewior
2018-03-28 10:07 ` [PATCH RT 3/3] posix-timers: move the rcu head out of the union Sebastian Andrzej Siewior
2018-03-28 10:29 ` [PATCH RT 3/3 v2] " Sebastian Andrzej Siewior
2018-04-03 18:32 ` [PATCH RT 1/3] alarmtimer: Prevent live lock in alarm_cancel() Daniel Wagner
2018-04-04 7:37 ` 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=20180328100746.18668-2-bigeasy@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=stable-rt@vger.kernel.org \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).