From: Andrew Morton <akpm@osdl.org>
To: Christoph Lameter <clameter@sgi.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Fixes to mmtimer driver
Date: Mon, 14 Mar 2005 21:36:43 -0800 [thread overview]
Message-ID: <20050314213643.77d9a0fe.akpm@osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.58.0503142105480.16582@schroedinger.engr.sgi.com>
Christoph Lameter <clameter@sgi.com> wrote:
>
> Fix the issue that the timer sometimes will not fire if the scheduled
> time has already expired. Plus some simplifications and style changes.
Tosses a reject due to the itimer patches which went in last week.
***************
*** 430,436 ****
if (n > 20)
return 1;
- } while (mmtimer_setup(x->i, t->it_timer.expires));
return 0;
}
--- 418,424 ----
if (n > 20)
return 1;
+ } while (!mmtimer_setup(x->i, t->it_timer.expires));
return 0;
}
Which I fixed up as below.
Please, we've pushed in 14MB of patches in 11 days - it's really important
to make sure that we're working against the latest tree.
--- 25/drivers/char/mmtimer.c~fixes-to-mmtimer-driver 2005-03-14 21:33:04.000000000 -0800
+++ 25-akpm/drivers/char/mmtimer.c 2005-03-14 21:33:45.000000000 -0800
@@ -71,11 +71,6 @@ static struct file_operations mmtimer_fo
};
/*
- * Comparators and their associated info. Shub has
- * three comparison registers.
- */
-
-/*
* We only have comparison registers RTC1-4 currently available per
* node. RTC0 is used by SAL.
*/
@@ -174,14 +169,10 @@ static void inline mmtimer_setup_int_2(u
* This function must be called with interrupts disabled and preemption off
* in order to insure that the setup succeeds in a deterministic time frame.
* It will check if the interrupt setup succeeded.
- * mmtimer_setup will return the cycles that we were too late if the
- * initialization failed.
*/
static int inline mmtimer_setup(int comparator, unsigned long expires)
{
- long diff;
-
switch (comparator) {
case 0:
mmtimer_setup_int_0(expires);
@@ -194,17 +185,14 @@ static int inline mmtimer_setup(int comp
break;
}
/* We might've missed our expiration time */
- diff = rtc_time() - expires;
- if (diff > 0) {
- if (mmtimer_int_pending(comparator)) {
- /* We'll get an interrupt for this once we're done */
- return 0;
- }
- /* Looks like we missed it */
- return diff;
- }
+ if (rtc_time() < expires)
+ return 1;
- return 0;
+ /*
+ * If an interrupt is already pending then its okay
+ * if not then we failed
+ */
+ return mmtimer_int_pending(comparator);
}
static int inline mmtimer_disable_int(long nasid, int comparator)
@@ -430,7 +418,7 @@ static int inline reschedule_periodic_ti
if (n > 20)
return 1;
- } while (mmtimer_setup(x->i, t->it.mmtimer.expires));
+ } while (!mmtimer_setup(x->i, t->it.mmtimer.expires));
return 0;
}
@@ -594,9 +582,15 @@ static int sgi_timer_set(struct k_itimer
if (flags & TIMER_ABSTIME) {
struct timespec n;
+ unsigned long now;
getnstimeofday(&n);
- when -= timespec_to_ns(n);
+ now = timespec_to_ns(n);
+ if (when > now)
+ when -= now;
+ else
+ /* Fire the timer immediately */
+ when = 0;
}
/*
@@ -644,7 +638,7 @@ retry:
timr->it.mmtimer.expires = when;
if (period == 0) {
- if (mmtimer_setup(i, when)) {
+ if (!mmtimer_setup(i, when)) {
mmtimer_disable_int(-1, i);
posix_timer_event(timr, 0);
timr->it.mmtimer.expires = 0;
_
next prev parent reply other threads:[~2005-03-15 5:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-15 5:07 Christoph Lameter
2005-03-15 5:36 ` Andrew Morton [this message]
2005-03-15 5:42 ` Christoph Lameter
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=20050314213643.77d9a0fe.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=clameter@sgi.com \
--cc=linux-kernel@vger.kernel.org \
/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®