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 @@
OUTPUT_FORMAT("elf64-alpha")
ENTRY(__start)
PHDRS { kernel PT_LOAD ; }
jiffies = jiffies_64;
SECTIONS
{
#ifdef CONFIG_ALPHA_LEGACY_START_ADDRESS
......
......@@ -4,6 +4,7 @@
*/
OUTPUT_ARCH(arm)
ENTRY(stext)
jiffies = jiffies_64 + 4;
SECTIONS
{
. = TEXTADDR;
......
......@@ -4,6 +4,7 @@
*/
OUTPUT_ARCH(arm)
ENTRY(stext)
jiffies = jiffies_64 + 4;
SECTIONS
{
. = TEXTADDR;
......
......@@ -8,6 +8,7 @@
* the kernel has booted.
*/
jiffies = jiffies_64;
SECTIONS
{
. = @CONFIG_ETRAX_DRAM_VIRTUAL_BASE@;
......
......@@ -4,6 +4,7 @@
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(_start)
jiffies = jiffies_64;
SECTIONS
{
. = 0xC0000000 + 0x100000;
......
......@@ -7,6 +7,7 @@
OUTPUT_FORMAT("elf64-ia64-little")
OUTPUT_ARCH(ia64)
ENTRY(phys_start)
jiffies = jiffies_64;
SECTIONS
{
/* Sections to be discarded */
......
......@@ -2,6 +2,7 @@
OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
OUTPUT_ARCH(m68k)
ENTRY(_start)
jiffies = jiffies_64 + 4;
SECTIONS
{
. = 0xE004000;
......
......@@ -2,6 +2,7 @@
OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
OUTPUT_ARCH(m68k)
ENTRY(_start)
jiffies = jiffies_64 + 4;
SECTIONS
{
. = 0x1000;
......
OUTPUT_ARCH(mips)
ENTRY(kernel_entry)
jiffies = jiffies_64;
SECTIONS
{
/* Read-only sections, merged into text segment: */
......
......@@ -2,6 +2,7 @@
OUTPUT_FORMAT("elf32-hppa")
OUTPUT_ARCH(hppa)
ENTRY(_stext)
jiffies = jiffies_64 + 4;
SECTIONS
{
......
......@@ -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);
/* Do we need any of these for elf?
__DYNAMIC = 0; */
jiffies = jiffies_64 + 4;
SECTIONS
{
/* Read-only sections, merged into text segment: */
......
......@@ -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);
/* Do we need any of these for elf?
__DYNAMIC = 0; */
jiffies = jiffies_64;
SECTIONS
{
/* Read-only sections, merged into text segment: */
......
......@@ -4,6 +4,7 @@
OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390")
OUTPUT_ARCH(s390)
ENTRY(_start)
jiffies = jiffies_64 + 4;
SECTIONS
{
. = 0x00000000;
......
......@@ -4,6 +4,7 @@
OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390")
OUTPUT_ARCH(s390)
ENTRY(_start)
jiffies = jiffies_64 + 4;
SECTIONS
{
. = 0x00000000;
......
......@@ -4,6 +4,7 @@
OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
OUTPUT_ARCH(s390)
ENTRY(_start)
jiffies = jiffies_64;
SECTIONS
{
. = 0x00000000;
......
......@@ -4,6 +4,7 @@
OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
OUTPUT_ARCH(s390)
ENTRY(_start)
jiffies = jiffies_64;
SECTIONS
{
. = 0x00000000;
......
......@@ -5,8 +5,10 @@
#include <linux/config.h>
#ifdef CONFIG_CPU_LITTLE_ENDIAN
OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux")
jiffies = jiffies_64;
#else
OUTPUT_FORMAT("elf32-shbig-linux", "elf32-shbig-linux", "elf32-shbig-linux")
jiffies = jiffies_64 + 4;
#endif
OUTPUT_ARCH(sh)
ENTRY(_start)
......
......@@ -2,6 +2,7 @@
OUTPUT_FORMAT("elf32-sparc", "elf32-sparc", "elf32-sparc")
OUTPUT_ARCH(sparc)
ENTRY(_start)
jiffies = jiffies_64 + 4;
SECTIONS
{
. = 0x10000 + SIZEOF_HEADERS;
......
......@@ -3,6 +3,7 @@ OUTPUT_FORMAT("elf64-sparc", "elf64-sparc", "elf64-sparc")
OUTPUT_ARCH(sparc:v9a)
ENTRY(_start)
jiffies = jiffies_64;
SECTIONS
{
swapper_pmd_dir = 0x0000000000402000;
......
......@@ -3,6 +3,7 @@
*/
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)
jiffies = jiffies_64;
ENTRY(_start)
SECTIONS
{
......
......@@ -459,6 +459,11 @@ extern void free_uid(struct user_struct *);
#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 itimer_ticks;
extern unsigned long itimer_next;
......
......@@ -471,6 +471,7 @@ EXPORT_SYMBOL_GPL(idle_cpu);
EXPORT_SYMBOL_GPL(set_cpus_allowed);
#endif
EXPORT_SYMBOL(jiffies);
EXPORT_SYMBOL(jiffies_64);
EXPORT_SYMBOL(xtime);
EXPORT_SYMBOL(do_gettimeofday);
EXPORT_SYMBOL(do_settimeofday);
......
......@@ -67,7 +67,12 @@ unsigned long event;
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 long prof_len;
......@@ -664,7 +669,7 @@ void timer_bh(void)
void do_timer(struct pt_regs *regs)
{
(*(unsigned long *)&jiffies)++;
jiffies_64++;
#ifndef CONFIG_SMP
/* 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