2006-08-25 16:43:53

by Toyo Abe

[permalink] [raw]
Subject: [PATCH -mm] x86_64: Adjust the timing of initializing cyc2ns_scale.

The x86_64-mm-monotonic-clock.patch in 2.6.18-rc4-mm2 made a change to
the updating of monotonic_base. It now uses cycles_2_ns().

I suggest that a set_cyc2ns_scale() should be done prior to the setup_irq().
Because cycles_2_ns() can be called from the timer ISR right after the irq0
is enabled.


Signed-off-by: Toyo Abe <[email protected]>

---

arch/x86_64/kernel/time.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index 5bbd05d..03ddc1a 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -928,10 +928,10 @@ #endif
vxtime.quot = (USEC_PER_SEC << US_SCALE) / vxtime_hz;
vxtime.tsc_quot = (USEC_PER_MSEC << US_SCALE) / cpu_khz;
vxtime.last_tsc = get_cycles_sync();
- setup_irq(0, &irq0);
-
set_cyc2ns_scale(cpu_khz);

+ setup_irq(0, &irq0);
+
hotcpu_notifier(time_cpu_notifier, 0);
time_cpu_notifier(NULL, CPU_ONLINE, (void *)(long)smp_processor_id());


2006-08-25 16:56:05

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH -mm] x86_64: Adjust the timing of initializing cyc2ns_scale.

On Friday 25 August 2006 18:45, Toyo Abe wrote:
> The x86_64-mm-monotonic-clock.patch in 2.6.18-rc4-mm2 made a change to
> the updating of monotonic_base. It now uses cycles_2_ns().
>
> I suggest that a set_cyc2ns_scale() should be done prior to the setup_irq().
> Because cycles_2_ns() can be called from the timer ISR right after the irq0
> is enabled.

Added thanks. I folded it into the original patch.

Did you actually see a failure or was this just from code review?
-Andi

2006-08-25 17:14:48

by Toyo Abe

[permalink] [raw]
Subject: Re: [PATCH -mm] x86_64: Adjust the timing of initializing cyc2ns_scale.

From: Andi Kleen <[email protected]>
Subject: Re: [PATCH -mm] x86_64: Adjust the timing of initializing cyc2ns_scale.
Date: Fri, 25 Aug 2006 18:55:57 +0200

> On Friday 25 August 2006 18:45, Toyo Abe wrote:
> > The x86_64-mm-monotonic-clock.patch in 2.6.18-rc4-mm2 made a change to
> > the updating of monotonic_base. It now uses cycles_2_ns().
> >
> > I suggest that a set_cyc2ns_scale() should be done prior to the setup_irq().
> > Because cycles_2_ns() can be called from the timer ISR right after the irq0
> > is enabled.
>
> Added thanks. I folded it into the original patch.
>
> Did you actually see a failure or was this just from code review?
> -Andi
>
I didn't see any failure on it. It was just a speculation. But I think
it's better thing here.

Best Regards,
toyo