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-devel

[Xen-devel] [Patch] Fix up Xsave in pv_cpuid()

To: Keir Fraser <keir@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [Patch] Fix up Xsave in pv_cpuid()
From: Haitao Shan <maillists.shan@xxxxxxxxx>
Date: Sat, 8 Oct 2011 11:35:59 +0800
Cc:
Delivery-date: Fri, 07 Oct 2011 20:37:07 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=sWBa42qYiS++YpX3IG8Wh1w84Mp957vBBg+CKAon80k=; b=j0tAaJSfLYlohCO0p56foKJ8NxUqF/1ld5hHA+LA0Z1/JMOrEX5Hwqa1ZxvhqlncDu CfB8m2bvmHjK+acKcgL9/74z1v7y1aLBCrSoDpyIlaqRz9fw8RZNW/0l6o4/NMqjajKq 4NJgxLCz5HvL/nUowxQKSA/Hv1wvyKJRpJdzs=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi, Keir,

This patch will fix wrong logic in determining Xsave return value in pv_cpuid().
I am sorry I made some mistakes in my last patch.

Signed-off-by:  Shan Haitao <haitao.shan@xxxxxxxxx>


diff -r 2dab09bcec81 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      Sun Sep 18 00:25:57 2011 +0100
+++ b/xen/arch/x86/traps.c      Sat Oct 08 04:24:40 2011 +0800
@@ -768,16 +768,18 @@ static void pv_cpuid(struct cpu_user_reg

     if ( current->domain->domain_id != 0 )
     {
+        unsigned int cpuid_leaf = a, sub_leaf = c;
+
         if ( !cpuid_hypervisor_leaves(a, c, &a, &b, &c, &d) )
             domain_cpuid(current->domain, a, c, &a, &b, &c, &d);

-        switch ( a )
+        switch ( cpuid_leaf )
         {
         case 0xd:
         {
-            unsigned int sub_leaf, _eax, _ebx, _ecx, _edx;
+            unsigned int _eax, _ebx, _ecx, _edx;
             /* EBX value of main leaf 0 depends on enabled xsave features */
-            if ( c == 0 && current->arch.xcr0 )
+            if ( sub_leaf == 0 && current->arch.xcr0 )
             {
                 /* reset EBX to default value first */
                 b = XSTATE_AREA_MIN_SIZE;
@@ -785,8 +787,8 @@ static void pv_cpuid(struct cpu_user_reg
                 {
                     if ( !(current->arch.xcr0 & (1ULL << sub_leaf)) )
                         continue;
-                    domain_cpuid(current->domain, a, c, &_eax, &_ebx, &_ecx,
-                                 &_edx);
+                    domain_cpuid(current->domain, cpuid_leaf, sub_leaf,
+                                 &_eax, &_ebx, &_ecx, &_edx);
                     if ( (_eax + _ebx) > b )
                         b = _eax + _ebx;
                 }

Attachment: pv_cpuid_xsave_fix.patch
Description: Binary data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [Patch] Fix up Xsave in pv_cpuid(), Haitao Shan <=