xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86, cpuidle: remove assertion on X86_FEATURE_TSC_RELIABLE
@ 2011-05-13  2:45 Tian, Kevin
  2011-05-13  5:55 ` Keir Fraser
  0 siblings, 1 reply; 14+ messages in thread
From: Tian, Kevin @ 2011-05-13  2:45 UTC (permalink / raw)
  To: xen devel

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

x86, cpuidle: remove assertion on X86_FEATURE_TSC_RELIABLE

23228:1329d99b4f16 disables deep cstate to avoid restoring tsc when
tsc msr is not writtable on some old platform, which however also
adds an assertion on X86_FEATURE_TSC_RELIABLE in cstate_restore_tsc.
The two don't match as tsc writtable-ness has nothing to do with
whether it's reliable. As long as Xen can use tsc as the time source
and it's writable, it should be OK to continue using deep cstate
with tsc save/restore.

Also mark tsc as reliable for X86_FEATURE_CONSTANT_TSC.

Without this fix, one of our platform hits the assertion which 
only has constant tsc feature.

Signed-off-by: Kevin Tian <kevin.tian@intel.com>

diff -r 0c446850d85e xen/arch/x86/cpu/intel.c
--- a/xen/arch/x86/cpu/intel.c	Wed May 11 12:58:04 2011 +0100
+++ b/xen/arch/x86/cpu/intel.c	Fri May 13 10:01:20 2011 +0800
@@ -221,8 +221,10 @@
 	if (c->x86 == 6) 
 		set_bit(X86_FEATURE_P3, c->x86_capability);
 	if ((c->x86 == 0xf && c->x86_model >= 0x03) ||
-		(c->x86 == 0x6 && c->x86_model >= 0x0e))
+		(c->x86 == 0x6 && c->x86_model >= 0x0e)) {
 		set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability);
+		set_bit(X86_FEATURE_TSC_RELIABLE, c->x86_capability);
+	}
 	if (cpuid_edx(0x80000007) & (1u<<8)) {
 		set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability);
 		set_bit(X86_FEATURE_NONSTOP_TSC, c->x86_capability);
diff -r 0c446850d85e xen/arch/x86/time.c
--- a/xen/arch/x86/time.c	Wed May 11 12:58:04 2011 +0100
+++ b/xen/arch/x86/time.c	Fri May 13 10:01:20 2011 +0800
@@ -686,8 +686,6 @@
     if ( boot_cpu_has(X86_FEATURE_NONSTOP_TSC) )
         return;
 
-    ASSERT(boot_cpu_has(X86_FEATURE_TSC_RELIABLE));
-
     write_tsc(stime2tsc(read_platform_stime()));
 }


[-- Attachment #2: 20100513_cpuidle_tsc_reliable.patch --]
[-- Type: application/octet-stream, Size: 1712 bytes --]

x86, cpuidle: remove assertion on X86_FEATURE_TSC_RELIABLE

23228:1329d99b4f16 disables deep cstate to avoid restoring tsc when
tsc msr is not writtable on some old platform, which however also
adds an assertion on X86_FEATURE_TSC_RELIABLE in cstate_restore_tsc.
The two don't match as tsc writtable-ness has nothing to do with
whether it's reliable. As long as Xen can use tsc as the time source
and it's writable, it should be OK to continue using deep cstate
with tsc save/restore.

Also mark tsc as reliable for X86_FEATURE_CONSTANT_TSC.

Without this fix, one of our platform hits the assertion which 
only has constant tsc feature.

Signed-off-by: Kevin Tian <kevin.tian@intel.com>

diff -r 0c446850d85e xen/arch/x86/cpu/intel.c
--- a/xen/arch/x86/cpu/intel.c	Wed May 11 12:58:04 2011 +0100
+++ b/xen/arch/x86/cpu/intel.c	Fri May 13 10:01:20 2011 +0800
@@ -221,8 +221,10 @@
 	if (c->x86 == 6) 
 		set_bit(X86_FEATURE_P3, c->x86_capability);
 	if ((c->x86 == 0xf && c->x86_model >= 0x03) ||
-		(c->x86 == 0x6 && c->x86_model >= 0x0e))
+		(c->x86 == 0x6 && c->x86_model >= 0x0e)) {
 		set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability);
+		set_bit(X86_FEATURE_TSC_RELIABLE, c->x86_capability);
+	}
 	if (cpuid_edx(0x80000007) & (1u<<8)) {
 		set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability);
 		set_bit(X86_FEATURE_NONSTOP_TSC, c->x86_capability);
diff -r 0c446850d85e xen/arch/x86/time.c
--- a/xen/arch/x86/time.c	Wed May 11 12:58:04 2011 +0100
+++ b/xen/arch/x86/time.c	Fri May 13 10:01:20 2011 +0800
@@ -686,8 +686,6 @@
     if ( boot_cpu_has(X86_FEATURE_NONSTOP_TSC) )
         return;
 
-    ASSERT(boot_cpu_has(X86_FEATURE_TSC_RELIABLE));
-
     write_tsc(stime2tsc(read_platform_stime()));
 }
 

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

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

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

end of thread, other threads:[~2011-05-17  7:58 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-13  2:45 [PATCH] x86, cpuidle: remove assertion on X86_FEATURE_TSC_RELIABLE Tian, Kevin
2011-05-13  5:55 ` Keir Fraser
2011-05-13  6:01   ` Tian, Kevin
2011-05-13  7:14   ` Jan Beulich
2011-05-13  7:28     ` Tian, Kevin
2011-05-13  8:17       ` Jan Beulich
2011-05-13  8:29     ` Keir Fraser
2011-05-13  8:49       ` Tian, Kevin
2011-05-13  9:15         ` Keir Fraser
2011-05-13  9:42           ` Jan Beulich
2011-05-17  0:51           ` Tian, Kevin
2011-05-13 17:16         ` Dan Magenheimer
2011-05-17  0:50           ` Tian, Kevin
2011-05-17  7:58             ` Keir Fraser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).