WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] x86: add volatile prefix for cpuid asm cl

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86: add volatile prefix for cpuid asm clauses
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Sun, 20 Mar 2011 06:40:17 +0000
Delivery-date: Sat, 19 Mar 2011 23:41:15 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Wei Gang <gang.wei@xxxxxxxxx>
# Date 1300122282 0
# Node ID 9a15ff175e0040d1ff1d568683c177d2b5d3ae27
# Parent  56dc6032b45febdb37034bfa14bbd4657bc23af4
x86: add volatile prefix for cpuid asm clauses

cpuid results are possible to be changed now. For example, changing
CR4.OSXSAVE bit or setting MSR XCR_XFEATURE_ENABLED_MASK may change
XSAVE related cpuid leave return values.

The volatile prefix is required to avoid the second cpuid calls
following some possible changing operations being optimized in
incorrect way by compiler.

The sample bug is in xsave_init while debug=3Dn. The second call to
cpuid_count() may be optimized and lead to a BUG_ON case while compare
xsave_cntxt_size with ebx.

Signed-off-by: Wei Gang <gang.wei@xxxxxxxxx>
---


diff -r 56dc6032b45f -r 9a15ff175e00 xen/include/asm-x86/processor.h
--- a/xen/include/asm-x86/processor.h   Mon Mar 14 17:02:50 2011 +0000
+++ b/xen/include/asm-x86/processor.h   Mon Mar 14 17:04:42 2011 +0000
@@ -223,7 +223,7 @@
  * resulting in stale register contents being returned.
  */
 #define cpuid(_op,_eax,_ebx,_ecx,_edx)          \
-    asm ( "cpuid"                               \
+    asm volatile ( "cpuid"                      \
           : "=a" (*(int *)(_eax)),              \
             "=b" (*(int *)(_ebx)),              \
             "=c" (*(int *)(_ecx)),              \
@@ -239,7 +239,7 @@
     unsigned int *ecx,
     unsigned int *edx)
 {
-    asm ( "cpuid"
+    asm volatile ( "cpuid"
           : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
           : "0" (op), "c" (count) );
 }
@@ -251,7 +251,7 @@
 {
     unsigned int eax;
 
-    asm ( "cpuid"
+    asm volatile ( "cpuid"
           : "=a" (eax)
           : "0" (op)
           : "bx", "cx", "dx" );
@@ -262,7 +262,7 @@
 {
     unsigned int eax, ebx;
 
-    asm ( "cpuid"
+    asm volatile ( "cpuid"
           : "=a" (eax), "=b" (ebx)
           : "0" (op)
           : "cx", "dx" );
@@ -273,7 +273,7 @@
 {
     unsigned int eax, ecx;
 
-    asm ( "cpuid"
+    asm volatile ( "cpuid"
           : "=a" (eax), "=c" (ecx)
           : "0" (op)
           : "bx", "dx" );
@@ -284,7 +284,7 @@
 {
     unsigned int eax, edx;
 
-    asm ( "cpuid"
+    asm volatile ( "cpuid"
           : "=a" (eax), "=d" (edx)
           : "0" (op)
           : "bx", "cx" );

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86: add volatile prefix for cpuid asm clauses, Xen patchbot-unstable <=