Skip to contentSkip to conversation

Remove jiffies clocksource's dependency on CLOCK_TICK_RATE

PATCH In review John Stultz 1 participant 5 messages Sep 15, 2012

Subsystems (16)
Arm (32-bit) x86 PowerPC MIPS +12 more subsystems
lore
Share & tools
lore
#0 lore raw

cover Remove jiffies clocksource's dependency on CLOCK_TICK_RATE

Just wanted to send this out for initial review and comments.

During Linux Plumbers, Thomas mentioned that Arnd was still wanting to kill off the derived values from the compile time constant CLOCK_TICK_RATE, as it is a problem for unified zImage on ARM.

One issue holding this back is that CLOCK_TICK_RATE allows us to address the granularity error of the underlying timer hardware, allowing for accurate timekeeping with jiffies and jiffies derived clocksources.

Thomas proposed allowing the jiffies correction to be done dynamically at runtime, and this is my first attempt at such an approach.

* The first patch is a simple cleanup of an unused define.
* The second patch adds the hook to add a refined jiffies clocksource, and kills the values derived at compile time from CLOCK_TICK_RATE.
* The third is a patch that adds the refined jiffies registration to all arches.

Clearly, since in most cases platforms aren't using jiffies as a clocksource (except for just briefly in early boot), its quality doesn't matter that much. So I'd rather not actually submit the third patch, which adds unnecessary code in most cases, and instead allow architectures to add their portion as they see fit/regressions.

I've only done some initial testing, and haven't tested with all HZ values yet, so there may still be issues, but its looking reasonably good so far.

Anyway, I'd appreciate any feedback on this approach, or suggestions for other ways to allow for dynamic adjustments at runtime.

thanks
-john

Cc Catalin Marinas <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Richard Cochran <[email protected]>
Cc Prarit Bhargava <[email protected]>
Cc Thomas Gleixner <[email protected]>

John Stultz (3):
jiffies: Kill unused TICK_USEC_TO_NSEC
jiffies: Remove compile time assumptions about CLOCK_TICK_RATE
jiffies: Add register_refined_jiffies() call to every arch

 arch/alpha/kernel/setup.c      |    3 +++
 arch/arm/kernel/setup.c        |    2 ++
 arch/avr32/kernel/setup.c      |    2 ++
 arch/blackfin/kernel/setup.c   |    2 ++
 arch/c6x/kernel/setup.c        |    2 ++
 arch/cris/kernel/setup.c       |    2 ++
 arch/h8300/kernel/setup.c      |    2 ++
 arch/hexagon/kernel/setup.c    |    2 ++
 arch/ia64/kernel/setup.c       |    2 ++
 arch/m32r/kernel/setup.c       |    2 ++
 arch/m68k/kernel/setup_mm.c    |    2 ++
 arch/m68k/kernel/setup_no.c    |    2 ++
 arch/microblaze/kernel/setup.c |    2 ++
 arch/mips/kernel/setup.c       |    2 ++
 arch/mn10300/kernel/setup.c    |    2 ++
 arch/openrisc/kernel/setup.c   |    2 ++
 arch/parisc/kernel/setup.c     |    3 ++-
 arch/powerpc/kernel/setup_32.c |    2 ++
 arch/powerpc/kernel/setup_64.c |    2 ++
 arch/s390/kernel/setup.c       |    2 ++
 arch/score/kernel/setup.c      |    2 ++
 arch/sh/kernel/setup.c         |    2 ++
 arch/sparc/kernel/setup_32.c   |    2 ++
 arch/sparc/kernel/setup_64.c   |    2 ++
 arch/tile/kernel/setup.c       |    2 ++
 arch/um/kernel/um_arch.c       |    2 ++
 arch/unicore32/kernel/setup.c  |    2 ++
 arch/x86/kernel/setup.c        |    3 +++
 arch/xtensa/kernel/setup.c     |    3 ++-
 include/linux/jiffies.h        |   21 ++-------------------
 kernel/time/jiffies.c          |   32 +++++++++++++++++++++++++++++++-
 31 files changed, 93 insertions(+), 22 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/3 jiffies: Kill unused TICK_USEC_TO_NSEC

No one is using TICK_USEC_TO_NSEC, so kill it.

Cc Catalin Marinas <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Richard Cochran <[email protected]>
Cc Prarit Bhargava <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 include/linux/jiffies.h |    6 ------
 1 file changed, 6 deletions(-)
include/linux/jiffies.h +0 -6
index 8268054..4a7e386 100644
@@ -70,12 +70,6 @@
 /* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */
 #define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ)
 
-/*
- * TICK_USEC_TO_NSEC is the time between ticks in nsec assuming SHIFTED_HZ and
- * a value TUSEC for TICK_USEC (can be set bij adjtimex)
- */
-#define TICK_USEC_TO_NSEC(TUSEC) (SH_DIV(TUSEC * USER_HZ * 1000, SHIFTED_HZ, 8))
-
 /* some arch's have a small-data section that can be accessed register-relative
  * but that can only take up to, say, 4-byte variables. jiffies being part of
  * an 8-byte variable may not be correctly accessed unless we force the issue
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/3 jiffies: Remove compile time assumptions about CLOCK_TICK_RATE

In reply to John Stultz

CLOCK_TICK_RATE is used to accurately caclulate exactly how a tick will be at a given HZ.

This is useful, because while we'd expect NSEC_PER_SEC/HZ, the underlying hardware will have some granularity limit, so we won't be able to have exactly HZ ticks per second.

This slight error can cause timekeeping quality problems when using the jiffies or other jiffies driven clocksources. Thus we currently use compile time CLOCK_TICK_RATE value to generate SHIFTED_HZ and NSEC_PER_JIFFIES, which we then use to adjust the jiffies clocksource to correct this error.

Unfortunately though, since CLOCK_TICK_RATE is a compile time value, and the jiffies clocksource is registered very early during boot, there are a number of cases where there are different possible hardware timers that have different tick rates. This causes problems in cases like ARM where there are numerous different types of hardware, each having their own compile-time CLOCK_TICK_RATE, making it hard to accurately support different hardware with a single kernel.

For the most part, this doesn't matter all that much, as not too many systems actually utilize the jiffies or jiffies driven clocksource. Usually there are other highres clocksources who's granularity error is negligable.

Even so, we have some complicated calcualtions that we do everywhere to handle these edge cases.

This patch removes the compile time SHIFTED_HZ value, and introduces a register_refined_jiffies() function. This results in the default jiffies clock as being assumed a perfect HZ freq, and allows archtectures that care about jiffies accuracy to call register_refined_jiffies() with the tick rate, specified dynamically at boot.

This allows us, where necessary, to not have a compile time CLOCK_TICK_RATE constant, simplifies the jiffies code, and still provides a way to have an accurate jiffies clock.

NOTE: Since this patch does not add register_refinied_jiffies() calls for every arch, it may cause time quality regressions in some cases. Its likely these will not be noticable, but if they are an issue, adding the following to the end of setup_arch() should resolve the regression:
register_refinied_jiffies(CLOCK_TICK_RATE)

Cc Catalin Marinas <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Richard Cochran <[email protected]>
Cc Prarit Bhargava <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 arch/x86/kernel/setup.c |    3 +++
 include/linux/jiffies.h |   15 ++-------------
 kernel/time/jiffies.c   |   32 +++++++++++++++++++++++++++++++-
 3 files changed, 36 insertions(+), 14 deletions(-)
arch/x86/kernel/setup.c +3 -0
index f4b9b80..4062f15 100644
@@ -68,6 +68,7 @@
 #include <linux/percpu.h>
 #include <linux/crash_dump.h>
 #include <linux/tboot.h>
+#include <linux/jiffies.h>
 
 #include <video/edid.h>
 
@@ -1034,6 +1035,8 @@ void __init setup_arch(char **cmdline_p)
 	mcheck_init();
 
 	arch_init_ideal_nops();
+
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 #ifdef CONFIG_X86_32
include/linux/jiffies.h +2 -13
index 4a7e386..388edb5 100644
@@ -51,21 +51,10 @@
 #define SH_DIV(NOM,DEN,LSH) (   (((NOM) / (DEN)) << (LSH))              \
                              + ((((NOM) % (DEN)) << (LSH)) + (DEN) / 2) / (DEN))
 
-#ifdef CLOCK_TICK_RATE
-/* LATCH is used in the interval timer and ftape setup. */
-# define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ)	/* For divider */
-
-/*
- * HZ is the requested value. However the CLOCK_TICK_RATE may not allow
- * for exactly HZ. So SHIFTED_HZ is high res HZ ("<< 8" is for accuracy)
- */
-# define SHIFTED_HZ (SH_DIV(CLOCK_TICK_RATE, LATCH, 8))
-#else
-# define SHIFTED_HZ (HZ << 8)
-#endif
+extern int register_refined_jiffies(long clock_tick_rate);
 
 /* TICK_NSEC is the time between ticks in nsec assuming SHIFTED_HZ */
-#define TICK_NSEC (SH_DIV(1000000UL * 1000, SHIFTED_HZ, 8))
+#define TICK_NSEC ((NSEC_PER_SEC+HZ/2)/HZ)
 
 /* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */
 #define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ)
kernel/time/jiffies.c +31 -1
index 46da053..6629bf7 100644
@@ -37,7 +37,7 @@
  * requested HZ value. It is also not recommended
  * for "tick-less" systems.
  */
-#define NSEC_PER_JIFFY	((u32)((((u64)NSEC_PER_SEC)<<8)/SHIFTED_HZ))
+#define NSEC_PER_JIFFY	((NSEC_PER_SEC+HZ/2)/HZ)
 
 /* Since jiffies uses a simple NSEC_PER_JIFFY multiplier
  * conversion, the .shift value could be zero. However
@@ -95,3 +95,33 @@ struct clocksource * __init __weak clocksource_default_clock(void)
 {
 	return &clocksource_jiffies;
 }
+
+struct clocksource refined_jiffies;
+
+int register_refined_jiffies(long cycles_per_second)
+{
+	u64 nsec_per_tick, shift_hz;
+	long cycles_per_tick;
+
+
+
+	refined_jiffies = clocksource_jiffies;
+	refined_jiffies.name = "refined-jiffies";
+	refined_jiffies.rating++;
+
+	/* Calc cycles per tick */
+	cycles_per_tick = (cycles_per_second + HZ/2)/HZ;
+	/* shift_hz stores hz<<8 for extra accuracy */
+	shift_hz = (u64)cycles_per_second << 8;
+	shift_hz += cycles_per_tick/2;
+	do_div(shift_hz, cycles_per_tick);
+	/* Calculate nsec_per_tick using shift_hz */
+	nsec_per_tick = (u64)NSEC_PER_SEC << 8;
+	nsec_per_tick += (u32)shift_hz/2;
+	do_div(nsec_per_tick, (u32)shift_hz);
+
+	refined_jiffies.mult = ((u32)nsec_per_tick) << JIFFIES_SHIFT;
+
+	clocksource_register(&refined_jiffies);
+	return 0;
+}
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/3 jiffies: Add register_refined_jiffies() call to every arch

In reply to John Stultz

This isn't really something I want to submit, but shows what is required to retain the refined jiffies clock calculation.

Instead of submitting this, which adds code that really doesn't matter in most cases, I instead propose to not submit this patch, and should anyone notice time quality regressions caused by jiffies clock error, they can add the appropriate changes from this patch.

Cc Catalin Marinas <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Richard Cochran <[email protected]>
Cc Prarit Bhargava <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 arch/alpha/kernel/setup.c      |    3 +++
 arch/arm/kernel/setup.c        |    2 ++
 arch/avr32/kernel/setup.c      |    2 ++
 arch/blackfin/kernel/setup.c   |    2 ++
 arch/c6x/kernel/setup.c        |    2 ++
 arch/cris/kernel/setup.c       |    2 ++
 arch/h8300/kernel/setup.c      |    2 ++
 arch/hexagon/kernel/setup.c    |    2 ++
 arch/ia64/kernel/setup.c       |    2 ++
 arch/m32r/kernel/setup.c       |    2 ++
 arch/m68k/kernel/setup_mm.c    |    2 ++
 arch/m68k/kernel/setup_no.c    |    2 ++
 arch/microblaze/kernel/setup.c |    2 ++
 arch/mips/kernel/setup.c       |    2 ++
 arch/mn10300/kernel/setup.c    |    2 ++
 arch/openrisc/kernel/setup.c   |    2 ++
 arch/parisc/kernel/setup.c     |    3 ++-
 arch/powerpc/kernel/setup_32.c |    2 ++
 arch/powerpc/kernel/setup_64.c |    2 ++
 arch/s390/kernel/setup.c       |    2 ++
 arch/score/kernel/setup.c      |    2 ++
 arch/sh/kernel/setup.c         |    2 ++
 arch/sparc/kernel/setup_32.c   |    2 ++
 arch/sparc/kernel/setup_64.c   |    2 ++
 arch/tile/kernel/setup.c       |    2 ++
 arch/um/kernel/um_arch.c       |    2 ++
 arch/unicore32/kernel/setup.c  |    2 ++
 arch/xtensa/kernel/setup.c     |    3 ++-
 28 files changed, 57 insertions(+), 2 deletions(-)
arch/alpha/kernel/setup.c +3 -0
index 9e3107cc5..cec1744 100644
@@ -44,6 +44,7 @@
 #include <asm/io.h>
 #include <linux/log2.h>
 #include <linux/export.h>
+#include <linux/jiffies.h>
 
 extern struct atomic_notifier_head panic_notifier_list;
 static int alpha_panic_event(struct notifier_block *, unsigned long, void *);
@@ -747,6 +748,8 @@ setup_arch(char **cmdline_p)
 	setup_smp();
 #endif
 	paging_init();
+
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 static char sys_unknown[] = "Unknown";
arch/arm/kernel/setup.c +2 -0
index a81dcec..9b4580c 100644
@@ -31,6 +31,7 @@
 #include <linux/bug.h>
 #include <linux/compiler.h>
 #include <linux/sort.h>
+#include <linux/jiffies.h>
 
 #include <asm/unified.h>
 #include <asm/cp15.h>
@@ -998,6 +999,7 @@ void __init setup_arch(char **cmdline_p)
 
 	if (mdesc->init_early)
 		mdesc->init_early();
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 
arch/avr32/kernel/setup.c +2 -0
index b4247f4..141ac85 100644
@@ -19,6 +19,7 @@
 #include <linux/root_dev.h>
 #include <linux/cpu.h>
 #include <linux/kernel.h>
+#include <linux/jiffies.h>
 
 #include <asm/sections.h>
 #include <asm/processor.h>
@@ -606,4 +607,5 @@ void __init setup_arch (char **cmdline_p)
 
 	paging_init();
 	resource_init();
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
arch/blackfin/kernel/setup.c +2 -0
index fb96e60..71a4c1b 100644
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/tty.h>
 #include <linux/pfn.h>
+#include <linux/jiffies.h>
 
 #ifdef CONFIG_MTD_UCLINUX
 #include <linux/mtd/map.h>
@@ -1101,6 +1102,7 @@ void __init setup_arch(char **cmdline_p)
 #endif
 	init_exception_vectors();
 	bfin_cache_init();	/* Initialize caches for the boot CPU */
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 static int __init topology_init(void)
arch/c6x/kernel/setup.c +2 -0
index f4e72bd..b95997a 100644
@@ -12,6 +12,7 @@
 #include <linux/memblock.h>
 #include <linux/seq_file.h>
 #include <linux/bootmem.h>
+#include <linux/jiffies.h>
 #include <linux/clkdev.h>
 #include <linux/initrd.h>
 #include <linux/kernel.h>
@@ -441,6 +442,7 @@ void __init setup_arch(char **cmdline_p)
 #if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE)
 	conswitchp = &dummy_con;
 #endif
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 #define cpu_to_ptr(n) ((void *)((long)(n)+1))
arch/cris/kernel/setup.c +2 -0
index 32c3d24..9a18d57 100644
@@ -19,6 +19,7 @@
 #include <linux/utsname.h>
 #include <linux/pfn.h>
 #include <linux/cpu.h>
+#include <linux/jiffies.h>
 #include <asm/setup.h>
 #include <arch/system.h>
 
@@ -163,6 +164,7 @@ void __init setup_arch(char **cmdline_p)
 
 	/* Setup utsname */
 	strcpy(init_utsname()->machine, cris_machine_name);
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 static void *c_start(struct seq_file *m, loff_t *pos)
arch/h8300/kernel/setup.c +2 -0
index d0b1607..4da1763 100644
@@ -31,6 +31,7 @@
 #include <linux/bootmem.h>
 #include <linux/seq_file.h>
 #include <linux/init.h>
+#include <linux/jiffies.h>
 
 #include <asm/setup.h>
 #include <asm/irq.h>
@@ -187,6 +188,7 @@ void __init setup_arch(char **cmdline_p)
 		*cscr  |= (AREABIT(CONFIG_H8300_IDE_BASE) | AREABIT(CONFIG_H8300_IDE_ALT)) | 0x0f;
 	}
 #endif
+	register_refined_jiffies(CLOCK_TICK_RATE);
 #ifdef DEBUG
 	printk(KERN_DEBUG "Done setup_arch\n");
 #endif
arch/hexagon/kernel/setup.c +2 -0
index 1202f78..d0d5cce 100644
@@ -25,6 +25,7 @@
 #include <linux/seq_file.h>
 #include <linux/console.h>
 #include <linux/of_fdt.h>
+#include <linux/jiffies.h>
 #include <asm/io.h>
 #include <asm/sections.h>
 #include <asm/setup.h>
@@ -99,6 +100,7 @@ void __init setup_arch(char **cmdline_p)
 #ifdef CONFIG_SMP
 	smp_start_cpus();
 #endif
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 /*
arch/ia64/kernel/setup.c +2 -0
index aaefd9b..2d6dce2 100644
@@ -45,6 +45,7 @@
 #include <linux/cpufreq.h>
 #include <linux/kexec.h>
 #include <linux/crash_dump.h>
+#include <linux/jiffies.h>
 
 #include <asm/machvec.h>
 #include <asm/mca.h>
@@ -626,6 +627,7 @@ setup_arch (char **cmdline_p)
 	check_sal_cache_flush();
 #endif
 	paging_init();
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 /*
arch/m32r/kernel/setup.c +2 -0
index 0392112..f6c5bf3 100644
@@ -25,6 +25,7 @@
 #include <linux/cpu.h>
 #include <linux/nodemask.h>
 #include <linux/pfn.h>
+#include <linux/jiffies.h>
 
 #include <asm/processor.h>
 #include <asm/pgtable.h>
@@ -266,6 +267,7 @@ void __init setup_arch(char **cmdline_p)
 	setup_memory();
 
 	paging_init();
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 static struct cpu cpu_devices[NR_CPUS];
arch/m68k/kernel/setup_mm.c +2 -0
index d872ce4..3521cde 100644
@@ -24,6 +24,7 @@
 #include <linux/seq_file.h>
 #include <linux/module.h>
 #include <linux/initrd.h>
+#include <linux/jiffies.h>
 
 #include <asm/bootinfo.h>
 #include <asm/sections.h>
@@ -383,6 +384,7 @@ void __init setup_arch(char **cmdline_p)
 	}
 #endif
 #endif
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 static int show_cpuinfo(struct seq_file *m, void *v)
arch/m68k/kernel/setup_no.c +2 -0
index 71fb299..055c452 100644
@@ -32,6 +32,7 @@
 #include <linux/initrd.h>
 #include <linux/root_dev.h>
 #include <linux/rtc.h>
+#include <linux/jiffies.h>
 
 #include <asm/setup.h>
 #include <asm/irq.h>
@@ -259,6 +260,7 @@ void __init setup_arch(char **cmdline_p)
 	 * Get kmalloc into gear.
 	 */
 	paging_init();
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 /*
arch/microblaze/kernel/setup.c +2 -0
index 4da971d..3dbddc7 100644
@@ -15,6 +15,7 @@
 #include <linux/initrd.h>
 #include <linux/console.h>
 #include <linux/debugfs.h>
+#include <linux/jiffies.h>
 
 #include <asm/setup.h>
 #include <asm/sections.h>
@@ -74,6 +75,7 @@ void __init setup_arch(char **cmdline_p)
 	conswitchp = &dummy_con;
 #endif
 #endif
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 #ifdef CONFIG_MTD_UCLINUX
arch/mips/kernel/setup.c +2 -0
index a53f8ec..502eb50 100644
@@ -22,6 +22,7 @@
 #include <linux/console.h>
 #include <linux/pfn.h>
 #include <linux/debugfs.h>
+#include <linux/jiffies.h>
 
 #include <asm/addrspace.h>
 #include <asm/bootinfo.h>
@@ -607,6 +608,7 @@ void __init setup_arch(char **cmdline_p)
 	plat_smp_setup();
 
 	cpu_cache_init();
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 unsigned long kernelsp[NR_CPUS];
arch/mn10300/kernel/setup.c +2 -0
index 33c3bd1..7e615e0 100644
@@ -22,6 +22,7 @@
 #include <linux/init.h>
 #include <linux/bootmem.h>
 #include <linux/seq_file.h>
+#include <linux/jiffies.h>
 #include <linux/cpu.h>
 #include <asm/processor.h>
 #include <linux/console.h>
@@ -173,6 +174,7 @@ void __init setup_arch(char **cmdline_p)
 #endif
 
 	paging_init();
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 /*
arch/openrisc/kernel/setup.c +2 -0
index f4d5bed..1c42ac3 100644
@@ -39,6 +39,7 @@
 #include <linux/memblock.h>
 #include <linux/device.h>
 #include <linux/of_platform.h>
+#include <linux/jiffies.h>
 
 #include <asm/segment.h>
 #include <asm/pgtable.h>
@@ -318,6 +319,7 @@ void __init setup_arch(char **cmdline_p)
 
 	*cmdline_p = cmd_line;
 
+	register_refined_jiffies(CLOCK_TICK_RATE);
 	printk(KERN_INFO "OpenRISC Linux -- http://openrisc.net\n");
 }
 
arch/parisc/kernel/setup.c +2 -1
index a3328c2..93af0cf 100644
@@ -36,6 +36,7 @@
 #undef PCI_DEBUG
 #include <linux/proc_fs.h>
 #include <linux/export.h>
+#include <linux/jiffies.h>
 
 #include <asm/processor.h>
 #include <asm/pdc.h>
@@ -155,7 +156,7 @@ void __init setup_arch(char **cmdline_p)
 #if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE)
 	conswitchp = &dummy_con;	/* we use take_over_console() later ! */
 #endif
-
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 /*
arch/powerpc/kernel/setup_32.c +2 -0
index a8f54ec..e9e92c7 100644
@@ -17,6 +17,7 @@
 #include <linux/cpu.h>
 #include <linux/console.h>
 #include <linux/memblock.h>
+#include <linux/jiffies.h>
 
 #include <asm/io.h>
 #include <asm/prom.h>
@@ -327,4 +328,5 @@ void __init setup_arch(char **cmdline_p)
 	/* Initialize the MMU context management stuff */
 	mmu_context_init();
 
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
arch/powerpc/kernel/setup_64.c +2 -0
index 389bd4f..9d9c3f4 100644
@@ -36,6 +36,7 @@
 #include <linux/lockdep.h>
 #include <linux/memblock.h>
 #include <linux/hugetlb.h>
+#include <linux/jiffies.h>
 
 #include <asm/io.h>
 #include <asm/kdump.h>
@@ -599,6 +600,7 @@ void __init setup_arch(char **cmdline_p)
 
 	kvm_linear_init();
 
+	register_refined_jiffies(CLOCK_TICK_RATE);
 	ppc64_boot_msg(0x15, "Setup Done");
 }
 
arch/s390/kernel/setup.c +2 -0
index f86c81e..4f15231 100644
@@ -45,6 +45,7 @@
 #include <linux/crash_dump.h>
 #include <linux/memory.h>
 #include <linux/compat.h>
+#include <linux/jiffies.h>
 
 #include <asm/ipl.h>
 #include <asm/uaccess.h>
@@ -1094,4 +1095,5 @@ void __init setup_arch(char **cmdline_p)
 
 	/* Setup zfcpdump support */
 	setup_zfcpdump(console_devno);
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
arch/score/kernel/setup.c +2 -0
index b48459a..e68d17b 100644
@@ -30,6 +30,7 @@
 #include <linux/mm.h>
 #include <linux/seq_file.h>
 #include <linux/screen_info.h>
+#include <linux/jiffies.h>
 
 #include <asm-generic/sections.h>
 #include <asm/setup.h>
@@ -118,6 +119,7 @@ void __init setup_arch(char **cmdline_p)
 	bootmem_init();
 	paging_init();
 	resource_init();
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 static int show_cpuinfo(struct seq_file *m, void *v)
arch/sh/kernel/setup.c +2 -0
index ebe7a7d..6ab324d 100644
@@ -29,6 +29,7 @@
 #include <linux/delay.h>
 #include <linux/platform_device.h>
 #include <linux/memblock.h>
+#include <linux/jiffies.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
 #include <asm/page.h>
@@ -309,6 +310,7 @@ void __init setup_arch(char **cmdline_p)
 		sh_mv.mv_setup(cmdline_p);
 
 	plat_smp_setup();
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 /* processor boot mode configuration */
arch/sparc/kernel/setup_32.c +2 -0
index 38bf80a..7f4c87f 100644
@@ -33,6 +33,7 @@
 #include <linux/kdebug.h>
 #include <linux/export.h>
 #include <linux/start_kernel.h>
+#include <linux/jiffies.h>
 
 #include <asm/io.h>
 #include <asm/processor.h>
@@ -379,6 +380,7 @@ void __init setup_arch(char **cmdline_p)
 	paging_init();
 
 	smp_setup_cpu_possible_map();
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 extern int stop_a_enabled;
arch/sparc/kernel/setup_64.c +2 -0
index 1414d16..7ec0638 100644
@@ -30,6 +30,7 @@
 #include <linux/cpu.h>
 #include <linux/initrd.h>
 #include <linux/module.h>
+#include <linux/jiffies.h>
 
 #include <asm/io.h>
 #include <asm/processor.h>
@@ -547,6 +548,7 @@ void __init setup_arch(char **cmdline_p)
 
 	paging_init();
 	init_sparc64_elf_hwcap();
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 extern int stop_a_enabled;
arch/tile/kernel/setup.c +2 -0
index 6a649a4..f1bc41e 100644
@@ -31,6 +31,7 @@
 #include <linux/timex.h>
 #include <linux/hugetlb.h>
 #include <linux/start_kernel.h>
+#include <linux/jiffies.h>
 #include <asm/setup.h>
 #include <asm/sections.h>
 #include <asm/cacheflush.h>
@@ -1392,6 +1393,7 @@ void __init setup_arch(char **cmdline_p)
 	setup_cpu(1);
 	setup_clock();
 	load_hv_initrd();
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 
arch/um/kernel/um_arch.c +2 -0
index 4db8770..4d988e1 100644
@@ -11,6 +11,7 @@
 #include <linux/string.h>
 #include <linux/utsname.h>
 #include <linux/sched.h>
+#include <linux/jiffies.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
 #include <asm/setup.h>
@@ -384,6 +385,7 @@ void __init setup_arch(char **cmdline_p)
 	strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
 	*cmdline_p = command_line;
 	setup_hostinfo(host_info, sizeof host_info);
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 void __init check_bugs(void)
arch/unicore32/kernel/setup.c +2 -0
index 87adbf5..198c647 100644
@@ -30,6 +30,7 @@
 #include <linux/memblock.h>
 #include <linux/elf.h>
 #include <linux/io.h>
+#include <linux/jiffies.h>
 
 #include <asm/cputype.h>
 #include <asm/sections.h>
@@ -271,6 +272,7 @@ void __init setup_arch(char **cmdline_p)
 #endif
 #endif
 	early_trap_init();
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 static struct cpu cpuinfo_unicore;
arch/xtensa/kernel/setup.c +2 -1
index 17e746f..1a817ff 100644
@@ -21,7 +21,7 @@
 #include <linux/screen_info.h>
 #include <linux/bootmem.h>
 #include <linux/kernel.h>
-
+#include <linux/jiffies.h>
 #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
 # include <linux/console.h>
 #endif
@@ -304,6 +304,7 @@ void __init setup_arch(char **cmdline_p)
 #ifdef CONFIG_PCI
 	platform_pcibios_init();
 #endif
+	register_refined_jiffies(CLOCK_TICK_RATE);
 }
 
 void machine_restart(char * cmd)
Signature · 1 line
1.7.9.5
#4 lore raw
In reply to John Stultz
Quoted 1 line · John Stultz

Just wanted to send this out for initial review and comments.

Gah. And I forgot to add the [RFC] header to my mails to make this clear. Hopefully this doesn't confuse anyone.

These are not yet ready for submission! Just wanting feedback on the approach!

thanks
-john