Commit fa44005c authored by George Anzinger's avatar George Anzinger Committed by Jeff Garzik

[PATCH] 64-bit jiffies, a better solution

Ok, here it is.  The following arch are not covered:
Mips, Mips64 in 32-bit mode, parisc in __LP64__ mode.

In addition, x86_64 mentions jiffies in the existing script.
This may be a problem.
parent 2b5adb1d
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
OUTPUT_FORMAT("elf64-alpha") OUTPUT_FORMAT("elf64-alpha")
ENTRY(__start) ENTRY(__start)
PHDRS { kernel PT_LOAD ; } PHDRS { kernel PT_LOAD ; }
jiffies = jiffies_64;
SECTIONS SECTIONS
{ {
#ifdef CONFIG_ALPHA_LEGACY_START_ADDRESS #ifdef CONFIG_ALPHA_LEGACY_START_ADDRESS
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
*/ */
OUTPUT_ARCH(arm) OUTPUT_ARCH(arm)
ENTRY(stext) ENTRY(stext)
jiffies = jiffies_64 + 4;
SECTIONS SECTIONS
{ {
. = TEXTADDR; . = TEXTADDR;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
*/ */
OUTPUT_ARCH(arm) OUTPUT_ARCH(arm)
ENTRY(stext) ENTRY(stext)
jiffies = jiffies_64 + 4;
SECTIONS SECTIONS
{ {
. = TEXTADDR; . = TEXTADDR;
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
* the kernel has booted. * the kernel has booted.
*/ */
jiffies = jiffies_64;
SECTIONS SECTIONS
{ {
. = @CONFIG_ETRAX_DRAM_VIRTUAL_BASE@; . = @CONFIG_ETRAX_DRAM_VIRTUAL_BASE@;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386) OUTPUT_ARCH(i386)
ENTRY(_start) ENTRY(_start)
jiffies = jiffies_64;
SECTIONS SECTIONS
{ {
. = 0xC0000000 + 0x100000; . = 0xC0000000 + 0x100000;
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
OUTPUT_FORMAT("elf64-ia64-little") OUTPUT_FORMAT("elf64-ia64-little")
OUTPUT_ARCH(ia64) OUTPUT_ARCH(ia64)
ENTRY(phys_start) ENTRY(phys_start)
jiffies = jiffies_64;
SECTIONS SECTIONS
{ {
/* Sections to be discarded */ /* Sections to be discarded */
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k") OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
OUTPUT_ARCH(m68k) OUTPUT_ARCH(m68k)
ENTRY(_start) ENTRY(_start)
jiffies = jiffies_64 + 4;
SECTIONS SECTIONS
{ {
. = 0xE004000; . = 0xE004000;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k") OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
OUTPUT_ARCH(m68k) OUTPUT_ARCH(m68k)
ENTRY(_start) ENTRY(_start)
jiffies = jiffies_64 + 4;
SECTIONS SECTIONS
{ {
. = 0x1000; . = 0x1000;
......
OUTPUT_ARCH(mips) OUTPUT_ARCH(mips)
ENTRY(kernel_entry) ENTRY(kernel_entry)
jiffies = jiffies_64;
SECTIONS SECTIONS
{ {
/* Read-only sections, merged into text segment: */ /* Read-only sections, merged into text segment: */
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
OUTPUT_FORMAT("elf32-hppa") OUTPUT_FORMAT("elf32-hppa")
OUTPUT_ARCH(hppa) OUTPUT_ARCH(hppa)
ENTRY(_stext) ENTRY(_stext)
jiffies = jiffies_64 + 4;
SECTIONS SECTIONS
{ {
......
...@@ -2,6 +2,7 @@ OUTPUT_ARCH(powerpc) ...@@ -2,6 +2,7 @@ OUTPUT_ARCH(powerpc)
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib); SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
/* Do we need any of these for elf? /* Do we need any of these for elf?
__DYNAMIC = 0; */ __DYNAMIC = 0; */
jiffies = jiffies_64 + 4;
SECTIONS SECTIONS
{ {
/* Read-only sections, merged into text segment: */ /* Read-only sections, merged into text segment: */
......
...@@ -2,6 +2,7 @@ OUTPUT_ARCH(powerpc) ...@@ -2,6 +2,7 @@ OUTPUT_ARCH(powerpc)
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib); SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
/* Do we need any of these for elf? /* Do we need any of these for elf?
__DYNAMIC = 0; */ __DYNAMIC = 0; */
jiffies = jiffies_64;
SECTIONS SECTIONS
{ {
/* Read-only sections, merged into text segment: */ /* Read-only sections, merged into text segment: */
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390") OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390")
OUTPUT_ARCH(s390) OUTPUT_ARCH(s390)
ENTRY(_start) ENTRY(_start)
jiffies = jiffies_64 + 4;
SECTIONS SECTIONS
{ {
. = 0x00000000; . = 0x00000000;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390") OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390")
OUTPUT_ARCH(s390) OUTPUT_ARCH(s390)
ENTRY(_start) ENTRY(_start)
jiffies = jiffies_64 + 4;
SECTIONS SECTIONS
{ {
. = 0x00000000; . = 0x00000000;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390") OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
OUTPUT_ARCH(s390) OUTPUT_ARCH(s390)
ENTRY(_start) ENTRY(_start)
jiffies = jiffies_64;
SECTIONS SECTIONS
{ {
. = 0x00000000; . = 0x00000000;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390") OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
OUTPUT_ARCH(s390) OUTPUT_ARCH(s390)
ENTRY(_start) ENTRY(_start)
jiffies = jiffies_64;
SECTIONS SECTIONS
{ {
. = 0x00000000; . = 0x00000000;
......
...@@ -5,8 +5,10 @@ ...@@ -5,8 +5,10 @@
#include <linux/config.h> #include <linux/config.h>
#ifdef CONFIG_CPU_LITTLE_ENDIAN #ifdef CONFIG_CPU_LITTLE_ENDIAN
OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux") OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux")
jiffies = jiffies_64;
#else #else
OUTPUT_FORMAT("elf32-shbig-linux", "elf32-shbig-linux", "elf32-shbig-linux") OUTPUT_FORMAT("elf32-shbig-linux", "elf32-shbig-linux", "elf32-shbig-linux")
jiffies = jiffies_64 + 4;
#endif #endif
OUTPUT_ARCH(sh) OUTPUT_ARCH(sh)
ENTRY(_start) ENTRY(_start)
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
OUTPUT_FORMAT("elf32-sparc", "elf32-sparc", "elf32-sparc") OUTPUT_FORMAT("elf32-sparc", "elf32-sparc", "elf32-sparc")
OUTPUT_ARCH(sparc) OUTPUT_ARCH(sparc)
ENTRY(_start) ENTRY(_start)
jiffies = jiffies_64 + 4;
SECTIONS SECTIONS
{ {
. = 0x10000 + SIZEOF_HEADERS; . = 0x10000 + SIZEOF_HEADERS;
......
...@@ -3,6 +3,7 @@ OUTPUT_FORMAT("elf64-sparc", "elf64-sparc", "elf64-sparc") ...@@ -3,6 +3,7 @@ OUTPUT_FORMAT("elf64-sparc", "elf64-sparc", "elf64-sparc")
OUTPUT_ARCH(sparc:v9a) OUTPUT_ARCH(sparc:v9a)
ENTRY(_start) ENTRY(_start)
jiffies = jiffies_64;
SECTIONS SECTIONS
{ {
swapper_pmd_dir = 0x0000000000402000; swapper_pmd_dir = 0x0000000000402000;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
*/ */
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
OUTPUT_ARCH(i386:x86-64) OUTPUT_ARCH(i386:x86-64)
jiffies = jiffies_64;
ENTRY(_start) ENTRY(_start)
SECTIONS SECTIONS
{ {
......
...@@ -459,6 +459,11 @@ extern void free_uid(struct user_struct *); ...@@ -459,6 +459,11 @@ extern void free_uid(struct user_struct *);
#include <asm/current.h> #include <asm/current.h>
/*
* The 64-bit value is not volatile - you MUST NOT read it
* without holding read_lock_irq(&xtime_lock)
*/
extern u64 jiffies_64;
extern unsigned long volatile jiffies; extern unsigned long volatile jiffies;
extern unsigned long itimer_ticks; extern unsigned long itimer_ticks;
extern unsigned long itimer_next; extern unsigned long itimer_next;
......
...@@ -471,6 +471,7 @@ EXPORT_SYMBOL_GPL(idle_cpu); ...@@ -471,6 +471,7 @@ EXPORT_SYMBOL_GPL(idle_cpu);
EXPORT_SYMBOL_GPL(set_cpus_allowed); EXPORT_SYMBOL_GPL(set_cpus_allowed);
#endif #endif
EXPORT_SYMBOL(jiffies); EXPORT_SYMBOL(jiffies);
EXPORT_SYMBOL(jiffies_64);
EXPORT_SYMBOL(xtime); EXPORT_SYMBOL(xtime);
EXPORT_SYMBOL(do_gettimeofday); EXPORT_SYMBOL(do_gettimeofday);
EXPORT_SYMBOL(do_settimeofday); EXPORT_SYMBOL(do_settimeofday);
......
...@@ -67,7 +67,12 @@ unsigned long event; ...@@ -67,7 +67,12 @@ unsigned long event;
extern int do_setitimer(int, struct itimerval *, struct itimerval *); extern int do_setitimer(int, struct itimerval *, struct itimerval *);
unsigned long volatile jiffies; /*
* The 64-bit value is not volatile - you MUST NOT read it
* without holding read_lock_irq(&xtime_lock).
* jiffies is defined in the linker script...
*/
u64 jiffies_64;
unsigned int * prof_buffer; unsigned int * prof_buffer;
unsigned long prof_len; unsigned long prof_len;
...@@ -664,7 +669,7 @@ void timer_bh(void) ...@@ -664,7 +669,7 @@ void timer_bh(void)
void do_timer(struct pt_regs *regs) void do_timer(struct pt_regs *regs)
{ {
(*(unsigned long *)&jiffies)++; jiffies_64++;
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
/* SMP process accounting uses the local APIC timer */ /* SMP process accounting uses the local APIC timer */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment