public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Andi Kleen <ak@suse.de>, linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] get rid of ARCH_HAVE_XTIME_LOCK
Date: Mon, 11 Dec 2006 11:52:56 +0100	[thread overview]
Message-ID: <200612111152.56945.dada1@cosmosbay.com> (raw)
In-Reply-To: <20061211021718.a6954106.akpm@osdl.org>

[-- Attachment #1: Type: text/plain, Size: 1001 bytes --]

As suggested by Andrew, we can use __attribute__((weak)) to get rid of 
ARCH_HAVE_XTIME_LOCK

Please note I compiled, and boot tested on ia32 this patch, and it seems OK.
I compiled on x86_64 and got same resulting vmlinux image.

But I suspect some tools might have problems because vmlinux have its 
first 'weak data symbol' defined. AFAIK __attribute__((weak)) was only used 
on text symbols.

# nm vmlinux | grep ' V '
c03b01c0 V xtime_lock

[PATCH] get rid of ARCH_HAVE_XTIME_LOCK

ARCH_HAVE_XTIME_LOCK is used by x86_64 arch . This arch needs to place a read 
only copy of xtime_lock into vsyscall page. This read only copy is named 
__xtime_lock, and xtime_lock is defined in arch/x86_64/kernel/vmlinux.lds.S 
as an alias. So the declaration of xtime_lock in kernel/timer.c was guarded 
by ARCH_HAVE_XTIME_LOCK define, defined to true on x86_64.

We can get same result with _attribute__((weak)) in the declaration. linker 
should do the job.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>

[-- Attachment #2: ARCH_HAVE_XTIME_LOCK.patch --]
[-- Type: text/plain, Size: 1423 bytes --]

--- linux-2.6.19/kernel/timer.c	2006-12-11 11:25:50.000000000 +0100
+++ linux-2.6.19-ed/kernel/timer.c	2006-12-11 11:31:30.000000000 +0100
@@ -1020,11 +1020,9 @@ static inline void calc_load(unsigned lo
  * This read-write spinlock protects us from races in SMP while
  * playing with xtime and avenrun.
  */
-#ifndef ARCH_HAVE_XTIME_LOCK
-__cacheline_aligned_in_smp DEFINE_SEQLOCK(xtime_lock);
+__attribute__((weak)) __cacheline_aligned_in_smp DEFINE_SEQLOCK(xtime_lock);
 
 EXPORT_SYMBOL(xtime_lock);
-#endif
 
 /*
  * This function runs timers and the timer-tq in bottom half context.
--- linux-2.6.19/include/linux/time.h	2006-12-11 11:34:54.000000000 +0100
+++ linux-2.6.19-ed/include/linux/time.h	2006-12-11 11:34:54.000000000 +0100
@@ -90,7 +90,7 @@ static inline struct timespec timespec_s
 
 extern struct timespec xtime;
 extern struct timespec wall_to_monotonic;
-extern seqlock_t xtime_lock;
+extern seqlock_t xtime_lock __attribute__((weak));
 
 void timekeeping_init(void);
 
--- linux-2.6.19/include/asm-x86_64/vsyscall.h	2006-12-11 11:34:54.000000000 +0100
+++ linux-2.6.19-ed/include/asm-x86_64/vsyscall.h	2006-12-11 11:34:54.000000000 +0100
@@ -55,11 +55,6 @@ extern struct vxtime_data vxtime;
 extern int vgetcpu_mode;
 extern struct timezone sys_tz;
 extern int sysctl_vsyscall;
-extern seqlock_t xtime_lock;
-
-extern int sysctl_vsyscall;
-
-#define ARCH_HAVE_XTIME_LOCK 1
 
 #endif /* __KERNEL__ */
 

  parent reply	other threads:[~2006-12-11 10:52 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-11  8:27 [patch] pipe: Don't oops when pipe filesystem isn't mounted Chuck Ebbert
2006-12-11  8:55 ` Andrew Morton
2006-12-11  9:13   ` Andrew Morton
2006-12-11  9:21     ` Al Viro
2006-12-11  9:25       ` Andrew Morton
2006-12-11  9:33         ` Al Viro
2006-12-11  9:47           ` Andrew Morton
2006-12-11 10:03             ` Al Viro
2006-12-11 10:17               ` Andrew Morton
2006-12-11 10:22                 ` Al Viro
2006-12-11 10:34                   ` Andrew Morton
2006-12-11 10:47                     ` Al Viro
2006-12-11 10:57                     ` Jeff Garzik
2006-12-11 10:27                 ` Andrew Morton
2006-12-11 10:45                   ` Al Viro
2006-12-11 16:01                     ` Linus Torvalds
2006-12-11 16:12                       ` Al Viro
2006-12-11 16:40                         ` Linus Torvalds
2006-12-12  0:33                           ` Benjamin Herrenschmidt
2006-12-12  2:08                       ` Andrew Morton
2006-12-12  2:17                         ` Dominik Brodowski
2006-12-12  2:23                         ` Linus Torvalds
2006-12-11 10:52                 ` Eric Dumazet [this message]
2006-12-11 13:50                   ` [PATCH] Optimize calc_load() Eric Dumazet
2006-12-11 19:04                     ` [PATCH] constify pipe_buf_operations Eric Dumazet
2006-12-11  9:13 ` [patch] pipe: Don't oops when pipe filesystem isn't mounted Al Viro
2006-12-11  9:40   ` Michael Tokarev
2006-12-11 15:44 ` Linus Torvalds
2006-12-12 12:20   ` Michael Tokarev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200612111152.56945.dada1@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox