public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Andrew Morton <akpm@osdl.org>
Cc: Roman Zippel <zippel@linux-m68k.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org
Subject: [patch] hrtimer: round up relative start time on low-res arches
Date: Tue, 14 Feb 2006 13:20:31 +0100	[thread overview]
Message-ID: <20060214122031.GA30983@elte.hu> (raw)
In-Reply-To: <Pine.LNX.4.61.0602141113060.30994@scrub.home>

find below a patch with less impact than blanket upwards rounding of 
relatime timeouts. This i think is better for v2.6.16 - it accurately 
documents the problem architectures that have low-res do_gettimeofday(), 
and doesnt impact other architectures. This will go away with John's 
GTOD patchset. I've reviewed every architecture for the (worst-case) 
resolution of their do_gettimeofday() implementations, and this is the 
result of that review.

	Ingo

-----

CONFIG_TIME_LOW_RES is a temporary way for architectures to signal that 
they simply return xtime in do_gettimeoffset(). In this corner-case we 
want to round up by resolution when starting a relative timer, to avoid 
short timeouts. This will go away with the GTOD framework.

Signed-off-by: Ingo Molnar <mingo@elte.hu>

----

 arch/frv/Kconfig       |    4 ++++
 arch/h8300/Kconfig     |    4 ++++
 arch/m68k/Kconfig      |    4 ++++
 arch/m68knommu/Kconfig |    4 ++++
 arch/parisc/Kconfig    |    5 +++++
 arch/v850/Kconfig      |    4 ++++
 kernel/hrtimer.c       |   13 ++++++++++++-
 7 files changed, 37 insertions(+), 1 deletion(-)

Index: linux/arch/frv/Kconfig
===================================================================
--- linux.orig/arch/frv/Kconfig
+++ linux/arch/frv/Kconfig
@@ -25,6 +25,10 @@ config GENERIC_HARDIRQS
 	bool
 	default n
 
+config TIME_LOW_RES
+	bool
+	default y
+
 mainmenu "Fujitsu FR-V Kernel Configuration"
 
 source "init/Kconfig"
Index: linux/arch/h8300/Kconfig
===================================================================
--- linux.orig/arch/h8300/Kconfig
+++ linux/arch/h8300/Kconfig
@@ -33,6 +33,10 @@ config GENERIC_CALIBRATE_DELAY
 	bool
 	default y
 
+config TIME_LOW_RES
+	bool
+	default y
+
 config ISA
 	bool
 	default y
Index: linux/arch/m68k/Kconfig
===================================================================
--- linux.orig/arch/m68k/Kconfig
+++ linux/arch/m68k/Kconfig
@@ -21,6 +21,10 @@ config GENERIC_CALIBRATE_DELAY
 	bool
 	default y
 
+config TIME_LOW_RES
+	bool
+	default y
+
 config ARCH_MAY_HAVE_PC_FDC
 	bool
 	depends on Q40 || (BROKEN && SUN3X)
Index: linux/arch/m68knommu/Kconfig
===================================================================
--- linux.orig/arch/m68knommu/Kconfig
+++ linux/arch/m68knommu/Kconfig
@@ -29,6 +29,10 @@ config GENERIC_CALIBRATE_DELAY
 	bool
 	default y
 
+config TIME_LOW_RES
+	bool
+	default y
+
 source "init/Kconfig"
 
 menu "Processor type and features"
Index: linux/arch/parisc/Kconfig
===================================================================
--- linux.orig/arch/parisc/Kconfig
+++ linux/arch/parisc/Kconfig
@@ -29,6 +29,11 @@ config GENERIC_CALIBRATE_DELAY
 	bool
 	default y
 
+config TIME_LOW_RES
+	bool
+	depends on SMP
+	default y
+
 config GENERIC_ISA_DMA
 	bool
 
Index: linux/arch/v850/Kconfig
===================================================================
--- linux.orig/arch/v850/Kconfig
+++ linux/arch/v850/Kconfig
@@ -28,6 +28,10 @@ config GENERIC_IRQ_PROBE
 	bool
 	default y
 
+config TIME_LOW_RES
+	bool
+	default y
+
 # Turn off some random 386 crap that can affect device config
 config ISA
 	bool
Index: linux/kernel/hrtimer.c
===================================================================
--- linux.orig/kernel/hrtimer.c
+++ linux/kernel/hrtimer.c
@@ -418,8 +418,19 @@ hrtimer_start(struct hrtimer *timer, kti
 	/* Switch the timer base, if necessary: */
 	new_base = switch_hrtimer_base(timer, base);
 
-	if (mode == HRTIMER_REL)
+	if (mode == HRTIMER_REL) {
 		tim = ktime_add(tim, new_base->get_time());
+		/*
+		 * CONFIG_TIME_LOW_RES is a temporary way for architectures
+		 * to signal that they simply return xtime in
+		 * do_gettimeoffset(). In this case we want to round up by
+		 * resolution when starting a relative timer, to avoid short
+		 * timeouts. This will go away with the GTOD framework.
+		 */
+#ifdef CONFIG_TIME_LOW_RES
+		tim = ktime_add(tim, base->resolution);
+#endif
+	}
 	timer->expires = tim;
 
 	enqueue_hrtimer(timer, new_base);

  reply	other threads:[~2006-02-14 12:22 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-13  1:09 [PATCH 01/13] hrtimer: round up relative start time Roman Zippel
2006-02-13 10:52 ` Thomas Gleixner
2006-02-13 11:25   ` Roman Zippel
2006-02-13 13:01     ` Ingo Molnar
2006-02-13 13:42       ` Roman Zippel
2006-02-13 14:44         ` Ingo Molnar
2006-02-13 15:49           ` Roman Zippel
2006-02-13 19:55             ` Ingo Molnar
2006-02-13 22:29               ` Roman Zippel
2006-02-14  7:41     ` Ingo Molnar
2006-02-14 10:18       ` Roman Zippel
2006-02-14 12:20         ` Ingo Molnar [this message]
2006-02-14 21:51           ` [patch] hrtimer: round up relative start time on low-res arches Thomas Gleixner
2006-02-15  0:30           ` Roman Zippel
2006-02-15  9:19             ` Ingo Molnar
2006-02-15 12:26               ` Roman Zippel
2006-02-15 20:43                 ` john stultz
2006-02-16 14:10                   ` Roman Zippel
2006-02-16 19:06                     ` john stultz
2006-02-16 23:44                       ` Roman Zippel
2006-02-17  0:28                         ` john stultz
2006-02-17 15:02                           ` Roman Zippel
2006-02-14 10:26       ` [PATCH 01/13] hrtimer: round up relative start time Thomas Gleixner

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=20060214122031.GA30983@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=zippel@linux-m68k.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