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

[Xen-API] [PATCH] CA-38844: Add support for Intel FlexMigration on Nehal

To: xen-api <xen-api@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-API] [PATCH] CA-38844: Add support for Intel FlexMigration on Nehalem/Westmere
From: Rob Hoes <rob.hoes@xxxxxxxxxx>
Date: Thu, 8 Apr 2010 17:20:04 +0100
Delivery-date: Thu, 08 Apr 2010 09:22:19 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Rob Hoes <rob.hoes@xxxxxxxxxx>
CA-38844: Add support for Intel FlexMigration on Nehalem/Westmere

Note: this patch should go in together with the flex-maskability patch in 
xen-api.hg.

Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx>

diff -r b4c441b39984 cpuid/cpuid.ml
--- a/cpuid/cpuid.ml    Wed Apr 07 11:57:42 2010 +0100
+++ b/cpuid/cpuid.ml    Thu Apr 08 13:37:38 2010 +0100
@@ -23,6 +23,7 @@
 (* === Types and conversion === *)
 
 type manufacturer = AMD | Intel | Unknown
+and maskability = No | Base | Full
 and features =
        {
                base_ecx: int32;
@@ -38,7 +39,7 @@
                stepping: int32;
                features: features;
                physical_features: features;
-               maskable: bool;
+               maskable: maskability;
        }
 
 let features_to_string f =
@@ -109,23 +110,31 @@
 (* Does this Intel CPU support "FlexMigration"? 
  * It's not sensibly documented, so check by model *)
 let has_flexmigration family model stepping = 
-       family > 0x6l || (model > 0x17l || (model = 0x17l && stepping >= 4l))
+       if family <> 0x6l then
+               No
+       else if model = 0x1dl || (model = 0x17l && stepping >= 4l) then
+               Base
+       else if (model = 0x1al && stepping > 2l) ||
+               model = 0x1el || model = 0x25l || model = 0x2cl ||
+               model = 0x2el || model = 0x2fl then
+               Full
+       else
+               No
 
 (* Does this AMD CPU have Extended Migration Technology? 
  * Known good on Barcelona and better; did exist on some older CPUs 
  * but not really documented which ones *)
 let has_emt family = 
-       family >= 0x10l
+       if family >= 0x10l then
+               Full
+       else
+               No
        
 let is_maskable manufacturer family model stepping =
        match manufacturer with 
-       | Unknown -> false
-       | Intel ->
-               if has_flexmigration family model stepping then true
-               else false
-       | AMD ->
-               if has_emt family then true
-               else false
+       | Unknown -> No
+       | Intel -> has_flexmigration family model stepping
+       | AMD -> has_emt family
 
 let get_features_from_xen () =
        let features = 
@@ -193,29 +202,25 @@
        (* Manufacturers need to be the same *)
        if manufacturer != cpu.manufacturer then 
                raise ManufacturersDiffer;
-       (* Check whether masking is supported on the CPU *)
-       if not cpu.maskable then 
+       (* Check whether the features can be obtained by masking the physical 
features *)
+       let base = (logand cpu.physical_features.base_ecx features.base_ecx) = 
features.base_ecx 
+               && (logand cpu.physical_features.base_edx features.base_edx) = 
features.base_edx in
+       match cpu.maskable with
+       | No ->
                begin match cpu.manufacturer with 
                | Unknown -> raise (MaskingNotSupported "Unknown CPU 
manufacturer")
                | Intel -> raise (MaskingNotSupported "CPU does not have 
FlexMigration")
                | AMD -> raise (MaskingNotSupported "CPU does not have Extended 
Migration Technology")
-               end;
-       (* Check whether the features can be obtained by masking the physical 
features *)
-       let possible = (logand cpu.physical_features.base_ecx 
features.base_ecx) = features.base_ecx 
-               && (logand cpu.physical_features.base_edx features.base_edx) = 
features.base_edx
-               && begin match manufacturer with 
-               | Intel ->
-                       (* Intel can't mask extented features but doesn't (yet) 
need to *)
-                       cpu.physical_features.ext_ecx = features.ext_ecx
-                               && cpu.physical_features.ext_edx = 
features.ext_edx
-               | AMD ->
-                       (logand cpu.physical_features.ext_ecx features.ext_ecx) 
= features.ext_ecx 
-                               && (logand cpu.physical_features.ext_edx 
features.ext_edx) = features.ext_edx
-               | _ -> false
                end
-       in
-       if not possible then
-               raise (InvalidFeatureString "CPU features cannot be masked to 
obtain given features")
+       | Base ->
+               if not (base && cpu.physical_features.ext_ecx = features.ext_ecx
+                       && cpu.physical_features.ext_edx = features.ext_edx) 
then
+                       raise (InvalidFeatureString "CPU features cannot be 
masked to obtain \
+                               given features (only base features can be 
masked)")
+       | Full ->
+               if not (base && (logand cpu.physical_features.ext_ecx 
features.ext_ecx) = features.ext_ecx 
+                       && (logand cpu.physical_features.ext_edx 
features.ext_edx) = features.ext_edx) then
+                       raise (InvalidFeatureString "CPU features cannot be 
masked to obtain given features")
 
 let xen_masking_string cpu features = 
        let rec stringify reglist = 
diff -r b4c441b39984 cpuid/cpuid.mli
--- a/cpuid/cpuid.mli   Wed Apr 07 11:57:42 2010 +0100
+++ b/cpuid/cpuid.mli   Thu Apr 08 13:37:38 2010 +0100
@@ -21,6 +21,12 @@
 | Intel                (** Intel *)
 | Unknown      (** Other manufacturer *)
 
+(** Indicates whether CPUID features can be masked. *)
+and maskability =
+| No           (** No masking possible *)
+| Base         (** Only base features can be masked *)
+| Full         (** Both base and extended features can be masked *)
+
 (** CPU feature bit vector. *)
 and features
 
@@ -33,7 +39,7 @@
                stepping: int32;                                (** Stepping 
number of the CPU *)
                features: features;                             (** Feature bit 
vector of the CPU *)
                physical_features: features;    (** Physical Feature bit vector 
of the CPU *)
-               maskable: bool;                                 (** Boolean 
indicating whether the CPU supports
+               maskable: maskability;                  (** Indicates whether 
the CPU supports
                                                                                
Intel FlexMigration or AMD Extended Migration,
                                                                                
or cannot be masked *)
        }

Attachment: flexmigration
Description: Text document

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] [PATCH] CA-38844: Add support for Intel FlexMigration on Nehalem/Westmere, Rob Hoes <=