2003-01-16 00:12:27

by john stultz

[permalink] [raw]
Subject: [PATCH][RESEND] linux-2.5.58_timer-tsc-cleanup_A0

Linus, All,
This patch cleans up the timer_tsc code, removing the unused use_tsc
variable and making fast_gettimeoffset_quotient static.

Please apply.

thanks
-john


diff -Nru a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
--- a/arch/i386/kernel/smpboot.c Wed Jan 15 15:54:11 2003
+++ b/arch/i386/kernel/smpboot.c Wed Jan 15 15:54:11 2003
@@ -182,8 +182,6 @@

#define NR_LOOPS 5

-extern unsigned long fast_gettimeoffset_quotient;
-
/*
* accurate 64-bit/32-bit division, expanded to 32-bit divisions and 64-bit
* multiplication. Not terribly optimized but we need it at boot time only
@@ -223,7 +221,8 @@

printk("checking TSC synchronization across %u CPUs: ", num_booting_cpus());

- one_usec = ((1<<30)/fast_gettimeoffset_quotient)*(1<<2);
+ /* convert from kcyc/sec to cyc/usec */
+ one_usec = cpu_khz / 1000;

atomic_set(&tsc_start_flag, 1);
wmb();
diff -Nru a/arch/i386/kernel/timers/timer_tsc.c b/arch/i386/kernel/timers/timer_tsc.c
--- a/arch/i386/kernel/timers/timer_tsc.c Wed Jan 15 15:54:11 2003
+++ b/arch/i386/kernel/timers/timer_tsc.c Wed Jan 15 15:54:11 2003
@@ -18,7 +18,6 @@

extern spinlock_t i8253_lock;

-static int use_tsc;
/* Number of usecs that the last interrupt was delayed */
static int delay_at_last_interrupt;

@@ -29,7 +28,7 @@
* Equal to 2^32 * (1 / (clocks per usec) ).
* Initialized in time_init.
*/
-unsigned long fast_gettimeoffset_quotient;
+static unsigned long fast_gettimeoffset_quotient;

static unsigned long get_offset_tsc(void)
{
@@ -277,7 +276,6 @@
unsigned long tsc_quotient = calibrate_tsc();
if (tsc_quotient) {
fast_gettimeoffset_quotient = tsc_quotient;
- use_tsc = 1;
/*
* We could be more selective here I suspect
* and just enable this for the next intel chips ?




2003-01-18 02:46:10

by Rusty Russell

[permalink] [raw]
Subject: Re: [PATCH][RESEND] linux-2.5.58_timer-tsc-cleanup_A0

In message <[email protected]> you write:
> Linus, All,
> This patch cleans up the timer_tsc code, removing the unused use_tsc
> variable and making fast_gettimeoffset_quotient static.

But use_tsc is still used:

static int
time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
void *data)
{

....

#ifndef CONFIG_SMP
if (use_tsc) {
fast_gettimeoffset_quotient = cpufreq_scale(fast_gettimeoffset_ref, freq->new, ref_freq);
cpu_khz = cpufreq_scale(cpu_khz_ref, ref_freq, freq->new);
}
#endif


And almost any patch to the x86 boot code is too convoluted to be
"trivial" IMHO.

Sorry,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

2003-01-18 02:59:48

by john stultz

[permalink] [raw]
Subject: Re: [PATCH][RESEND] linux-2.5.58_timer-tsc-cleanup_A0

On Fri, 2003-01-17 at 17:48, Rusty Russell wrote:
> In message <[email protected]> you write:
> > Linus, All,
> > This patch cleans up the timer_tsc code, removing the unused use_tsc
> > variable and making fast_gettimeoffset_quotient static.
>
> But use_tsc is still used:

Yep, this was pointed out earlier today. My bad. The cpu_freq updates
that went in a tad bit less then 2 weeks ago slipped it in and I just
didn't notice. I apologize. Thanks for looking at it, though.

>
> And almost any patch to the x86 boot code is too convoluted to be
> "trivial" IMHO.

Ok, sounds fair.

Thanks
-john