Try 2: Make the TSC safe to be use by gettimeofday().
cover Try 2: Make the TSC safe to be use by gettimeofday().
Hi,
Here are the fixes from the previous version:
- Don't use hard_smp_processor_id().
- Use the PDA to store a pointer to the current CPU's vxtime data.
- Use vgetcpu() to get the CPU number from vgettimeofday()
(Due to a bug in vgetcpu(), this only works with CONFIG_HOTPLUG_CPU=y)
- No externs in .c files
- Use idle notifiers instead of doing the HPET read in switch_to
- Fix race in vgettimeofday() by checking the RIP of the process we're switching away from in switch_to, and touching the vxtime seqlock if it happens to be in the VSYSCALL page. (I hope this is not considered too much work for switch_to)
- Remove usage of preempt_disable/enable() in do_gettimeoday(), since the above fix make it unnecessary.
-- Suleiman
PATCH 1/1 Make the TSC safe to be used by gettimeofday().
This is done by a per-cpu vxtime structure that stores the last TSC and HPET values.
Whenever we switch to a userland process after a HLT instruction has been executed or after the CPU frequency has changed, we force a new read of the TSC, HPET and xtime so that we know the correct frequency we have to deal with.
We also force a resynch once every second, on every CPU.
With this, we can safely use RDTSC in gettimeofday() in CPUs where the TSCs are not synchronized, such as Opterons, instead of doing a very expensive HPET read.
---
arch/x86_64/kernel/process.c | 19 ++++++ arch/x86_64/kernel/setup64.c | 3 + arch/x86_64/kernel/time.c | 39 ++++++++--- arch/x86_64/kernel/vmlinux.lds.S | 6 +- arch/x86_64/kernel/vsyscall.c | 131 ++++++++++++++++++++++++++++++++------ include/asm-x86_64/pda.h | 3 + include/asm-x86_64/proto.h | 1 include/asm-x86_64/timex.h | 2 + include/asm-x86_64/vsyscall.h | 12 +++ include/linux/hrtimer.h | 2 + 10 files changed, 185 insertions(+), 33 deletions(-)
arch/x86_64/kernel/process.c +0 -0
@@ -51,6 +51,7 @@ #include <asm/desc.h>
#include <asm/proto.h>
#include <asm/ia32.h>
#include <asm/idle.h>
+#include <asm/vsyscall.h>
asmlinkage extern void ret_from_fork(void);
@@ -109,6 +110,10 @@ void exit_idle(void)
*/
static void default_idle(void)
{
+ int cpu;
+
+ cpu = smp_processor_id();
+
local_irq_enable(); current_thread_info()->status &= ~TS_POLLING; @@ -562,6 +567,7 @@ __switch_to(struct task_struct *prev_p, *next = &next_p->thread; int cpu = smp_processor_id(); struct tss_struct *tss = &per_cpu(init_tss, cpu);
+ unsigned long rip;
/* we're going to use this soon, after a few expensive things */ if (next_p->fpu_counter>5) @@ -657,6 +663,19 @@ #endif */ if (next_p->fpu_counter>5) math_state_restore();
+
+ /*
+ * If we are switching away from a process in vsyscall, touch
+ * the vxtime seq lock so that userland is aware that a context switch
+ * has happened.
+ */
+ rip = *(unsigned long *)(prev->rsp0 +
+ offsetof(struct user_regs_struct, rip) - sizeof(struct pt_regs));
+ if (unlikely(rip > VSYSCALL_START) && unlikely(rip < VSYSCALL_END)) {
+ write_seqlock(&vxtime.vx_seq);
+ write_sequnlock(&vxtime.vx_seq);
+ }
+
return prev_p; }
arch/x86_64/kernel/setup64.c +0 -0
@@ -23,6 +23,7 @@ #include <asm/i387.h>
#include <asm/percpu.h>
#include <asm/proto.h>
#include <asm/sections.h>
+#include <asm/vsyscall.h>
char x86_boot_params[BOOT_PARAM_SIZE] __initdata;
@@ -146,6 +147,8 @@ void pda_init(int cpu)
pda->irqstackptr += IRQSTACKSIZE-64;
+
+ pda->vxtime = &vxtime.pcpu[cpu];
}
char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + DEBUG_STKSZ]
arch/x86_64/kernel/time.c +0 -0
@@ -118,14 +118,17 @@ unsigned int (*do_gettimeoffset)(void) =
void do_gettimeofday(struct timeval *tv)
{
- unsigned long seq;
+ unsigned long seq, t;
unsigned int sec, usec;
+ struct vxtime_pcpu *pcpu;
+ preempt_disable();
+ pcpu = read_pda(vxtime);
do {- seq = read_seqbegin(&xtime_lock);
+ seq = read_seqbegin(&vxtime.vx_seq);
- sec = xtime.tv_sec;
- usec = xtime.tv_nsec / NSEC_PER_USEC;
+ sec = pcpu->tv_sec;
+ usec = pcpu->tv_usec;
/* i386 does some correction here to keep the clock monotonous even when ntpd is fixing drift.
@@ -135,9 +138,11 @@ void do_gettimeofday(struct timeval *tv)
be found. Note when you fix it here you need to do the same in arch/x86_64/kernel/vsyscall.c and export all needed variables in vmlinux.lds. -AK */
- usec += do_gettimeoffset();
-
- } while (read_seqretry(&xtime_lock, seq));
+ rdtscll(t);
+ usec += (((t - pcpu->last_tsc) *
+ pcpu->tsc_nsquot) >> NS_SCALE) / NSEC_PER_USEC;
+ } while (read_seqretry(&vxtime.vx_seq, seq));
+ preempt_enable();
tv->tv_sec = sec + usec / USEC_PER_SEC;
tv->tv_usec = usec % USEC_PER_SEC;
@@ -624,10 +629,17 @@ #endif
cpufreq_scale(loops_per_jiffy_ref, ref_freq, freq->new);
cpu_khz = cpufreq_scale(cpu_khz_ref, ref_freq, freq->new);
- if (!(freq->flags & CPUFREQ_CONST_LOOPS))
+ if (!(freq->flags & CPUFREQ_CONST_LOOPS)) {
vxtime.tsc_quot = (USEC_PER_MSEC << US_SCALE) / cpu_khz;
+
+ vxtime.pcpu[freq->cpu].tsc_nsquot =
+ (NSEC_PER_SEC << NS_SCALE)
+ / (cpufreq_scale(cpu_khz_ref, ref_freq, freq->new) *
+ NSEC_PER_USEC);
+ vxtime_update_pcpu();
+ }
}
-
+
set_cyc2ns_scale(cpu_khz_ref);
return 0;@@ -887,6 +899,9 @@ time_cpu_notifier(struct notifier_block
void __init time_init(void)
{
+ char *timename;
+ int i;
+
if (nohpet) vxtime.hpet_address = 0;
@@ -931,13 +946,17 @@ #endif
#ifndef CONFIG_SMP time_init_gtod();
#endif
+
+ for (i = 0; i < NR_CPUS; i++)
+ vxtime.pcpu[i].tsc_nsquot = (NSEC_PER_SEC << NS_SCALE)
+ / (cpu_khz * NSEC_PER_USEC);
}
/*
* Make an educated guess if the TSC is trustworthy and synchronized
* over all CPUs.
*/
-__cpuinit int unsynchronized_tsc(void)
+int unsynchronized_tsc(void)
{
#ifdef CONFIG_SMP
if (apic_is_clustered_box())
arch/x86_64/kernel/vmlinux.lds.S +3 -3
@@ -96,9 +96,6 @@ #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET .xtime_lock : AT(VLOAD(.xtime_lock)) { *(.xtime_lock) } xtime_lock = VVIRT(.xtime_lock); - .vxtime : AT(VLOAD(.vxtime)) { *(.vxtime) } - vxtime = VVIRT(.vxtime); - .vgetcpu_mode : AT(VLOAD(.vgetcpu_mode)) { *(.vgetcpu_mode) } vgetcpu_mode = VVIRT(.vgetcpu_mode);
@@ -119,6 +116,9 @@ #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET .vsyscall_2 ADDR(.vsyscall_0) + 2048: AT(VLOAD(.vsyscall_2)) { *(.vsyscall_2) } .vsyscall_3 ADDR(.vsyscall_0) + 3072: AT(VLOAD(.vsyscall_3)) { *(.vsyscall_3) } + .vxtime : AT(VLOAD(.vxtime)) { *(.vxtime) } + vxtime = VVIRT(.vxtime); + . = VSYSCALL_VIRT_ADDR + 4096;
#undef VSYSCALL_ADDR
arch/x86_64/kernel/vsyscall.c +0 -0
@@ -27,6 +27,8 @@ #include <linux/seqlock.h>
#include <linux/jiffies.h>
#include <linux/sysctl.h>
#include <linux/getcpu.h>
+#include <linux/smp.h>
+#include <linux/kthread.h>
#include <asm/vsyscall.h>
#include <asm/pgtable.h>
@@ -37,6 +39,9 @@ #include <asm/io.h>
#include <asm/segment.h>
#include <asm/desc.h>
#include <asm/topology.h>
+#include <asm/smp.h>
+#include <asm/idle.h>
+#include <asm/proto.h>
#define __vsyscall(nr) __attribute__ ((unused,__section__(".vsyscall_" #nr)))
@@ -46,6 +51,11 @@ int __vgetcpu_mode __section_vgetcpu_mod
#include <asm/unistd.h>
+#define NS_SCALE 10
+#define NSEC_PER_TICK (NSEC_PER_SEC / HZ)
+
+long vgetcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache); +
static __always_inline void timeval_normalize(struct timeval * tv)
{
time_t __sec;
@@ -57,35 +67,116 @@ static __always_inline void timeval_norm
}
}+static inline int _vgetcpu(void)
+{
+ int cpu;
+
+ vgetcpu(&cpu, NULL, NULL);
+ return (cpu);
+}
+
static __always_inline void do_vgettimeofday(struct timeval * tv)
{
long sequence, t;
unsigned long sec, usec;+ int cpu;
do {- sequence = read_seqbegin(&__xtime_lock);
-
- sec = __xtime.tv_sec;
- usec = __xtime.tv_nsec / 1000;
-
- if (__vxtime.mode != VXTIME_HPET) {
- t = get_cycles_sync();
- if (t < __vxtime.last_tsc)
- t = __vxtime.last_tsc;
- usec += ((t - __vxtime.last_tsc) *
- __vxtime.tsc_quot) >> 32;
- /* See comment in x86_64 do_gettimeofday. */
- } else {
- usec += ((readl((void __iomem *)
- fix_to_virt(VSYSCALL_HPET) + 0xf0) -
- __vxtime.last) * __vxtime.quot) >> 32;
- }
- } while (read_seqretry(&__xtime_lock, sequence));
+ sequence = read_seqbegin(&__vxtime.vx_seq);
+ cpu = _vgetcpu();
+
+ sec = __vxtime.pcpu[cpu].tv_sec;
+ usec = __vxtime.pcpu[cpu].tv_usec;
+ rdtscll(t);
+
+ usec += (((t - __vxtime.pcpu[cpu].last_tsc) *
+ __vxtime.pcpu[cpu].tsc_nsquot) >> NS_SCALE) / NSEC_PER_USEC;
+ /*
+ * If we get a context switch while here, the seq lock will
+ * change, and we'll have to retry.
+ */
+ } while (read_seqretry(&__vxtime.vx_seq, sequence));
+
+ tv->tv_sec = sec + usec / USEC_PER_SEC;
+ tv->tv_usec = usec % USEC_PER_SEC;
+}
+
+void vxtime_update_pcpu(void)
+{
+ unsigned long flags, offset, seq;
+ struct vxtime_pcpu *pcpu;
+
+ write_seqlock_irqsave(&vxtime.vx_seq, flags);
+ pcpu = read_pda(vxtime);
+
+ do {
+ seq = read_seqbegin(&xtime_lock);
+ pcpu->tv_sec = xtime.tv_sec;
+ pcpu->tv_usec = xtime.tv_nsec / 1000;
+ offset = hpet_readl(HPET_COUNTER) - vxtime.last;
+ } while (read_seqretry(&xtime_lock, seq));
- tv->tv_sec = sec + usec / 1000000;
- tv->tv_usec = usec % 1000000;
+ pcpu->tv_usec += (offset * vxtime.quot) >> 32;
+ pcpu->last_tsc = get_cycles_sync();
+
+ write_sequnlock_irqrestore(&vxtime.vx_seq, flags);
}
+static void _vxtime_update_pcpu(void *arg)
+{
+ vxtime_update_pcpu();
+}
+
+static int vxtime_periodic(void *arg)
+{
+ while (1) {
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(msecs_to_jiffies(1000));
+
+ smp_call_function(_vxtime_update_pcpu, NULL, 1, 1);
+ _vxtime_update_pcpu(NULL);
+ }
+
+ return (0); /* NOTREACHED */
+}
+
+void clock_was_set(void)
+{
+ smp_call_function(_vxtime_update_pcpu, NULL, 1, 1);
+ _vxtime_update_pcpu(NULL);
+}
+
+static int vxtime_pcpu_idle_notify(struct notifier_block *self,
+ unsigned long action, void *arg)
+{
+ if (action == IDLE_END)
+ vxtime_update_pcpu();
+
+ return (0);
+}
+
+static struct notifier_block vxtime_pcpu_idle_nb = {
+ .notifier_call = vxtime_pcpu_idle_notify,
+};
+
+static __init int vxtime_init_pcpu(void)
+{
+ seqlock_init(&vxtime.vx_seq);
+
+ /*
+ * Don't bother updating the per-cpu data after each HLT
+ * if we don't need to.
+ */
+ if (!unsynchronized_tsc())
+ idle_notifier_register(&vxtime_pcpu_idle_nb);
+
+ kthread_create(vxtime_periodic, NULL, "vxtime_periodic");
+
+ return (0);
+}
+
+core_initcall(vxtime_init_pcpu);
+
/* RED-PEN may want to readd seq locking, but then the variable should be write-once. */ static __always_inline void do_get_tz(struct timezone * tz)
{
include/asm-x86_64/pda.h +0 -0
@@ -7,6 +7,8 @@ #include <linux/types.h>
#include <linux/cache.h>
#include <asm/page.h>
+struct vxtime_pcpu;
+
/* Per processor datastructure. %gs points to it while the kernel runs */ struct x8664_pda {
struct task_struct *pcurrent; /* 0 Current process */
@@ -29,6 +31,7 @@ #endif
short isidle; struct mm_struct *active_mm; unsigned apic_timer_irqs;
+ struct vxtime_pcpu *vxtime;
} ____cacheline_aligned_in_smp;
extern struct x8664_pda *_cpu_pda[];
include/asm-x86_64/proto.h +0 -0
@@ -49,6 +49,7 @@ extern unsigned long long monotonic_base
extern int sysctl_vsyscall;
extern int nohpet;
extern unsigned long vxtime_hz;
+extern unsigned long hpet_tick;
extern void time_init_gtod(void);
extern void early_printk(const char *fmt, ...) __attribute__((format(printf,1,2)));
include/asm-x86_64/timex.h +0 -0
@@ -46,4 +46,6 @@ #define ARCH_HAS_READ_CURRENT_TIMER 1
extern struct vxtime_data vxtime;
+void clock_was_set(void);
+
#endif
include/asm-x86_64/vsyscall.h +0 -0
@@ -30,6 +30,13 @@ #define VXTIME_PMTMR 3
#define VGETCPU_RDTSCP 1
#define VGETCPU_LSL 2
+struct vxtime_pcpu {
+ time_t tv_sec;
+ long tv_usec;
+ unsigned long tsc_nsquot;
+ unsigned long last_tsc;
+};
+
struct vxtime_data {
long hpet_address; /* HPET base address */
int last;
@@ -37,6 +44,8 @@ struct vxtime_data {
long quot;
long tsc_quot;
int mode;+ seqlock_t vx_seq;
+ struct vxtime_pcpu pcpu[NR_CPUS] ____cacheline_aligned;
};
#define hpet_readl(a) readl((const void __iomem *)fix_to_virt(FIX_HPET_BASE) + a)
@@ -61,7 +70,10 @@ extern int sysctl_vsyscall;
extern void vsyscall_set_cpu(int cpu);
+void vxtime_update_pcpu(void);
+
#define ARCH_HAVE_XTIME_LOCK 1
+#define ARCH_HAVE_CLOCK_WAS_SET 1
#endif /* __KERNEL__ */
include/linux/hrtimer.h +0 -0
@@ -95,12 +95,14 @@ struct hrtimer_base {
struct lock_class_key lock_key; };
+#ifndef ARCH_HAVE_CLOCK_WAS_SET
/*
* clock_was_set() is a NOP for non- high-resolution systems. The
* time-sorted order guarantees that a timer does not expire early and
* is expired in the next softirq when the clock was advanced. */
#define clock_was_set() do { } while (0)
+#endif
/* Exported timer functions: */
Quoted 6 lines · Suleiman Souhlal
Hi,
Here are the fixes from the previous version:
- Remove usage of preempt_disable/enable() indo_gettimeoday(), since the above fix make it
unnecessary.
Oops, this is not actually in the patch, because the preempt_disable()/enable() are still needed.
The patch I sent out is correct.
-- Suleiman
Re: [PATCH 1/1] Make the TSC safe to be used by gettimeofday().
In reply to Suleiman SouhlalQuoted 9 lines · Suleiman Souhlal
This is done by a per-cpu vxtime structure that stores the last TSC and HPET values.
Whenever we switch to a userland process after a HLT instruction has been executed or after the CPU frequency has changed, we force a new read of the TSC, HPET and xtime so that we know the correct frequency we have to deal with.
We also force a resynch once every second, on every CPU.
Hmm, not sure we want to do it this way. Especially since you got unsolved races. But patch review ignoring the 10k foot picture again.
Review
Quoted 6 lines
static void
default_idle(void)
{(quoted diff) +4
-0+ int cpu; + + cpu = smp_processor_id(); +
This is not used?
Review
Quoted 13 lines
(quoted diff) +13
-0+ + /* + * If we are switching away from a process in vsyscall, touch + * the vxtime seq lock so that userland is aware that a context switch + * has happened. + */ + rip = *(unsigned long *)(prev->rsp0 + + offsetof(struct user_regs_struct, rip) - sizeof(struct pt_regs)); + if (unlikely(rip > VSYSCALL_START) && unlikely(rip < VSYSCALL_END)) { + write_seqlock(&vxtime.vx_seq); + write_sequnlock(&vxtime.vx_seq); + } +
Can't this starve? If a process is unlucky enough (e.g. from lots of interrupts) that it can't go through the vsyscall without at least one context switch it will never finish. Ok maybe it's an unlikely enough livelock, but it still makes me uncomfortable.
unlikely should be normally top level in the condition.
It would need to be rip >=
There's a macro to hide the rip lookup
Review void do_gettimeofday(struct timeval *tv) · line 141
Quoted 8 lines
(quoted diff) +1
-3@@ -135,9 +138,11 @@ void do_gettimeofday(struct timeval *tv) be found. Note when you fix it here you need to do the same in arch/x86_64/kernel/vsyscall.c and export all needed variables in vmlinux.lds. -AK */ - usec += do_gettimeoffset(); - - } while (read_seqretry(&xtime_lock, seq)); + rdtscll(t);
Not calling do_gettimeoffset anymore?
This means notsc won't work anymore. And the CPUID sync is also gone
arch/x86_64/kernel/vmlinux.lds.S #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET · line 120
Quoted 13 lines
arch/x86_64/kernel/vmlinux.lds.S +2
-3- .vxtime : AT(VLOAD(.vxtime)) { *(.vxtime) } - vxtime = VVIRT(.vxtime); - .vgetcpu_mode : AT(VLOAD(.vgetcpu_mode)) { *(.vgetcpu_mode) } vgetcpu_mode = VVIRT(.vgetcpu_mode);@@ -119,6 +116,9 @@ #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET .vsyscall_2 ADDR(.vsyscall_0) + 2048: AT(VLOAD(.vsyscall_2)) { *(.vsyscall_2) } .vsyscall_3 ADDR(.vsyscall_0) + 3072: AT(VLOAD(.vsyscall_3)) { *(.vsyscall_3) } + .vxtime : AT(VLOAD(.vxtime)) { *(.vxtime) } + vxtime = VVIRT(.vxtime);
Why did you move it?
Review #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET · line 121
Quoted 1 line
(quoted diff) +1
-0+long vgetcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache);
externs in c code are still forbidden, even if they don't have extern
Review #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET · line 122
Quoted 1 line
(quoted diff) +0
-0static __always_inline void do_vgettimeofday(struct timeval * tv)
Has similar problems are the in kernel gtod
Review #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET
Quoted 11 lines
(quoted diff) +11
-0+static int vxtime_periodic(void *arg) +{ + while (1) { + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(msecs_to_jiffies(1000)); + + smp_call_function(_vxtime_update_pcpu, NULL, 1, 1); + _vxtime_update_pcpu(NULL); + } + + return (0); /* NOTREACHED */
I don't see why this should be a thread and not a timer? Threads are expensive and there are already too many
Review
Quoted 10 lines
(quoted diff) +10
-0+ +static __init int vxtime_init_pcpu(void) +{ + seqlock_init(&vxtime.vx_seq); + + /* + * Don't bother updating the per-cpu data after each HLT + * if we don't need to. + */ + if (!unsynchronized_tsc())
So why did you drop the __cpuinit for unsynchronized_tsc if it's only called from __init?
-Andi
Re: [PATCH 1/1] Make the TSC safe to be used by gettimeofday().
Quoted 10 lines · Andi Kleen
Quoted 8 lines · Suleiman Souhlal
This is done by a per-cpu vxtime structure that stores the last TSC and HPET values.
Whenever we switch to a userland process after a HLT instruction has been executed or after the CPU frequency has changed, we force a new read of the TSC, HPET and xtime so that we know the correct frequency we have to deal with.
Quoted 6 lines
Quoted 1 line
We also force a resynch once every second, on every CPU.
Hmm, not sure we want to do it this way. Especially since you got unsolved races. But patch review ignoring the 10k foot picture again.
Which unresolved races?
The reason why I do a resynch every CPU is to prevent the HPET timer from rolling over more than once before reading it again, which could happen if the CPU doesn't go into HLT for a long time.
Quoted 8 lines
Quoted 8 lines
(quoted diff) +8
-0+ + /* + * If we are switching away from a process in vsyscall, touch + * the vxtime seq lock so that userland is aware that a context switch + * has happened. + */ + rip = *(unsigned long *)(prev->rsp0 + + offsetof(struct user_regs_struct, rip) - sizeof(struct pt_regs));
Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ if (unlikely(rip > VSYSCALL_START) && unlikely(rip < VSYSCALL_END)) { + write_seqlock(&vxtime.vx_seq); + write_sequnlock(&vxtime.vx_seq); + } +Can't this starve? If a process is unlucky enough (e.g. from lots of interrupts) that it can't go through the vsyscall without at least one context switch it will never finish. Ok maybe it's an unlikely enough livelock, but it still makes me uncomfortable.
I could make it fall back to a full syscall after a certain number of tries. This, coupled with using a preemption count instead of touching the seq lock should prevent the livelock (because if we don't touch the seq lock in switch_to the livelock would not be possible in the full gettimeofday() syscall).
Quoted 12 lines
Quoted 12 lines
arch/x86_64/kernel/vmlinux.lds.S +0
-3- .vxtime : AT(VLOAD(.vxtime)) { *(.vxtime) } - vxtime = VVIRT(.vxtime); - .vgetcpu_mode : AT(VLOAD(.vgetcpu_mode)) { *(.vgetcpu_mode) } vgetcpu_mode = VVIRT(.vgetcpu_mode);@@ -119,6 +116,9 @@ #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET .vsyscall_2 ADDR(.vsyscall_0) + 2048: AT(VLOAD(.vsyscall_2)) { *(.vsyscall_2) } .vsyscall_3 ADDR(.vsyscall_0) + 3072: AT(VLOAD(.vsyscall_3)) { *(.vsyscall_3) }
Quoted 5 lines
arch/x86_64/kernel/vmlinux.lds.S #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET · line 120
Quoted 2 lines
arch/x86_64/kernel/vmlinux.lds.S +2
-0+ .vxtime : AT(VLOAD(.vxtime)) { *(.vxtime) } + vxtime = VVIRT(.vxtime);Why did you move it?
Because otherwise .jiffies (IIRC) collides with .vsyscall_0.
Quoted 6 lines
Review #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET · line 121
Quoted 2 lines
(quoted diff) +1
-0+long vgetcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache);externs in c code are still forbidden, even if they don't have extern
This is just a forward declaration, but I'll get rid of it anyway.
Thanks a lot for the feedback.
I'll try to address these issues and send and a fixed patch.
-- Suleiman