Skip to contentSkip to conversation

timer updates for 3.5

GIT PULL Thomas Gleixner 1 participant 1 message Jun 4, 2012

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

Linus,

please pull the latest timers-urgent-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-urgent-for-linus

sorry for sending this late. I ran off in a hurry last thursday to help organizing my sisters wedding and totally forgot about the few bits pending in my trees.

The clocksource driver is pure hardware enablement and the skew option is default off, well tested and non dangerous.

Thanks,

tglx

------------------>
Magnus Damm (3):
clockevents: Make clockevents_config() a global symbol
clocksource: em_sti: Emma Mobile STI driver
clocksource: em_sti: Add DT support

Mike Galbraith (1):
tick: Add tick skew boot option

Thomas Gleixner (1):
tick: Move skew_tick option into the HIGH_RES_TIMER section

 Documentation/kernel-parameters.txt |    9 +
 arch/arm/mach-shmobile/Kconfig      |    6 +
 drivers/clocksource/Makefile        |    1 +
 drivers/clocksource/em_sti.c        |  406 +++++++++++++++++++++++++++++++++++
 include/linux/clockchips.h          |    1 +
 kernel/time/clockevents.c           |    3 +-
 kernel/time/tick-sched.c            |   18 ++
 7 files changed, 442 insertions(+), 2 deletions(-)
 create mode 100644 drivers/clocksource/em_sti.c
Documentation/kernel-parameters.txt +9 -0
index b69cfdc12..ea38cd1 100644
@@ -2532,6 +2532,15 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 
 	sched_debug	[KNL] Enables verbose scheduler debug messages.
 
+	skew_tick=	[KNL] Offset the periodic timer tick per cpu to mitigate
+			xtime_lock contention on larger systems, and/or RCU lock
+			contention on all systems with CONFIG_MAXSMP set.
+			Format: { "0" | "1" }
+			0 -- disable. (may be 1 via CONFIG_CMDLINE="skew_tick=1"
+			1 -- enable.
+			Note: increases power consumption, thus should only be
+			enabled if running jitter sensitive (HPC/RT) workloads.
+
 	security=	[SECURITY] Choose a security module to enable at boot.
 			If this boot parameter is not specified, only the first
 			security module asking for security registration will be
arch/arm/mach-shmobile/Kconfig +6 -0
index f31383c..df33909 100644
@@ -186,6 +186,12 @@ config SH_TIMER_TMU
 	help
 	  This enables build of the TMU timer driver.
 
+config EM_TIMER_STI
+	bool "STI timer driver"
+	default y
+	help
+	  This enables build of the STI timer driver.
+
 endmenu
 
 config SH_CLK_CPG
drivers/clocksource/Makefile +1 -0
index 8d81a1d..dd3e661 100644
@@ -6,6 +6,7 @@ obj-$(CONFIG_CS5535_CLOCK_EVENT_SRC)	+= cs5535-clockevt.o
 obj-$(CONFIG_SH_TIMER_CMT)	+= sh_cmt.o
 obj-$(CONFIG_SH_TIMER_MTU2)	+= sh_mtu2.o
 obj-$(CONFIG_SH_TIMER_TMU)	+= sh_tmu.o
+obj-$(CONFIG_EM_TIMER_STI)	+= em_sti.o
 obj-$(CONFIG_CLKBLD_I8253)	+= i8253.o
 obj-$(CONFIG_CLKSRC_MMIO)	+= mmio.o
 obj-$(CONFIG_DW_APB_TIMER)	+= dw_apb_timer.o
drivers/clocksource/em_sti.c new file +406 -0

406 lines not on this page · raw message

include/linux/clockchips.h +1 -0
index 81e803e..acba8943 100644
@@ -132,6 +132,7 @@ extern u64 clockevent_delta2ns(unsigned long latch,
 			       struct clock_event_device *evt);
 extern void clockevents_register_device(struct clock_event_device *dev);
 
+extern void clockevents_config(struct clock_event_device *dev, u32 freq);
 extern void clockevents_config_and_register(struct clock_event_device *dev,
 					    u32 freq, unsigned long min_delta,
 					    unsigned long max_delta);
kernel/time/clockevents.c +1 -2
index 9cd928f..7e1ce01 100644
@@ -297,8 +297,7 @@ void clockevents_register_device(struct clock_event_device *dev)
 }
 EXPORT_SYMBOL_GPL(clockevents_register_device);
 
-static void clockevents_config(struct clock_event_device *dev,
-			       u32 freq)
+void clockevents_config(struct clock_event_device *dev, u32 freq)
 {
 	u64 sec;
 
kernel/time/tick-sched.c +18 -0
index 6a3a5b9..efd3866 100644
@@ -814,6 +814,16 @@ static enum hrtimer_restart tick_sched_timer(struct hrtimer *timer)
 	return HRTIMER_RESTART;
 }
 
+static int sched_skew_tick;
+
+static int __init skew_tick(char *str)
+{
+	get_option(&str, &sched_skew_tick);
+
+	return 0;
+}
+early_param("skew_tick", skew_tick);
+
 /**
  * tick_setup_sched_timer - setup the tick emulation timer
  */
@@ -831,6 +841,14 @@ void tick_setup_sched_timer(void)
 	/* Get the next period (per cpu) */
 	hrtimer_set_expires(&ts->sched_timer, tick_init_jiffy_update());
 
+	/* Offset the tick to avert xtime_lock contention. */
+	if (sched_skew_tick) {
+		u64 offset = ktime_to_ns(tick_period) >> 1;
+		do_div(offset, num_possible_cpus());
+		offset *= smp_processor_id();
+		hrtimer_add_expires_ns(&ts->sched_timer, offset);
+	}
+
 	for (;;) {
 		hrtimer_forward(&ts->sched_timer, now, tick_period);
 		hrtimer_start_expires(&ts->sched_timer,