lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200803051314.39561.david-b@pacbell.net>
Date:	Wed, 5 Mar 2008 13:14:38 -0800
From:	David Brownell <david-b@...bell.net>
To:	Thomas Gleixner <tglx@...utronix.de>
Cc:	Remy Bohmer <linux@...mer.net>,
	Haavard Skinnemoen <hskinnemoen@...el.com>,
	akpm@...ux-foundation.org, LKML <linux-kernel@...r.kernel.org>,
	Nicolas Ferre <nicolas.ferre@....atmel.com>,
	Andrew Victor <linux@...im.org.za>,
	john stultz <johnstul@...ibm.com>
Subject: Re: [PATCH] atmel_tc clocksource/clockevent code

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)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ