From: Dimitri Sivanich <sivanich@sgi.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH 1/4 v2] X86: UV RTC fix early expiry handling
Date: Wed, 14 Oct 2009 09:16:30 -0500 [thread overview]
Message-ID: <20091014141630.GB11048@sgi.com> (raw)
In-Reply-To: <20091014141438.GA11048@sgi.com>
Tune/fix early timer expiry handling and return correct early timeout value
for set_next_event.
Signed-off-by: Dimitri Sivanich <sivanich@sgi.com>
---
arch/x86/kernel/uv_time.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
Index: linux/arch/x86/kernel/uv_time.c
===================================================================
--- linux.orig/arch/x86/kernel/uv_time.c 2009-10-13 08:50:44.000000000 -0500
+++ linux/arch/x86/kernel/uv_time.c 2009-10-13 10:41:44.000000000 -0500
@@ -123,7 +123,10 @@ static int uv_setup_intr(int cpu, u64 ex
/* Initialize comparator value */
uv_write_global_mmr64(pnode, UVH_INT_CMPB, expires);
- return (expires < uv_read_rtc(NULL) && !uv_intr_pending(pnode));
+ if (uv_read_rtc(NULL) <= expires)
+ return 0;
+
+ return !uv_intr_pending(pnode);
}
/*
@@ -223,6 +226,7 @@ static int uv_rtc_set_timer(int cpu, u64
next_cpu = head->next_cpu;
*t = expires;
+
/* Will this one be next to go off? */
if (next_cpu < 0 || bcpu == next_cpu ||
expires < head->cpu[next_cpu].expires) {
@@ -231,7 +235,7 @@ static int uv_rtc_set_timer(int cpu, u64
*t = ULLONG_MAX;
uv_rtc_find_next_timer(head, pnode);
spin_unlock_irqrestore(&head->lock, flags);
- return 1;
+ return -ETIME;
}
}
@@ -244,7 +248,7 @@ static int uv_rtc_set_timer(int cpu, u64
*
* Returns 1 if this timer was pending.
*/
-static int uv_rtc_unset_timer(int cpu)
+static int uv_rtc_unset_timer(int cpu, int force)
{
int pnode = uv_cpu_to_pnode(cpu);
int bid = uv_cpu_to_blade_id(cpu);
@@ -256,14 +260,15 @@ static int uv_rtc_unset_timer(int cpu)
spin_lock_irqsave(&head->lock, flags);
- if (head->next_cpu == bcpu && uv_read_rtc(NULL) >= *t)
+ if ((head->next_cpu == bcpu && uv_read_rtc(NULL) >= *t) || force)
rc = 1;
- *t = ULLONG_MAX;
-
- /* Was the hardware setup for this timer? */
- if (head->next_cpu == bcpu)
- uv_rtc_find_next_timer(head, pnode);
+ if (rc) {
+ *t = ULLONG_MAX;
+ /* Was the hardware setup for this timer? */
+ if (head->next_cpu == bcpu)
+ uv_rtc_find_next_timer(head, pnode);
+ }
spin_unlock_irqrestore(&head->lock, flags);
@@ -310,20 +315,20 @@ static void uv_rtc_timer_setup(enum cloc
break;
case CLOCK_EVT_MODE_UNUSED:
case CLOCK_EVT_MODE_SHUTDOWN:
- uv_rtc_unset_timer(ced_cpu);
+ uv_rtc_unset_timer(ced_cpu, 1);
break;
}
}
static void uv_rtc_interrupt(void)
{
- struct clock_event_device *ced = &__get_cpu_var(cpu_ced);
int cpu = smp_processor_id();
+ struct clock_event_device *ced = &per_cpu(cpu_ced, cpu);
if (!ced || !ced->event_handler)
return;
- if (uv_rtc_unset_timer(cpu) != 1)
+ if (uv_rtc_unset_timer(cpu, 0) != 1)
return;
ced->event_handler(ced);
next prev parent reply other threads:[~2009-10-14 14:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-09 13:47 [PATCH] x86 UV: Fixes for UV rtc timers Dimitri Sivanich
2009-10-12 16:23 ` Ingo Molnar
2009-10-12 17:52 ` Dimitri Sivanich
2009-10-12 17:59 ` Ingo Molnar
2009-10-14 14:14 ` [PATCH 0/4 v2] X86: UV RTC fixes/cleanup Dimitri Sivanich
2009-10-14 14:16 ` Dimitri Sivanich [this message]
2009-10-14 14:18 ` [PATCH 2/4 v2] X86: UV RTC add clocksource only boot option Dimitri Sivanich
2009-10-14 14:21 ` [PATCH 3/4 v2] X86: UV RTC cleanup error handling Dimitri Sivanich
2009-10-14 14:22 ` [PATCH 4/4 v2] X86: UV RTC rename generic_interrupt Dimitri Sivanich
2009-10-14 16:33 ` [tip:x86/uv] x86: UV RTC: Rename generic_interrupt to x86_platform_ipi tip-bot for Dimitri Sivanich
2009-10-14 16:33 ` [tip:x86/uv] x86: UV RTC: Clean up error handling tip-bot for Dimitri Sivanich
2009-10-14 16:33 ` [tip:x86/uv] x86: UV RTC: Add clocksource only boot option tip-bot for Dimitri Sivanich
2009-10-14 16:32 ` [tip:x86/uv] x86: UV RTC: Fix early expiry handling tip-bot for Dimitri Sivanich
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=20091014141630.GB11048@sgi.com \
--to=sivanich@sgi.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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