All of lore.kernel.org
 help / color / mirror / Atom feed
* patch for P4 TSC problem
@ 2003-12-04  8:47 Li, Shaohua
  2003-12-04 18:23 ` Dominik Brodowski
  0 siblings, 1 reply; 2+ messages in thread
From: Li, Shaohua @ 2003-12-04  8:47 UTC (permalink / raw)
  To: cpufreq

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

Hi,

TSC frequency doesn't change under P4 and above when CPU frequency
changes, which caused some problems. Attached patch will handle this
problem. How about it?

 

Thanks,

Shaohua

 


[-- Attachment #2: tsc.patch --]
[-- Type: application/octet-stream, Size: 1394 bytes --]

--- a/arch/i386/timers/timer_tsc.c	2003-11-25 17:54:06.000000000 +0800
+++ b/arch/i386/timers/timer_tsc.c	2003-11-27 13:15:32.000000000 +0800
@@ -33,6 +33,7 @@
 extern volatile unsigned long jiffies;
 
 static int use_tsc;
+static int variable_tsc_freq = 1;
 /* Number of usecs that the last interrupt was delayed */
 static int delay_at_last_interrupt;
 
@@ -336,7 +337,8 @@
 		cpu_data[freq->cpu].loops_per_jiffy = cpufreq_scale(loops_per_jiffy_ref, ref_freq, freq->new);
 #ifndef CONFIG_SMP
 		if (use_tsc) {
-			fast_gettimeoffset_quotient = cpufreq_scale(fast_gettimeoffset_ref, freq->new, ref_freq);
+			if (variable_tsc_freq)
+				fast_gettimeoffset_quotient = cpufreq_scale(fast_gettimeoffset_ref, freq->new, ref_freq);
 			cpu_khz = cpufreq_scale(cpu_khz_ref, ref_freq, freq->new);
 			set_cyc2ns_scale(cpu_khz/1000);
 		}
@@ -352,6 +354,13 @@
 };
 #endif
 
+static void __init init_variable_tsc(void)
+{
+	/* P4 and above CPU TSC freq doesn't change when CPU frequency changes*/
+	if ((boot_cpu_data.x86 >= 15) && (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL))
+		variable_tsc_freq = 0;
+	/* Add support for CPU from non-intel vendor */
+}
 
 static int __init init_tsc(char* override)
 {
@@ -442,6 +451,7 @@
 				printk("Detected %lu.%03lu MHz processor.\n", cpu_khz / 1000, cpu_khz % 1000);
 			}
 			set_cyc2ns_scale(cpu_khz/1000);
+			init_variable_tsc();
 			return 0;
 		}
 	}

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Cpufreq mailing list
Cpufreq@www.linux.org.uk
http://www.linux.org.uk/mailman/listinfo/cpufreq

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-12-04 18:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-04  8:47 patch for P4 TSC problem Li, Shaohua
2003-12-04 18:23 ` Dominik Brodowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.