From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>,
Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>,
"Luiz Fernando N. Capitulino" <lcapitulino@mandriva.com.br>,
Dmitry Nezhevenko <dion@inhex.net>
Subject: [patch 2/6] clockevents: prevent endless loop in periodic broadcast handler
Date: Wed, 03 Sep 2008 21:36:57 -0000 [thread overview]
Message-ID: <20080903212753.179385364@linutronix.de> (raw)
In-Reply-To: <20080903212735.713411776@linutronix.de>
[-- Attachment #1: clockevents-fix-broadcast-mode.patch --]
[-- Type: text/plain, Size: 1526 bytes --]
The reprogramming of the periodic broadcast handler was broken,
when the first programming returned -ETIME. The clockevents code
stores the new expiry value in the clock events device next_event field
only when the programming time has not been elapsed yet. The loop in
question calculates the new expiry value from the next_event value
and therefor never increases.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
kernel/time/tick-broadcast.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
Index: linux-2.6/kernel/time/tick-broadcast.c
===================================================================
--- linux-2.6.orig/kernel/time/tick-broadcast.c
+++ linux-2.6/kernel/time/tick-broadcast.c
@@ -175,6 +175,8 @@ static void tick_do_periodic_broadcast(v
*/
static void tick_handle_periodic_broadcast(struct clock_event_device *dev)
{
+ ktime_t next;
+
tick_do_periodic_broadcast();
/*
@@ -185,10 +187,13 @@ static void tick_handle_periodic_broadca
/*
* Setup the next period for devices, which do not have
- * periodic mode:
+ * periodic mode. We read dev->next_event first and add to it
+ * when the event alrady expired. clockevents_program_event()
+ * sets dev->next_event only when the event is really
+ * programmed to the device.
*/
- for (;;) {
- ktime_t next = ktime_add(dev->next_event, tick_period);
+ for (next = dev->next_event; ;) {
+ next = ktime_add(next, tick_period);
if (!clockevents_program_event(dev, next, ktime_get()))
return;
--
next prev parent reply other threads:[~2008-09-03 21:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-03 21:36 [patch 0/6] final clockevents/hpet fixes Thomas Gleixner
2008-09-03 21:36 ` [patch 1/6] clockevents: Prevent clockevent event_handler ending up handler_noop Thomas Gleixner
2008-09-03 21:36 ` Thomas Gleixner [this message]
2008-09-03 21:37 ` [patch 3/6] clockevents: enforce reprogram in oneshot setup Thomas Gleixner
2008-09-03 21:37 ` [patch 4/6] clockevents: prevent multiple init/shutdown Thomas Gleixner
2008-09-03 21:37 ` [patch 5/6] clockevents: prevent endless loop lockup Thomas Gleixner
2008-09-03 21:37 ` [patch 6/6] HPET: make minimum reprogramming delta useful Thomas Gleixner
2008-09-03 23:00 ` [patch 0/6] final clockevents/hpet fixes Dmitry Nezhevenko
2008-09-03 23:04 ` Thomas Gleixner
2008-09-03 23:27 ` Dmitry Nezhevenko
2008-09-04 18:33 ` Luiz Fernando N. Capitulino
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=20080903212753.179385364@linutronix.de \
--to=tglx@linutronix.de \
--cc=dion@inhex.net \
--cc=lcapitulino@mandriva.com.br \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=venkatesh.pallipadi@intel.com \
/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
all inboxes | Powered by JetHome®