mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Remy Bohmer <linux@bohmer.net>,
	Haavard Skinnemoen <hskinnemoen@atmel.com>,
	akpm@linux-foundation.org, LKML <linux-kernel@vger.kernel.org>,
	Nicolas Ferre <nicolas.ferre@rfo.atmel.com>,
	Andrew Victor <linux@maxim.org.za>,
	john stultz <johnstul@us.ibm.com>
Subject: Re: [PATCH] atmel_tc clocksource/clockevent code
Date: Wed, 5 Mar 2008 13:14:38 -0800	[thread overview]
Message-ID: <200803051314.39561.david-b@pacbell.net> (raw)
In-Reply-To: <alpine.LFD.1.00.0803051742190.3099@apollo.tec.linutronix.de>

On Wednesday 05 March 2008, Thomas Gleixner wrote:
> > So, hires timestamps -> really really welcome.
> > hires timers -> there should be a (configurable) minimal resolution
> > that fits the hardware to not overload the CPU.
> 
> clockevents let you set a minimum delta already. This can be set at
> runtime before registering the device.

But the overhead isn't specific to any given clockevent
device.  The same issue was reported on other ARMs.

The acceptable overhead is a function of system-specific
factors including load and CPU clock rate, not of a given
clockevent device.

I wouldn't think teaching multiple such drivers about such
issues could be better than having clockevents_program_event()
consider a system-specific lower bound ...

- Dave



==============
Add a "min_delta_ns" kernel parameter to help systems avoid excess
scheduling and timer overheads.  As with init_timer_deferrable(),
this batches timer IRQs to reduce those overheads.

For example, on one ARM9 platform the timer IRQ takes 2 usec, but the
system then needs over 150 usec to handle scheduler-related tasks.
On such a system, applications using many high resolution timers can
work better if min_delta_ns is used to avoid scheduling timer IRQs
so often that no other work gets done.

---
 Documentation/kernel-parameters.txt |    7 +++++++
 kernel/time/clockevents.c           |   15 +++++++++++++++
 2 files changed, 22 insertions(+)

--- a/Documentation/kernel-parameters.txt	2008-02-23 11:36:13.000000000 -0800
+++ b/Documentation/kernel-parameters.txt	2008-03-05 12:58:20.000000000 -0800
@@ -1146,6 +1146,13 @@ and is between 256 and 4096 characters. 
 
 	mga=		[HW,DRM]
 
+	min_delta_ns=n	[GENERIC_TIME] Defines the minimum amount of time
+			that oneshot clockevent sources will be asked to
+			sleep.  This is measured in nanoseconds, and may be
+			overridden by the clockevent device.  You probably
+			want this number to be more than your system's timer
+			IRQ overhead.
+
 	mousedev.tap_time=
 			[MOUSE] Maximum time between finger touching and
 			leaving touchpad surface for touch to be considered
--- a/kernel/time/clockevents.c	2008-02-10 15:48:29.000000000 -0800
+++ b/kernel/time/clockevents.c	2008-03-05 12:38:14.000000000 -0800
@@ -29,6 +29,18 @@ static RAW_NOTIFIER_HEAD(clockevents_cha
 /* Protection for the above */
 static DEFINE_SPINLOCK(clockevents_lock);
 
+/* This is the lower bound on oneshot timer intervals; setting its
+ * value too low can maintain HRT overhead at objectionable levels.
+ */
+static unsigned long min_delta_ns;
+
+static int __init set_min_delta_ns(char *str)
+{
+	simple_strtoul(str, NULL, 0);
+	return 1;
+}
+__setup("min_delta_ns", set_min_delta_ns);
+
 /**
  * clockevents_delta2ns - Convert a latch value (device ticks) to nanoseconds
  * @latch:	value to convert
@@ -98,6 +110,9 @@ int clockevents_program_event(struct clo
 	if (dev->mode == CLOCK_EVT_MODE_SHUTDOWN)
 		return 0;
 
+	if (delta < min_delta_ns)
+		delta = min_delta_ns;
+
 	if (delta > dev->max_delta_ns)
 		delta = dev->max_delta_ns;
 	if (delta < dev->min_delta_ns)

  reply	other threads:[~2008-03-05 21:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-04 13:07 [PATCH] atmel_tc library Haavard Skinnemoen
2008-03-04 13:07 ` [PATCH] atmel_tc clocksource/clockevent code Haavard Skinnemoen
2008-03-04 19:42   ` Remy Bohmer
2008-03-04 20:47     ` David Brownell
2008-03-05 11:17       ` Remy Bohmer
2008-03-05 13:06         ` David Brownell
2008-03-05 16:45         ` Thomas Gleixner
2008-03-05 21:14           ` David Brownell [this message]
2008-03-05 22:35           ` Remy Bohmer
2008-03-05 22:52             ` 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=200803051314.39561.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=akpm@linux-foundation.org \
    --cc=hskinnemoen@atmel.com \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@bohmer.net \
    --cc=linux@maxim.org.za \
    --cc=nicolas.ferre@rfo.atmel.com \
    --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

all inboxes | Powered by JetHome®