[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-API] [PATCH] # HG changeset patch
# HG changeset patch # User Rob Hoes <rob.hoes@xxxxxxxxxx> # HG changeset patch # User Rob Hoes <rob.hoes@xxxxxxxxxx> CP-1652: Cpuid modules gets physical and current CPU features from Xen Previously, the physical features were kept in a file in dom0 on first boot. This is not very robust, so now all physical and current CPU features come directly from Xen via a hypercall. Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx> diff -r 55a40dacee4c Makefile.in --- a/Makefile.in Wed Feb 24 10:29:26 2010 +0000 +++ b/Makefile.in Wed Feb 24 14:16:47 2010 +0000 @@ -31,7 +31,6 @@ endif $(MAKE) -C forking_executioner $(MAKE) -C mlvm - $(MAKE) -C cpuid $(MAKE) -C xen-utils .PHONY: allxen @@ -43,6 +42,7 @@ $(MAKE) -C xs $(MAKE) -C xsrpc $(MAKE) -C eventchn + $(MAKE) -C cpuid endif install: @@ -69,7 +69,6 @@ endif $(MAKE) -C forking_executioner install $(MAKE) -C mlvm install - $(MAKE) -C cpuid install $(MAKE) -C xen-utils install installxen: @@ -80,6 +79,7 @@ $(MAKE) -C xs install $(MAKE) -C xsrpc install $(MAKE) -C eventchn install + $(MAKE) -C cpuid install endif uninstall: @@ -106,7 +106,6 @@ endif $(MAKE) -C forking_executioner uninstall $(MAKE) -C mlvm uninstall - $(MAKE) -C cpuid uninstall $(MAKE) -C xen-utils uninstall uninstallxen: @@ -117,6 +116,7 @@ $(MAKE) -C xb uninstall $(MAKE) -C xc uninstall $(MAKE) -C mmap uninstall + $(MAKE) -C cpuid uninstall endif bins: diff -r 55a40dacee4c cpuid/META.in --- a/cpuid/META.in Wed Feb 24 10:29:26 2010 +0000 +++ b/cpuid/META.in Wed Feb 24 14:16:47 2010 +0000 @@ -1,5 +1,5 @@ version = "@VERSION@" description = "Cpuid extension" -requires = "" +requires = "stdext xc xen-utils" archive(byte) = "cpuid.cma" archive(native) = "cpuid.cmxa" diff -r 55a40dacee4c cpuid/Makefile --- a/cpuid/Makefile Wed Feb 24 10:29:26 2010 +0000 +++ b/cpuid/Makefile Wed Feb 24 14:16:47 2010 +0000 @@ -2,7 +2,7 @@ CFLAGS = -Wall -fPIC -O2 -I/opt/xensource/lib/ocaml -I$(XEN_ROOT)/usr/include OCAMLC = ocamlc -g OCAMLOPT = ocamlopt -INCLUDES = -I ../stdext +INCLUDES = -I ../stdext -I ../xc -I ../xen-utils LDFLAGS = -cclib -L./ @@ -65,8 +65,8 @@ .PHONY: doc doc: $(INTF) - python ../doc/doc.py $(DOCDIR) "cpuid" "package" "$(OBJS)" "." "stdext" "" + python ../doc/doc.py $(DOCDIR) "cpuid" "package" "$(OBJS)" "." "stdext xc xen-utils" "" clean: - rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS) + rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS) *~ *.rej diff -r 55a40dacee4c cpuid/cpuid.ml --- a/cpuid/cpuid.ml Wed Feb 24 10:29:26 2010 +0000 +++ b/cpuid/cpuid.ml Wed Feb 24 14:16:47 2010 +0000 @@ -127,21 +127,44 @@ if has_emt family then true else false -let get_physical_features features = - let features_file = "/var/xapi/features" in - try - let data = Unixext.read_whole_file_to_string features_file in - string_to_features data - with _ -> - let data = features_to_string features in - Unixext.write_string_to_file features_file data; - features - +let get_features_from_xen () = + let features = Xc.with_intf (fun xc -> Xc.get_boot_cpufeatures xc) in + match features with + | base_ecx, base_edx, ext_ecx, ext_edx, + masked_base_ecx, masked_base_edx, masked_ext_ecx, masked_ext_edx -> + { + base_ecx = masked_base_ecx; + base_edx = masked_base_edx; + ext_ecx = masked_ext_ecx; + ext_edx = masked_ext_edx + }, + { + base_ecx = base_ecx; + base_edx = base_edx; + ext_ecx = ext_ecx; + ext_edx = ext_edx + } + +let get_current_mask () = + let masks = Xen_cmdline.list_cpuid_masks () in + let get_mask m = + if List.mem_assoc m masks = false then + 0xffffffffl + else + Int32.of_string (List.assoc m masks) + in + { + base_ecx = get_mask "cpuid_mask_ecx"; + base_edx = get_mask "cpuid_mask_edx"; + ext_ecx = get_mask "cpuid_mask_ext_ecx"; + ext_edx = get_mask "cpuid_mask_ext_edx" + } + let read_cpu_info () = let manufacturer = read_manufacturer () in let family = read_family () in let model = read_model () in - let features = read_features () in + let features, phy_features = get_features_from_xen () in let stepping = read_stepping () in { manufacturer = manufacturer; @@ -149,7 +172,7 @@ model = model; stepping = stepping; features = features; - physical_features = get_physical_features features; + physical_features = phy_features; maskable = is_maskable manufacturer family model stepping; } Attachment:
phy-features _______________________________________________ xen-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |