Hello community,
here is the log from the commit of package xen for openSUSE:Factory checked in at 2012-02-10 17:20:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/xen (Old)
and /work/SRC/openSUSE:Factory/.xen.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "xen", Maintainer is "CARNOLD@suse.com"
Changes:
--------
--- /work/SRC/openSUSE:Factory/xen/xen.changes 2011-12-06 13:54:10.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.xen.new/xen.changes 2012-02-10 17:20:57.000000000 +0100
@@ -1,0 +2,367 @@
+Thu Feb 2 17:11:28 MST 2012 - jfehlig@suse.com
+
+- bnc#743414 - using vifname is ignored when defining a xen virtual
+ interface with xl/libxl
+ 24459-libxl-vifname.patch
+
+-------------------------------------------------------------------
+Thu Feb 2 09:21:01 MST 2012 - carnold@novell.com
+
+- bnc#740165 - VUL-0: kvm: qemu heap overflow in e1000 device
+ emulation (applicable to Xen qemu - CVE-2012-0029)
+ cve-2012-0029-qemu-xen-unstable.patch
+
+-------------------------------------------------------------------
+Wed Feb 1 08:26:58 MST 2012 - carnold@novell.com
+
+- bnc#744014 - blank screen in SLES11 SP2 guest with a VF statically
+ assigned
+ ioemu-MSI-X-fix-unregister_iomem.patch
+- Upstream patches from Jan
+ 24453-x86-vIRQ-IRR-TMR-race.patch
+ 24456-x86-emul-lea.patch
+
+-------------------------------------------------------------------
+Thu Jan 26 15:18:54 CET 2012 - ohering@suse.de
+
+- fate#310510 - fix xenpaging
+ 24586-x86-mm_Properly_account_for_paged_out_pages.patch
+ 24609-tools-libxc_handle_fallback_in_linux_privcmd_map_foreign_bulk_properly.patch
+ 24610-xenpaging_make_file_op_largefile_aware.patch
+ xen-unstable.misc.linux_privcmd_map_foreign_bulk.retry_paged.patch
+ xenpaging.speedup-page-out.resume_pages.find_next_bit_set.patch
+ xenpaging.speedup-page-out.evict_pages.free_slot_stack.patch
+ xenpaging.speedup-page-out.policy_choose_victim.patch
+ update xenpaging.error-handling.patch, flush qemu cache not so often
+
+-------------------------------------------------------------------
+Thu Jan 26 13:24:22 CET 2012 - ohering@suse.de
+
+- fate#310510 - fix xenpaging
+ 24566-tools-libxc_fix_error_handling_in_xc_mem_paging_load.patch
+
+-------------------------------------------------------------------
+Tue Jan 24 15:43:27 CET 2012 - ohering@suse.de
+
+- fate#310510 - fix xenpaging
+ 24466-libxc_Only_retry_mapping_pages_when_ENOENT_is_returned.patch
+
+-------------------------------------------------------------------
+Mon Jan 23 13:41:42 MST 2012 - carnold@novell.com
+
+- The xen kmp packages fail on the 09-check-packaged-twice script.
+ Rename xen_pvdrivers.conf to xen_pvdrivers-<kernel flavor>.conf
+
+-------------------------------------------------------------------
+Fri Jan 20 21:28:42 CET 2012 - ohering@suse.de
+
+- fate#310510 - fix xenpaging
+ xenpaging.speedup-page-in.gfn_to_slot.patch
+
+-------------------------------------------------------------------
+Wed Jan 18 09:42:54 MST 2012 - carnold@novell.com
+
+- bnc#739585 - L3: Xen block-attach fails after repeated attach/detach
+ blktap-close-fifos.patch
+ blktap-disable-debug-printf.patch
+
+-------------------------------------------------------------------
+Fri Jan 13 10:37:53 MST 2012 - jfehlig@suse.com
+
+- bnc#741159 - Fix default setting of XENSTORED_ROOTDIR in
+ xencommons init script
+ xencommons-xenstored-root.patch
+
+-------------------------------------------------------------------
+Thu Jan 12 06:49:57 MST 2012 - carnold@novell.com
+
+- bnc#740625 - xen: cannot interact with xend after upgrade (SLES)
+- bnc#738694 - xen: cannot interact with xend after upgrade (os12.1)
+- Other README changes included.
+ README.SuSE
+
+-------------------------------------------------------------------
+Tue Jan 10 17:30:20 CET 2012 - ohering@suse.de
+
+- bnc#694863 - kexec fails in xen
+ 24478-libxl_add_feature_flag_to_xenstore_for_XS_RESET_WATCHES.patch
+
+-------------------------------------------------------------------
+Mon Jan 9 16:10:19 CET 2012 - ohering@suse.de
+
+- fate#310510 - fix xenpaging
+ xenpaging.speedup-page-out.patch
+
+-------------------------------------------------------------------
+Tue Jan 3 08:26:42 MST 2012 - carnold@novell.com
+
+- bnc#735806 - VF doesn't work after hot-plug for many times
+ 24448-x86-pt-irq-leak.patch
+- Upstream patches from Jan
+ 24261-x86-cpuidle-Westmere-EX.patch
+ 24417-amd-erratum-573.patch
+ 24429-mceinj-tool.patch
+ 24447-x86-TXT-INIT-SIPI-delay.patch
+ ioemu-9868-MSI-X.patch
+
+-------------------------------------------------------------------
+Mon Jan 2 10:05:57 CET 2012 - ohering@suse.de
+
+- bnc#732884 - remove private runlevel 4 from init scripts
+ xen.no-default-runlevel-4.patch
+
+-------------------------------------------------------------------
+Mon Dec 19 15:22:13 MST 2011 - carnold@novell.com
+
+- bnc#727515 - Fragmented packets hang network boot of HVM guest
+ ipxe-gcc45-warnings.patch
+ ipxe-ipv4-fragment.patch
+ ipxe-enable-nics.patch
+
+-------------------------------------------------------------------
+Mon Dec 19 12:43:11 CET 2011 - ohering@suse.de
+
+- fate#310510 - fix xenpaging
+ update xenpaging.autostart.patch, make changes with mem-swap-target
+ permanent
+ update xenpaging.doc.patch, mention issues with live migration
+
+-------------------------------------------------------------------
+Thu Dec 15 17:53:51 CET 2011 - ohering@suse.de
+
+- fate#310510 - fix xenpaging
+ add xenpaging.evict_mmap_readonly.patch
+ update xenpaging.error-handling.patch, reduce debug output
+
+-------------------------------------------------------------------
+Thu Dec 15 08:35:27 MST 2011 - carnold@novell.com
+
+- bnc#736824 - Microcode patches for AMD's 15h processors panic the
+ system
+ 24189-x86-p2m-pod-locking.patch
+ 24412-x86-AMD-errata-model-shift.patch
+ 24411-x86-ucode-AMD-Fam15.patch
+
+-------------------------------------------------------------------
+Wed Dec 14 10:08:24 MST 2011 - carnold@novell.com
+
+- bnc#711219 - SR-IOV VF doesn't work in SLES11 sp2 guest
+ 24357-firmware-no-_PS0-_PS3.patch
+- Upstream patches from Jan
+ 24153-x86-emul-feature-checks.patch
+ 24275-x86-emul-lzcnt.patch
+ 24277-x86-dom0-features.patch
+ 24278-x86-dom0-no-PCID.patch
+ 24282-x86-log-dirty-bitmap-leak.patch
+ 24359-x86-domU-features.patch
+ 24360-x86-pv-domU-no-PCID.patch
+ 24389-amd-fam10-gart-tlb-walk-err.patch
+ 24391-x86-pcpu-version.patch
+
+-------------------------------------------------------------------
+Thu Dec 8 14:19:49 CET 2011 - ohering@suse.de
+
+- bnc#729208 - xenpaging=-1 doesn't work
+ xenpaging.doc.patch
+
+-------------------------------------------------------------------
+Thu Dec 8 08:41:36 CET 2011 - ohering@suse.de
+
+- fate#310510 - fix xenpaging
+ readd xenpaging.qemu.flush-cache.patch
+
+-------------------------------------------------------------------
+Wed Dec 7 11:01:43 MST 2011 - jfehlig@suse.com
+
+- bnc#732782 - L3: xm create hangs when maxmen value is enclosed
+ in "quotes"
+ xm-create-maxmem.patch
+
+-------------------------------------------------------------------
+Wed Dec 7 10:44:06 MST 2011 - carnold@novell.com
+
+- Upstream patches / changes from Jan
+ Added 24358-kexec-compat-overflow.patch
+ Removed 24341-x86-64-mmcfg_remove___initdata_annotation_overlooked_in_23749e8d1c8f074ba.patch
+ Removed 24345-tools-libxc_Fix_x86_32_build_breakage_in_previous_changeset..patch
+
+-------------------------------------------------------------------
+Wed Dec 7 16:42:44 CET 2011 - ohering@suse.de
+
+- fate#310510 - fix xenpaging
+ 24178-debug_Add_domain-vcpu_pause_count_info_to_d_key..patch
+ Use wait queues for paging, improve foreign mappings.
+ xenpaging.versioned-interface.patch
+ xenpaging.mmap-before-nominate.patch
+ xenpaging.p2m_is_paged.patch
+ xenpaging.evict_fail_fast_forward.patch
++++ 170 more lines (skipped)
++++ between /work/SRC/openSUSE:Factory/xen/xen.changes
++++ and /work/SRC/openSUSE:Factory/.xen.new/xen.changes
Old:
----
tools-gdbserver-build.diff
xenpaging.HVMCOPY_gfn_paged_out.patch
xenpaging.XEN_PAGING_DIR.patch
xenpaging.add_evict_pages.patch
xenpaging.bitmap_clear.patch
xenpaging.cmdline-interface.patch
xenpaging.encapsulate_domain_info.patch
xenpaging.file_op-return-code.patch
xenpaging.install-to-libexec.patch
xenpaging.low_target_policy_nomru.patch
xenpaging.main-loop-exit-handling.patch
xenpaging.misleading-comment.patch
xenpaging.page_in-munmap-size.patch
xenpaging.print-gfn.patch
xenpaging.record-numer-paged-out-pages.patch
xenpaging.reset-uncomsumed.patch
xenpaging.stale-comments.patch
xenpaging.target-tot_pages.patch
xenpaging.use-PERROR.patch
xenpaging.watch-target-tot_pages.patch
xenpaging.watch_event-DPRINTF.patch
xenpaging.xc_interface_open-comment.patch
New:
----
23949-constify_vcpu_set_affinitys_second_parameter.patch
24104-waitqueue_Double_size_of_x86_shadow_stack..patch
24105-xenpaging_compare_domain_pointer_in_p2m_mem_paging_populate.patch
24106-mem_event_check_capabilities_only_once.patch
24138-xenpaging_munmap_all_pages_after_page-in.patch
24153-x86-emul-feature-checks.patch
24171-x86waitqueue_Allocate_whole_page_for_shadow_stack..patch
24178-debug_Add_domain-vcpu_pause_count_info_to_d_key..patch
24189-x86-p2m-pod-locking.patch
24190-hap-log-dirty-disable-rc.patch
24193-hap-track-dirty-vram-rc.patch
24195-waitqueue_Detect_saved-stack_overflow_and_crash_the_guest..patch
24196-waitqueue_Reorder_prepare_to_wait_so_that_vcpu_is_definitely_on_the.patch
24197-x86-waitqueue_Because_we_have_per-cpu_stacks_we_must_wake_up_on_teh.patch
24201-x86-pcpu-platform-op.patch
24208-xenpaging_remove_filename_from_comment.patch
24209-xenpaging_remove_obsolete_comment_in_resume_path.patch
24210-xenpaging_use_PERROR_to_print_errno.patch
24211-xenpaging_simplify_file_op.patch
24212-xenpaging_print_gfn_in_failure_case.patch
24213-xenpaging_update_xenpaging_init.patch
24214-xenpaging_remove_xc_dominfo_t_from_paging_t.patch
24215-xenpaging_track_the_number_of_paged-out_pages.patch
24216-xenpaging_move_page_add-resume_loops_into_its_own_function..patch
24217-xenpaging_improve_mainloop_exit_handling.patch
24218-libxc_add_bitmap_clear_function.patch
24219-xenpaging_retry_unpageable_gfns.patch
24220-xenpaging_install_into_LIBEXEC_dir.patch
24221-xenpaging_add_XEN_PAGING_DIR_-_libxl_xenpaging_dir_path.patch
24222-xenpaging_use_guests_tot_pages_as_working_target.patch
24223-xenpaging_watch_the_guests_memory-target-tot_pages_xenstore_value.patch
24224-xenpaging_add_cmdline_interface_for_pager.patch
24225-xenpaging_improve_policy_mru_list_handling.patch
24226-xenpaging_add_debug_to_show_received_watch_event..patch
24227-xenpaging_restrict_pagefile_permissions.patch
24231-waitqueue_Implement_wake_up_nroneall..patch
24232-waitqueue_Hold_a_reference_to_a_domain_on_a_waitqueue..patch
24261-x86-cpuidle-Westmere-EX.patch
24269-mem_event_move_mem_event_domain_out_of_struct_domain.patch
24270-Free_d-mem_event_on_domain_destruction..patch
24272-xenpaging_Fix_c-s_235070a29c8c3ddf7_update_machine_to_phys_mapping_during_page_deallocation.patch
24275-x86-emul-lzcnt.patch
24277-x86-dom0-features.patch
24278-x86-dom0-no-PCID.patch
24282-x86-log-dirty-bitmap-leak.patch
24318-x86-mm_Fix_checks_during_foreign_mapping_of_paged_pages.patch
24327-After_preparing_a_page_for_page-in_allow_immediate_fill-in_of_the_page_contents.patch
24328-Tools_Libxc_wrappers_to_automatically_fill_in_page_oud_page_contents_on_prepare.patch
24329-Teach_xenpaging_to_use_the_new_and_non-racy_xc_mem_paging_load_interface.patch
24344-tools-x86_64_Fix_cpuid_inline_asm_to_not_clobber_stacks_red_zone.patch
24357-firmware-no-_PS0-_PS3.patch
24358-kexec-compat-overflow.patch
24359-x86-domU-features.patch
24360-x86-pv-domU-no-PCID.patch
24389-amd-fam10-gart-tlb-walk-err.patch
24391-x86-pcpu-version.patch
24411-x86-ucode-AMD-Fam15.patch
24412-x86-AMD-errata-model-shift.patch
24417-amd-erratum-573.patch
24429-mceinj-tool.patch
24447-x86-TXT-INIT-SIPI-delay.patch
24448-x86-pt-irq-leak.patch
24453-x86-vIRQ-IRR-TMR-race.patch
24456-x86-emul-lea.patch
24459-libxl-vifname.patch
24466-libxc_Only_retry_mapping_pages_when_ENOENT_is_returned.patch
24478-libxl_add_feature_flag_to_xenstore_for_XS_RESET_WATCHES.patch
24566-tools-libxc_fix_error_handling_in_xc_mem_paging_load.patch
24586-x86-mm_Properly_account_for_paged_out_pages.patch
24609-tools-libxc_handle_fallback_in_linux_privcmd_map_foreign_bulk_properly.patch
24610-xenpaging_make_file_op_largefile_aware.patch
blktap-close-fifos.patch
blktap-disable-debug-printf.patch
cve-2012-0029-qemu-xen-unstable.patch
ioemu-9868-MSI-X.patch
ioemu-MSI-X-fix-unregister_iomem.patch
ipxe-enable-nics.patch
ipxe-gcc45-warnings.patch
ipxe-ipv4-fragment.patch
xen-unstable.misc.linux_privcmd_map_foreign_bulk.retry_paged.patch
xen.no-default-runlevel-4.patch
xencommons-xenstored-root.patch
xenpaging.doc.patch
xenpaging.error-handling.patch
xenpaging.evict_fail_fast_forward.patch
xenpaging.evict_mmap_readonly.patch
xenpaging.mem_event-use-wait_queue.patch
xenpaging.mmap-before-nominate.patch
xenpaging.p2m_is_paged.patch
xenpaging.qemu.flush-cache.patch
xenpaging.speedup-page-in.gfn_to_slot.patch
xenpaging.speedup-page-out.evict_pages.free_slot_stack.patch
xenpaging.speedup-page-out.patch
xenpaging.speedup-page-out.policy_choose_victim.patch
xenpaging.speedup-page-out.resume_pages.find_next_bit_set.patch
xenpaging.versioned-interface.patch
xenpaging.waitqueue-paging.patch
xm-create-maxmem.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ xen.spec ++++++
--- /var/tmp/diff_new_pack.TAjBgX/_old 2012-02-10 17:21:08.000000000 +0100
+++ /var/tmp/diff_new_pack.TAjBgX/_new 2012-02-10 17:21:08.000000000 +0100
@@ -1,7 +1,7 @@
#
# spec file for package xen
#
-# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -15,9 +15,6 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
-# norootforbuild
-
-
Name: xen
ExclusiveArch: %ix86 x86_64
%define xvers 4.1
@@ -52,6 +49,7 @@
BuildRequires: dev86
BuildRequires: graphviz
BuildRequires: latex2html
+BuildRequires: libbz2-devel
BuildRequires: libjpeg-devel
BuildRequires: libxml2-devel
BuildRequires: ncurses-devel
@@ -61,7 +59,6 @@
BuildRequires: python-devel
BuildRequires: texinfo
BuildRequires: transfig
-BuildRequires: libbz2-devel
%if %suse_version >= 1120
BuildRequires: xz-devel
%endif
@@ -81,9 +78,11 @@
%ifarch x86_64
%if %{?with_gcc46}0
BuildRequires: gcc46
-BuildRequires: libgcc46 libgcc46-32bit
+BuildRequires: libgcc46
+BuildRequires: libgcc46-32bit
%endif
-BuildRequires: glibc-32bit glibc-devel-32bit
+BuildRequires: glibc-32bit
+BuildRequires: glibc-devel-32bit
BuildRequires: gcc-32bit
BuildRequires: gcc43-32bit
%define max_cpus 256
@@ -94,15 +93,17 @@
%endif
BuildRequires: glibc-devel
%if %{?with_kmp}0
-BuildRequires: kernel-source kernel-syms module-init-tools xorg-x11
+BuildRequires: kernel-source
+BuildRequires: kernel-syms
+BuildRequires: module-init-tools
+BuildRequires: xorg-x11
%endif
-Version: 4.1.2_08
-Release: 1
-License: GPLv2+
-Group: System/Kernel
-AutoReqProv: on
+Version: 4.1.2_13
+Release: 0
PreReq: %insserv_prereq %fillup_prereq
Summary: Xen Virtualization: Hypervisor (aka VMM aka Microkernel)
+License: GPL-2.0+
+Group: System/Kernel
Source0: xen-4.1.2-testing-src.tar.bz2
Source1: stubdom.tar.bz2
Source2: xen-utils-0.1.tar.bz2
@@ -257,6 +258,7 @@
Patch23925: 23925-x86-AMD-ARAT-Fam12.patch
Patch23933: 23933-pt-bus2bridge-update.patch
Patch23943: 23943-xenpaging_clear_page_content_after_evict.patch
+Patch23949: 23949-constify_vcpu_set_affinitys_second_parameter.patch
Patch23953: 23953-xenpaging_handle_evict_failures.patch
Patch23955: 23955-x86-pv-cpuid-xsave.patch
Patch23957: 23957-cpufreq-error-paths.patch
@@ -264,17 +266,90 @@
Patch23979: 23979-xenpaging_document_p2m_mem_paging_functions.patch
Patch23980: 23980-xenpaging_disallow_paging_in_a_PoD_guest.patch
Patch23993: 23993-x86-microcode-amd-fix-23871.patch
+Patch24104: 24104-waitqueue_Double_size_of_x86_shadow_stack..patch
+Patch24105: 24105-xenpaging_compare_domain_pointer_in_p2m_mem_paging_populate.patch
+Patch24106: 24106-mem_event_check_capabilities_only_once.patch
Patch24116: 24116-x86-continuation-cancel.patch
Patch24123: 24123-x86-cpuidle-quiesce.patch
Patch24124: 24124-x86-microcode-amd-quiesce.patch
Patch24137: 24137-revert-23666.patch
+Patch24138: 24138-xenpaging_munmap_all_pages_after_page-in.patch
Patch24144: 24144-cpufreq-turbo-crash.patch
Patch24148: 24148-shadow-pgt-dying-op-performance.patch
+Patch24153: 24153-x86-emul-feature-checks.patch
Patch24155: 24155-x86-ioapic-EOI-after-migration.patch
Patch24156: 24156-x86-ioapic-shared-vectors.patch
Patch24157: 24157-x86-xstate-init.patch
Patch24168: 24168-x86-vioapic-clear-remote_irr.patch
+Patch24171: 24171-x86waitqueue_Allocate_whole_page_for_shadow_stack..patch
+Patch24178: 24178-debug_Add_domain-vcpu_pause_count_info_to_d_key..patch
+Patch24189: 24189-x86-p2m-pod-locking.patch
+Patch24190: 24190-hap-log-dirty-disable-rc.patch
+Patch24193: 24193-hap-track-dirty-vram-rc.patch
+Patch24195: 24195-waitqueue_Detect_saved-stack_overflow_and_crash_the_guest..patch
+Patch24196: 24196-waitqueue_Reorder_prepare_to_wait_so_that_vcpu_is_definitely_on_the.patch
+Patch24197: 24197-x86-waitqueue_Because_we_have_per-cpu_stacks_we_must_wake_up_on_teh.patch
+Patch24201: 24201-x86-pcpu-platform-op.patch
+Patch24208: 24208-xenpaging_remove_filename_from_comment.patch
+Patch24209: 24209-xenpaging_remove_obsolete_comment_in_resume_path.patch
+Patch24210: 24210-xenpaging_use_PERROR_to_print_errno.patch
+Patch24211: 24211-xenpaging_simplify_file_op.patch
+Patch24212: 24212-xenpaging_print_gfn_in_failure_case.patch
+Patch24213: 24213-xenpaging_update_xenpaging_init.patch
+Patch24214: 24214-xenpaging_remove_xc_dominfo_t_from_paging_t.patch
+Patch24215: 24215-xenpaging_track_the_number_of_paged-out_pages.patch
+Patch24216: 24216-xenpaging_move_page_add-resume_loops_into_its_own_function..patch
+Patch24217: 24217-xenpaging_improve_mainloop_exit_handling.patch
+Patch24218: 24218-libxc_add_bitmap_clear_function.patch
+Patch24219: 24219-xenpaging_retry_unpageable_gfns.patch
+Patch24220: 24220-xenpaging_install_into_LIBEXEC_dir.patch
+Patch24221: 24221-xenpaging_add_XEN_PAGING_DIR_-_libxl_xenpaging_dir_path.patch
+Patch24222: 24222-xenpaging_use_guests_tot_pages_as_working_target.patch
+Patch24223: 24223-xenpaging_watch_the_guests_memory-target-tot_pages_xenstore_value.patch
+Patch24224: 24224-xenpaging_add_cmdline_interface_for_pager.patch
+Patch24225: 24225-xenpaging_improve_policy_mru_list_handling.patch
+Patch24226: 24226-xenpaging_add_debug_to_show_received_watch_event..patch
+Patch24227: 24227-xenpaging_restrict_pagefile_permissions.patch
+Patch24231: 24231-waitqueue_Implement_wake_up_nroneall..patch
+Patch24232: 24232-waitqueue_Hold_a_reference_to_a_domain_on_a_waitqueue..patch
+Patch24261: 24261-x86-cpuidle-Westmere-EX.patch
+Patch24269: 24269-mem_event_move_mem_event_domain_out_of_struct_domain.patch
+Patch24270: 24270-Free_d-mem_event_on_domain_destruction..patch
+Patch24272: 24272-xenpaging_Fix_c-s_235070a29c8c3ddf7_update_machine_to_phys_mapping_during_page_deallocation.patch
+Patch24275: 24275-x86-emul-lzcnt.patch
+Patch24277: 24277-x86-dom0-features.patch
+Patch24278: 24278-x86-dom0-no-PCID.patch
+Patch24282: 24282-x86-log-dirty-bitmap-leak.patch
+Patch24318: 24318-x86-mm_Fix_checks_during_foreign_mapping_of_paged_pages.patch
+Patch24344: 24344-tools-x86_64_Fix_cpuid_inline_asm_to_not_clobber_stacks_red_zone.patch
+Patch24327: 24327-After_preparing_a_page_for_page-in_allow_immediate_fill-in_of_the_page_contents.patch
+Patch24328: 24328-Tools_Libxc_wrappers_to_automatically_fill_in_page_oud_page_contents_on_prepare.patch
+Patch24329: 24329-Teach_xenpaging_to_use_the_new_and_non-racy_xc_mem_paging_load_interface.patch
+Patch24357: 24357-firmware-no-_PS0-_PS3.patch
+Patch24358: 24358-kexec-compat-overflow.patch
+Patch24359: 24359-x86-domU-features.patch
+Patch24360: 24360-x86-pv-domU-no-PCID.patch
+Patch24389: 24389-amd-fam10-gart-tlb-walk-err.patch
+Patch24391: 24391-x86-pcpu-version.patch
+Patch24411: 24411-x86-ucode-AMD-Fam15.patch
+Patch24412: 24412-x86-AMD-errata-model-shift.patch
+Patch24417: 24417-amd-erratum-573.patch
+Patch24429: 24429-mceinj-tool.patch
+Patch24447: 24447-x86-TXT-INIT-SIPI-delay.patch
+Patch24448: 24448-x86-pt-irq-leak.patch
+Patch24453: 24453-x86-vIRQ-IRR-TMR-race.patch
+Patch24456: 24456-x86-emul-lea.patch
+Patch24459: 24459-libxl-vifname.patch
+Patch24466: 24466-libxc_Only_retry_mapping_pages_when_ENOENT_is_returned.patch
+Patch24478: 24478-libxl_add_feature_flag_to_xenstore_for_XS_RESET_WATCHES.patch
+Patch24566: 24566-tools-libxc_fix_error_handling_in_xc_mem_paging_load.patch
+Patch24586: 24586-x86-mm_Properly_account_for_paged_out_pages.patch
+Patch24609: 24609-tools-libxc_handle_fallback_in_linux_privcmd_map_foreign_bulk_properly.patch
+Patch24610: 24610-xenpaging_make_file_op_largefile_aware.patch
# Upstream qemu patches
+Patch100: ioemu-9868-MSI-X.patch
+Patch101: ioemu-MSI-X-fix-unregister_iomem.patch
+Patch102: cve-2012-0029-qemu-xen-unstable.patch
# Our patches
Patch300: xen-config.diff
Patch301: xend-config.diff
@@ -314,12 +389,11 @@
Patch352: blktap.patch
Patch353: xen-qemu-iscsi-fix.patch
Patch354: xen-api-auth.patch
-Patch355: tools-gdbserver-build.diff
-Patch356: ioemu-vnc-resize.patch
-Patch357: ioemu-debuginfo.patch
-Patch358: vif-bridge-no-iptables.patch
-Patch359: xenconsole-no-multiple-connections.patch
-Patch360: disable-xl-when-using-xend.patch
+Patch355: ioemu-vnc-resize.patch
+Patch356: ioemu-debuginfo.patch
+Patch357: vif-bridge-no-iptables.patch
+Patch358: xenconsole-no-multiple-connections.patch
+Patch359: disable-xl-when-using-xend.patch
# Needs to go upstream
Patch370: checkpoint-rename.patch
Patch371: xm-save-check-file.patch
@@ -331,8 +405,10 @@
Patch377: suspend_evtchn_lock.patch
Patch378: log-guest-console.patch
Patch379: xend-migration-domname-fix.patch
+Patch380: xm-create-maxmem.patch
# Sent upstream and tentatively ACK'ed, but not yet committed
-Patch380: 2XXXX-vif-bridge.patch
+Patch381: 2XXXX-vif-bridge.patch
+Patch382: xencommons-xenstored-root.patch
# Patches for snapshot support
Patch400: snapshot-ioemu-save.patch
Patch401: snapshot-ioemu-restore.patch
@@ -382,6 +458,11 @@
Patch457: xenstored.XS_RESET_WATCHES.patch
Patch458: xen-cpupool-xl-config-format.patch
Patch459: xl-create-pv-with-qcow2-img.patch
+Patch460: ipxe-gcc45-warnings.patch
+Patch461: ipxe-ipv4-fragment.patch
+Patch462: ipxe-enable-nics.patch
+Patch463: blktap-close-fifos.patch
+Patch464: blktap-disable-debug-printf.patch
# Jim's domain lock patch
Patch480: xend-domain-lock.patch
Patch481: xend-domain-lock-sfex.patch
@@ -403,30 +484,26 @@
Patch651: ioemu-disable-scsi.patch
Patch652: ioemu-disable-emulated-ide-if-pv.patch
Patch700: hv_extid_compatibility.patch
+Patch701: xen.no-default-runlevel-4.patch
# FATE 310510
-Patch1107: xenpaging.stale-comments.patch
-Patch1108: xenpaging.misleading-comment.patch
-Patch1109: xenpaging.use-PERROR.patch
-Patch1110: xenpaging.file_op-return-code.patch
-Patch1111: xenpaging.print-gfn.patch
-Patch1112: xenpaging.xc_interface_open-comment.patch
-Patch1113: xenpaging.encapsulate_domain_info.patch
-Patch1114: xenpaging.record-numer-paged-out-pages.patch
-Patch1115: xenpaging.add_evict_pages.patch
-Patch1116: xenpaging.main-loop-exit-handling.patch
-Patch1117: xenpaging.bitmap_clear.patch
-Patch1118: xenpaging.reset-uncomsumed.patch
-Patch1119: xenpaging.install-to-libexec.patch
-Patch1120: xenpaging.XEN_PAGING_DIR.patch
-Patch1121: xenpaging.target-tot_pages.patch
-Patch1122: xenpaging.watch-target-tot_pages.patch
-Patch1123: xenpaging.cmdline-interface.patch
-Patch1125: xenpaging.watch_event-DPRINTF.patch
+Patch1100: xenpaging.versioned-interface.patch
+Patch1101: xenpaging.mmap-before-nominate.patch
+Patch1102: xenpaging.p2m_is_paged.patch
+Patch1103: xenpaging.evict_fail_fast_forward.patch
+Patch1104: xenpaging.error-handling.patch
+Patch1105: xenpaging.mem_event-use-wait_queue.patch
+Patch1106: xenpaging.waitqueue-paging.patch
+Patch1107: xenpaging.evict_mmap_readonly.patch
Patch1126: xenpaging.guest-memusage.patch
-Patch1127: xenpaging.page_in-munmap-size.patch
-Patch1128: xenpaging.low_target_policy_nomru.patch
Patch1129: xenpaging.autostart.patch
-Patch1130: xenpaging.HVMCOPY_gfn_paged_out.patch
+Patch1130: xenpaging.doc.patch
+Patch1131: xenpaging.speedup-page-out.patch
+Patch1132: xenpaging.speedup-page-in.gfn_to_slot.patch
+Patch1134: xen-unstable.misc.linux_privcmd_map_foreign_bulk.retry_paged.patch
+Patch1135: xenpaging.speedup-page-out.resume_pages.find_next_bit_set.patch
+Patch1136: xenpaging.speedup-page-out.policy_choose_victim.patch
+Patch1137: xenpaging.speedup-page-out.evict_pages.free_slot_stack.patch
+Patch1142: xenpaging.qemu.flush-cache.patch
# xenalyze
Patch20000: xenalyze.gcc46.patch
# Build patch
@@ -494,11 +571,9 @@
...
%package libs
-License: GPLv2+
Summary: Xen Virtualization: Libraries
Group: System/Kernel
#Requires: xen = %{version}
-AutoReqProv: on
%description libs
Xen is a virtual machine monitor for x86 that supports execution of
@@ -546,7 +621,6 @@
%if %{?with_dom0_support}0
%package tools
-License: GPLv2+
Summary: Xen Virtualization: Control tools for domain 0
Group: System/Kernel
Requires: xen-libs = %{version}
@@ -554,7 +628,6 @@
# subpackage existed in 10.3
Provides: xen-tools-ioemu = 3.2
Obsoletes: xen-tools-ioemu <= 3.2
-AutoReqProv: on
%description tools
Xen is a virtual machine monitor for x86 that supports execution of
@@ -604,11 +677,9 @@
%endif
%package tools-domU
-License: GPLv2+
Summary: Xen Virtualization: Control tools for domain U
Group: System/Kernel
Conflicts: xen-tools
-AutoReqProv: on
%description tools-domU
Xen is a virtual machine monitor for x86 that supports execution of
@@ -625,7 +696,6 @@
Ian Pratt
%package devel
-License: GPLv2+
Summary: Xen Virtualization: Headers and libraries for development
Group: System/Kernel
Requires: xen-libs = %{version}
@@ -676,9 +746,8 @@
%if %{?with_kmp}0
%package KMP
-License: GPLv2+
-Group: System/Kernel
Summary: Xen para-virtual device drivers for fully virtualized guests
+Group: System/Kernel
Conflicts: xen
%description KMP
@@ -727,7 +796,6 @@
%if %{?with_dom0_support}0
%package doc-html
-License: GPLv2+
Summary: Xen Virtualization: HTML documentation
Group: Documentation/HTML
@@ -746,7 +814,6 @@
Ian Pratt
%package doc-pdf
-License: GPLv2+
Summary: Xen Virtualization: PDF documentation
Group: Documentation/Other
@@ -886,6 +953,7 @@
%patch23925 -p1
%patch23933 -p1
%patch23943 -p1
+%patch23949 -p1
%patch23953 -p1
%patch23955 -p1
%patch23957 -p1
@@ -893,17 +961,91 @@
%patch23979 -p1
%patch23980 -p1
%patch23993 -p1
+%patch24104 -p1
+%patch24105 -p1
+%patch24106 -p1
%patch24116 -p1
%patch24123 -p1
%patch24124 -p1
%patch24137 -p1
+%patch24138 -p1
%patch24144 -p1
%patch24148 -p1
+%patch24153 -p1
%patch24155 -p1
%patch24156 -p1
%patch24157 -p1
%patch24168 -p1
-# Upstream patches
+%patch24171 -p1
+%patch24178 -p1
+%patch24189 -p1
+%patch24190 -p1
+%patch24193 -p1
+%patch24195 -p1
+%patch24196 -p1
+%patch24197 -p1
+%patch24201 -p1
+%patch24208 -p1
+%patch24209 -p1
+%patch24210 -p1
+%patch24211 -p1
+%patch24212 -p1
+%patch24213 -p1
+%patch24214 -p1
+%patch24215 -p1
+%patch24216 -p1
+%patch24217 -p1
+%patch24218 -p1
+%patch24219 -p1
+%patch24220 -p1
+%patch24221 -p1
+%patch24222 -p1
+%patch24223 -p1
+%patch24224 -p1
+%patch24225 -p1
+%patch24226 -p1
+%patch24227 -p1
+%patch24231 -p1
+%patch24232 -p1
+%patch24261 -p1
+%patch24269 -p1
+%patch24270 -p1
+%patch24272 -p1
+%patch24275 -p1
+%patch24277 -p1
+%patch24278 -p1
+%patch24282 -p1
+%patch24318 -p1
+%patch24344 -p1
+%patch24327 -p1
+%patch24328 -p1
+%patch24329 -p1
+%patch24357 -p1
+%patch24358 -p1
+%patch24359 -p1
+%patch24360 -p1
+%patch24389 -p1
+%patch24391 -p1
+%patch24411 -p1
+%patch24412 -p1
+%patch24417 -p1
+%patch24429 -p1
+%patch24447 -p1
+%patch24448 -p1
+%patch24453 -p1
+%patch24456 -p1
+%patch24459 -p1
+%patch24466 -p1
+%patch24478 -p1
+%patch24566 -p1
+%patch24586 -p1
+%patch24609 -p1
+%patch24610 -p1
+# Qemu
+%patch100 -p1
+%patch101 -p1
+%patch102 -p1
+# Our patches
%patch300 -p1
%patch301 -p1
%patch302 -p1
@@ -942,12 +1084,11 @@
%patch352 -p1
%patch353 -p1
%patch354 -p1
-###%patch355 -p1 gdbserver
+%patch355 -p1
%patch356 -p1
%patch357 -p1
%patch358 -p1
%patch359 -p1
-%patch360 -p1
%patch370 -p1
%patch371 -p1
%patch372 -p1
@@ -959,6 +1100,8 @@
%patch378 -p1
%patch379 -p1
%patch380 -p1
+%patch381 -p1
+%patch382 -p1
%patch400 -p1
%patch401 -p1
%patch402 -p1
@@ -1005,6 +1148,11 @@
%patch457 -p1
%patch458 -p1
%patch459 -p1
+%patch460 -p1
+%patch461 -p1
+%patch462 -p1
+%patch463 -p1
+%patch464 -p1
%patch480 -p1
%patch481 -p1
%patch500 -p1
@@ -1024,30 +1172,26 @@
%patch651 -p1
%patch652 -p1
%patch700 -p1
+%patch701 -p1
# FATE 310510
+%patch1100 -p1
+%patch1101 -p1
+%patch1102 -p1
+%patch1103 -p1
+%patch1104 -p1
+%patch1105 -p1
+%patch1106 -p1
%patch1107 -p1
-%patch1108 -p1
-%patch1109 -p1
-%patch1110 -p1
-%patch1111 -p1
-%patch1112 -p1
-%patch1113 -p1
-%patch1114 -p1
-%patch1115 -p1
-%patch1116 -p1
-%patch1117 -p1
-%patch1118 -p1
-%patch1119 -p1
-%patch1120 -p1
-%patch1121 -p1
-%patch1122 -p1
-%patch1123 -p1
-%patch1125 -p1
%patch1126 -p1
-%patch1127 -p1
-%patch1128 -p1
%patch1129 -p1
%patch1130 -p1
+%patch1131 -p1
+%patch1132 -p1
+%patch1134 -p1
+%patch1135 -p1
+%patch1136 -p1
+%patch1137 -p1
+%patch1142 -p1
#
%patch99998 -p1
%patch99999 -p1
@@ -1153,12 +1297,12 @@
%if %{?with_kmp}0
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=updates
+mkdir -p $RPM_BUILD_ROOT/etc/modprobe.d
for flavor in %flavors_to_build; do
make -C /usr/src/linux-obj/%_target_cpu/$flavor modules_install \
M=$PWD/obj/$flavor
+ install -m644 %SOURCE20 $RPM_BUILD_ROOT/etc/modprobe.d/xen_pvdrivers-$flavor.conf
done
-mkdir -p $RPM_BUILD_ROOT/etc/modprobe.d
-install -m644 %SOURCE20 $RPM_BUILD_ROOT/etc/modprobe.d/xen_pvdrivers.conf
%endif
%if %{?with_dom0_support}0
# Stubdom
++++++ 23749-mmcfg-reservation.patch ++++++
--- /var/tmp/diff_new_pack.TAjBgX/_old 2012-02-10 17:21:09.000000000 +0100
+++ /var/tmp/diff_new_pack.TAjBgX/_new 2012-02-10 17:21:09.000000000 +0100
@@ -16,10 +16,17 @@
Signed-off-by: Jan Beulich
-Index: xen-4.1.2-testing/xen/arch/x86/physdev.c
-===================================================================
---- xen-4.1.2-testing.orig/xen/arch/x86/physdev.c
-+++ xen-4.1.2-testing/xen/arch/x86/physdev.c
+# HG changeset patch
+# User Jan Beulich
+# Date 1322813126 -3600
+# Node ID 60d4e257d04ba0bd663bbef5e93a97b6d8b66e54
+# Parent 3f815406feb25a9348d8be9bc49fdc8c93ccb7c2
+x86-64/mmcfg: remove __initdata annotation overlooked in 23749:e8d1c8f074ba
+
+Signed-off-by: Jan Beulich
+
+--- a/xen/arch/x86/physdev.c
++++ b/xen/arch/x86/physdev.c
@@ -16,6 +16,10 @@
#include
#include
@@ -56,10 +63,8 @@
case PHYSDEVOP_restore_msi: {
struct physdev_restore_msi restore_msi;
struct pci_dev *pdev;
-Index: xen-4.1.2-testing/xen/arch/x86/x86_64/mmconfig.h
-===================================================================
---- xen-4.1.2-testing.orig/xen/arch/x86/x86_64/mmconfig.h
-+++ xen-4.1.2-testing/xen/arch/x86/x86_64/mmconfig.h
+--- a/xen/arch/x86/x86_64/mmconfig.h
++++ b/xen/arch/x86/x86_64/mmconfig.h
@@ -84,6 +84,11 @@ extern int pci_mmcfg_config_num;
extern struct acpi_mcfg_allocation *pci_mmcfg_config;
@@ -73,10 +78,8 @@
-void pci_mmcfg_arch_free(void);
+int pci_mmcfg_arch_enable(unsigned int);
+void pci_mmcfg_arch_disable(unsigned int);
-Index: xen-4.1.2-testing/xen/arch/x86/x86_64/mmconfig-shared.c
-===================================================================
---- xen-4.1.2-testing.orig/xen/arch/x86/x86_64/mmconfig-shared.c
-+++ xen-4.1.2-testing/xen/arch/x86/x86_64/mmconfig-shared.c
+--- a/xen/arch/x86/x86_64/mmconfig-shared.c
++++ b/xen/arch/x86/x86_64/mmconfig-shared.c
@@ -22,10 +22,10 @@
#include
#include
@@ -182,12 +185,12 @@
- /* for late to exit */
- if (known_bridge)
- return;
+-
+- if (pci_mmcfg_check_hostbridge())
+- known_bridge = 1;
+ if (pci_mmcfg_check_hostbridge()) {
+ unsigned int i;
-- if (pci_mmcfg_check_hostbridge())
-- known_bridge = 1;
--
- if (!known_bridge) {
+ pci_mmcfg_arch_init();
+ for (i = 0; i < pci_mmcfg_config_num; ++i)
@@ -244,10 +247,17 @@
}
/**
-Index: xen-4.1.2-testing/xen/arch/x86/x86_64/mmconfig_64.c
-===================================================================
---- xen-4.1.2-testing.orig/xen/arch/x86/x86_64/mmconfig_64.c
-+++ xen-4.1.2-testing/xen/arch/x86/x86_64/mmconfig_64.c
+--- a/xen/arch/x86/x86_64/mmconfig_64.c
++++ b/xen/arch/x86/x86_64/mmconfig_64.c
+@@ -23,7 +23,7 @@ struct mmcfg_virt {
+ char __iomem *virt;
+ };
+ static struct mmcfg_virt *pci_mmcfg_virt;
+-static int __initdata mmcfg_pci_segment_shift;
++static unsigned int mmcfg_pci_segment_shift;
+
+ static char __iomem *get_virt(unsigned int seg, unsigned int *bus)
+ {
@@ -112,7 +112,8 @@ int pci_mmcfg_write(unsigned int seg, un
return 0;
}
@@ -350,10 +360,8 @@
- xfree(pci_mmcfg_virt);
- pci_mmcfg_virt = NULL;
-}
-Index: xen-4.1.2-testing/xen/arch/x86/x86_64/physdev.c
-===================================================================
---- xen-4.1.2-testing.orig/xen/arch/x86/x86_64/physdev.c
-+++ xen-4.1.2-testing/xen/arch/x86/x86_64/physdev.c
+--- a/xen/arch/x86/x86_64/physdev.c
++++ b/xen/arch/x86/x86_64/physdev.c
@@ -54,6 +54,10 @@
#define physdev_get_free_pirq compat_physdev_get_free_pirq
#define physdev_get_free_pirq_t physdev_get_free_pirq_compat_t
@@ -365,10 +373,8 @@
#define COMPAT
#undef guest_handle_okay
#define guest_handle_okay compat_handle_okay
-Index: xen-4.1.2-testing/xen/include/public/physdev.h
-===================================================================
---- xen-4.1.2-testing.orig/xen/include/public/physdev.h
-+++ xen-4.1.2-testing/xen/include/public/physdev.h
+--- a/xen/include/public/physdev.h
++++ b/xen/include/public/physdev.h
@@ -255,6 +255,19 @@ struct physdev_get_free_pirq {
typedef struct physdev_get_free_pirq physdev_get_free_pirq_t;
DEFINE_XEN_GUEST_HANDLE(physdev_get_free_pirq_t);
@@ -389,10 +395,8 @@
/*
* Notify that some PIRQ-bound event channels have been unmasked.
* ** This command is obsolete since interface version 0x00030202 and is **
-Index: xen-4.1.2-testing/xen/include/xlat.lst
-===================================================================
---- xen-4.1.2-testing.orig/xen/include/xlat.lst
-+++ xen-4.1.2-testing/xen/include/xlat.lst
+--- a/xen/include/xlat.lst
++++ b/xen/include/xlat.lst
@@ -60,6 +60,7 @@
! memory_map memory.h
! memory_reservation memory.h
++++++ 23905-xenpaging_fix_locking_in_p2m_mem_paging_functions.patch ++++++
--- /var/tmp/diff_new_pack.TAjBgX/_old 2012-02-10 17:21:09.000000000 +0100
+++ /var/tmp/diff_new_pack.TAjBgX/_new 2012-02-10 17:21:09.000000000 +0100
@@ -25,7 +25,7 @@
mfn_t mfn;
int ret;
-+ p2m_unlock(p2m);
++ p2m_lock(p2m);
+
mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query);
++++++ 23949-constify_vcpu_set_affinitys_second_parameter.patch ++++++
changeset: 23949:39df16923958
user: Jan Beulich
date: Thu Oct 13 10:00:13 2011 +0200
files: xen/arch/x86/cpu/mcheck/vmce.c xen/arch/x86/traps.c xen/common/schedule.c xen/include/xen/sched.h
description:
constify vcpu_set_affinity()'s second parameter
None of the callers actually make use of the function's returning of
the old affinity through its second parameter, and eliminating this
capability allows some callers to no longer use a local variable here,
reducing their stack footprint significantly when building with large
NR_CPUS.
Signed-off-by: Jan Beulich
Acked-by: Keir Fraser
---
xen/arch/x86/cpu/mcheck/vmce.c | 5 +----
xen/arch/x86/traps.c | 10 ++--------
xen/common/schedule.c | 6 ++----
xen/include/xen/sched.h | 2 +-
4 files changed, 6 insertions(+), 17 deletions(-)
Index: xen-4.1.2-testing/xen/arch/x86/cpu/mcheck/vmce.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/cpu/mcheck/vmce.c
+++ xen-4.1.2-testing/xen/arch/x86/cpu/mcheck/vmce.c
@@ -304,7 +304,6 @@ int vmce_wrmsr(u32 msr, u64 val)
int inject_vmce(struct domain *d)
{
int cpu = smp_processor_id();
- cpumask_t affinity;
/* PV guest and HVM guest have different vMCE# injection methods. */
if ( !test_and_set_bool(d->vcpu[0]->mce_pending) )
@@ -323,11 +322,9 @@ int inject_vmce(struct domain *d)
{
d->vcpu[0]->cpu_affinity_tmp =
d->vcpu[0]->cpu_affinity;
- cpus_clear(affinity);
- cpu_set(cpu, affinity);
mce_printk(MCE_VERBOSE, "MCE: CPU%d set affinity, old %d\n",
cpu, d->vcpu[0]->processor);
- vcpu_set_affinity(d->vcpu[0], &affinity);
+ vcpu_set_affinity(d->vcpu[0], cpumask_of(cpu));
vcpu_kick(d->vcpu[0]);
}
else
Index: xen-4.1.2-testing/xen/arch/x86/traps.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/traps.c
+++ xen-4.1.2-testing/xen/arch/x86/traps.c
@@ -3104,7 +3104,6 @@ static void nmi_mce_softirq(void)
{
int cpu = smp_processor_id();
struct softirq_trap *st = &per_cpu(softirq_trap, cpu);
- cpumask_t affinity;
BUG_ON(st == NULL);
BUG_ON(st->vcpu == NULL);
@@ -3120,9 +3119,7 @@ static void nmi_mce_softirq(void)
* Make sure to wakeup the vcpu on the
* specified processor.
*/
- cpus_clear(affinity);
- cpu_set(st->processor, affinity);
- vcpu_set_affinity(st->vcpu, &affinity);
+ vcpu_set_affinity(st->vcpu, cpumask_of(st->processor));
/* Affinity is restored in the iret hypercall. */
}
@@ -3192,14 +3189,11 @@ void async_exception_cleanup(struct vcpu
!test_and_set_bool(curr->mce_pending) )
{
int cpu = smp_processor_id();
- cpumask_t affinity;
curr->cpu_affinity_tmp = curr->cpu_affinity;
- cpus_clear(affinity);
- cpu_set(cpu, affinity);
printk(XENLOG_DEBUG "MCE: CPU%d set affinity, old %d\n",
cpu, curr->processor);
- vcpu_set_affinity(curr, &affinity);
+ vcpu_set_affinity(curr, cpumask_of(cpu));
}
}
}
Index: xen-4.1.2-testing/xen/common/schedule.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/schedule.c
+++ xen-4.1.2-testing/xen/common/schedule.c
@@ -593,9 +593,9 @@ int cpu_disable_scheduler(unsigned int c
return ret;
}
-int vcpu_set_affinity(struct vcpu *v, cpumask_t *affinity)
+int vcpu_set_affinity(struct vcpu *v, const cpumask_t *affinity)
{
- cpumask_t online_affinity, old_affinity;
+ cpumask_t online_affinity;
cpumask_t *online;
if ( v->domain->is_pinned )
@@ -607,9 +607,7 @@ int vcpu_set_affinity(struct vcpu *v, cp
vcpu_schedule_lock_irq(v);
- old_affinity = v->cpu_affinity;
v->cpu_affinity = *affinity;
- *affinity = old_affinity;
if ( !cpu_isset(v->processor, v->cpu_affinity) )
set_bit(_VPF_migrating, &v->pause_flags);
Index: xen-4.1.2-testing/xen/include/xen/sched.h
===================================================================
--- xen-4.1.2-testing.orig/xen/include/xen/sched.h
+++ xen-4.1.2-testing/xen/include/xen/sched.h
@@ -623,7 +623,7 @@ void scheduler_free(struct scheduler *sc
int schedule_cpu_switch(unsigned int cpu, struct cpupool *c);
void vcpu_force_reschedule(struct vcpu *v);
int cpu_disable_scheduler(unsigned int cpu);
-int vcpu_set_affinity(struct vcpu *v, cpumask_t *affinity);
+int vcpu_set_affinity(struct vcpu *v, const cpumask_t *affinity);
void vcpu_runstate_get(struct vcpu *v, struct vcpu_runstate_info *runstate);
uint64_t get_cpu_idle_time(unsigned int cpu);
++++++ 24104-waitqueue_Double_size_of_x86_shadow_stack..patch ++++++
changeset: 24104:4daa4ad90f12
user: Keir Fraser
date: Tue Nov 08 19:33:46 2011 +0000
files: xen/common/wait.c
description:
waitqueue: Double size of x86 shadow stack.
Signed-off-by: Keir Fraser
---
xen/common/wait.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: xen-4.1.2-testing/xen/common/wait.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/wait.c
+++ xen-4.1.2-testing/xen/common/wait.c
@@ -33,7 +33,7 @@ struct waitqueue_vcpu {
* hypervisor context before sleeping (descheduling), setjmp/longjmp-style.
*/
void *esp;
- char stack[1500];
+ char stack[3000];
#endif
};
++++++ 24105-xenpaging_compare_domain_pointer_in_p2m_mem_paging_populate.patch ++++++
changeset: 24105:89efd82620ec
user: Olaf Hering
date: Tue Nov 08 19:35:01 2011 +0000
files: xen/arch/x86/mm/p2m.c
description:
xenpaging: compare domain pointer in p2m_mem_paging_populate
Compare just the domain pointer instead of the domain_id number.
Signed-off-by: Olaf Hering
Committed-by: Keir Fraser
---
xen/arch/x86/mm/p2m.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
@@ -3060,7 +3060,7 @@ void p2m_mem_paging_populate(struct p2m_
p2m_unlock(p2m);
/* Pause domain if request came from guest and gfn has paging type */
- if ( p2m_is_paging(p2mt) && v->domain->domain_id == d->domain_id )
+ if ( p2m_is_paging(p2mt) && v->domain == d )
{
vcpu_pause_nosync(v);
req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED;
++++++ 24106-mem_event_check_capabilities_only_once.patch ++++++
changeset: 24106:2af5bfbc9fde
user: Olaf Hering
date: Tue Nov 08 19:35:42 2011 +0000
files: xen/arch/x86/mm/mem_event.c
description:
mem_event: check capabilities only once
It is not required to check the system capabilities during every domctl.
Rearrange the code to check them only once.
Signed-off-by: Olaf Hering
Committed-by: Keir Fraser
---
xen/arch/x86/mm/mem_event.c | 54 ++++++++++++++++++++++++--------------------
1 file changed, 30 insertions(+), 24 deletions(-)
Index: xen-4.1.2-testing/xen/arch/x86/mm/mem_event.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/mem_event.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/mem_event.c
@@ -253,32 +253,35 @@ int mem_event_domctl(struct domain *d, x
case XEN_DOMCTL_MEM_EVENT_OP_PAGING:
{
struct mem_event_domain *med = &d->mem_paging;
- struct p2m_domain *p2m = p2m_get_hostp2m(d);
- rc = -ENODEV;
- /* Only HAP is supported */
- if ( !hap_enabled(d) )
- break;
-
- /* Currently only EPT is supported */
- if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
- break;
-
- rc = -EXDEV;
- /* Disallow paging in a PoD guest */
- if ( p2m->pod.entry_count )
- break;
+ rc = -EINVAL;
switch( mec->op )
{
case XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE:
{
+ struct p2m_domain *p2m = p2m_get_hostp2m(d);
+ rc = -ENODEV;
+ /* Only HAP is supported */
+ if ( !hap_enabled(d) )
+ break;
+
+ /* Currently only EPT is supported */
+ if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
+ break;
+
+ rc = -EXDEV;
+ /* Disallow paging in a PoD guest */
+ if ( p2m->pod.entry_count )
+ break;
+
rc = mem_event_enable(d, mec, med);
}
break;
case XEN_DOMCTL_MEM_EVENT_OP_PAGING_DISABLE:
{
- rc = mem_event_disable(med);
+ if ( med->ring_page )
+ rc = mem_event_disable(med);
}
break;
@@ -295,26 +298,29 @@ int mem_event_domctl(struct domain *d, x
case XEN_DOMCTL_MEM_EVENT_OP_ACCESS:
{
struct mem_event_domain *med = &d->mem_access;
- rc = -ENODEV;
- /* Only HAP is supported */
- if ( !hap_enabled(d) )
- break;
-
- /* Currently only EPT is supported */
- if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
- break;
+ rc = -EINVAL;
switch( mec->op )
{
case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE:
{
+ rc = -ENODEV;
+ /* Only HAP is supported */
+ if ( !hap_enabled(d) )
+ break;
+
+ /* Currently only EPT is supported */
+ if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
+ break;
+
rc = mem_event_enable(d, mec, med);
}
break;
case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE:
{
- rc = mem_event_disable(&d->mem_access);
+ if ( med->ring_page )
+ rc = mem_event_disable(&d->mem_access);
}
break;
++++++ 24138-xenpaging_munmap_all_pages_after_page-in.patch ++++++
changeset: 24138:e2cc58b85b6e
user: Olaf Hering
date: Mon Nov 14 17:49:14 2011 +0000
files: tools/xenpaging/pagein.c
description:
xenpaging: munmap all pages after page-in
Do munmap() on all mapped pages, not just the first one. Without this
change the gfns backing the remaining pages can not be paged out again
because the page count does not go down to 1. This change was missing
from changeset 23827:d1d6abc1db20.
Signed-off-by: Olaf Hering
Committed-by: Ian Jackson
---
tools/xenpaging/pagein.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: xen-4.1.2-testing/tools/xenpaging/pagein.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/pagein.c
+++ xen-4.1.2-testing/tools/xenpaging/pagein.c
@@ -44,7 +44,7 @@ static void *page_in(void *arg)
/* Ignore errors */
page = xc_map_foreign_pages(pia->xch, pia->dom, PROT_READ, gfns, num);
if (page)
- munmap(page, PAGE_SIZE);
+ munmap(page, PAGE_SIZE * num);
}
page_in_possible = 0;
pthread_exit(NULL);
++++++ 24153-x86-emul-feature-checks.patch ++++++
# HG changeset patch
# User Jan Beulich
# Date 1321459471 0
# Node ID 644ca5d3ec435f3372ce88a4de86909bd4033819
# Parent 1cbb3c1dfb3203f5344a6c1c52507b9e75af6742
x86/emulator: add feature checks for newer instructions
Certain instructions were introduced only after the i686 or original
x86-64 architecture, so we should not try to emulate them if the guest
is not seeing the respective feature enabled (or, worse, if the
underlying hardware doesn't support them). This affects fisttp,
movnti, and cmpxchg16b.
Signed-off-by: Jan Beulich
Signed-off-by: Keir Fraser
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -955,6 +955,47 @@ in_protmode(
return !(in_realmode(ctxt, ops) || (ctxt->regs->eflags & EFLG_VM));
}
+#define EAX 0
+#define ECX 1
+#define EDX 2
+#define EBX 3
+
+static bool_t vcpu_has(
+ unsigned int eax,
+ unsigned int reg,
+ unsigned int bit,
+ struct x86_emulate_ctxt *ctxt,
+ const struct x86_emulate_ops *ops)
+{
+ unsigned int ebx = 0, ecx = 0, edx = 0;
+ int rc;
+
+ fail_if(!ops->cpuid);
+ rc = ops->cpuid(&eax, &ebx, &ecx, &edx, ctxt);
+ if ( rc == X86EMUL_OKAY )
+ {
+ switch ( reg )
+ {
+ case EAX: reg = eax; break;
+ case EBX: reg = ebx; break;
+ case ECX: reg = ecx; break;
+ case EDX: reg = edx; break;
+ default: BUG();
+ }
+ if ( !(reg & (1U << bit)) )
+ rc = ~X86EMUL_OKAY;
+ }
+
+ done:
+ return rc == X86EMUL_OKAY;
+}
+
+#define vcpu_must_have(leaf, reg, bit) \
+ generate_exception_if(!vcpu_has(leaf, reg, bit, ctxt, ops), EXC_UD, -1)
+#define vcpu_must_have_sse2() vcpu_must_have(0x00000001, EDX, 26)
+#define vcpu_must_have_sse3() vcpu_must_have(0x00000001, ECX, 0)
+#define vcpu_must_have_cx16() vcpu_must_have(0x00000001, ECX, 13)
+
static int
in_longmode(
struct x86_emulate_ctxt *ctxt,
@@ -2738,6 +2779,7 @@ x86_emulate(
emulate_fpu_insn_memsrc("fildl", src.val);
break;
case 1: /* fisttp m32i */
+ vcpu_must_have_sse3();
ea.bytes = 4;
dst = ea;
dst.type = OP_MEM;
@@ -2846,6 +2888,7 @@ x86_emulate(
emulate_fpu_insn_memsrc("fldl", src.val);
break;
case 1: /* fisttp m64i */
+ vcpu_must_have_sse3();
ea.bytes = 8;
dst = ea;
dst.type = OP_MEM;
@@ -2953,6 +2996,7 @@ x86_emulate(
emulate_fpu_insn_memsrc("fild", src.val);
break;
case 1: /* fisttp m16i */
+ vcpu_must_have_sse3();
ea.bytes = 2;
dst = ea;
dst.type = OP_MEM;
@@ -4141,6 +4185,7 @@ x86_emulate(
case 0xc3: /* movnti */
/* Ignore the non-temporal hint for now. */
+ vcpu_must_have_sse2();
generate_exception_if(dst.bytes <= 2, EXC_UD, -1);
dst.val = src.val;
break;
@@ -4151,6 +4196,8 @@ x86_emulate(
generate_exception_if((modrm_reg & 7) != 1, EXC_UD, -1);
generate_exception_if(ea.type != OP_MEM, EXC_UD, -1);
+ if ( op_bytes == 8 )
+ vcpu_must_have_cx16();
op_bytes *= 2;
/* Get actual old value. */
++++++ 24171-x86waitqueue_Allocate_whole_page_for_shadow_stack..patch ++++++
changeset: 24171:fe80909663c1
user: Keir Fraser
date: Tue Nov 22 13:00:21 2011 +0000
files: xen/common/wait.c
description:
x86,waitqueue: Allocate whole page for shadow stack.
Signed-off-by: Keir Fraser
---
xen/common/wait.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
Index: xen-4.1.2-testing/xen/common/wait.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/wait.c
+++ xen-4.1.2-testing/xen/common/wait.c
@@ -33,7 +33,7 @@ struct waitqueue_vcpu {
* hypervisor context before sleeping (descheduling), setjmp/longjmp-style.
*/
void *esp;
- char stack[3000];
+ char *stack;
#endif
};
@@ -41,11 +41,19 @@ int init_waitqueue_vcpu(struct vcpu *v)
{
struct waitqueue_vcpu *wqv;
- wqv = xmalloc(struct waitqueue_vcpu);
+ wqv = xzalloc(struct waitqueue_vcpu);
if ( wqv == NULL )
return -ENOMEM;
- memset(wqv, 0, sizeof(*wqv));
+#ifdef CONFIG_X86
+ wqv->stack = alloc_xenheap_page();
+ if ( wqv->stack == NULL )
+ {
+ xfree(wqv);
+ return -ENOMEM;
+ }
+#endif
+
INIT_LIST_HEAD(&wqv->list);
wqv->vcpu = v;
@@ -63,6 +71,9 @@ void destroy_waitqueue_vcpu(struct vcpu
return;
BUG_ON(!list_empty(&wqv->list));
+#ifdef CONFIG_X86
+ free_xenheap_page(wqv->stack);
+#endif
xfree(wqv);
v->waitqueue_vcpu = NULL;
@@ -115,7 +126,7 @@ static void __prepare_to_wait(struct wai
: "=S" (wqv->esp)
: "c" (cpu_info), "D" (wqv->stack)
: "memory" );
- BUG_ON((cpu_info - (char *)wqv->esp) > sizeof(wqv->stack));
+ BUG_ON((cpu_info - (char *)wqv->esp) > PAGE_SIZE);
}
static void __finish_wait(struct waitqueue_vcpu *wqv)
++++++ 24178-debug_Add_domain-vcpu_pause_count_info_to_d_key..patch ++++++
changeset: 24178:1f2a06dbbb69
user: Keir Fraser
date: Tue Nov 22 15:35:26 2011 +0000
files: xen/common/keyhandler.c
description:
debug: Add domain/vcpu pause_count info to 'd' key.
Signed-off-by: Keir Fraser
---
xen/common/keyhandler.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
Index: xen-4.1.2-testing/xen/common/keyhandler.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/keyhandler.c
+++ xen-4.1.2-testing/xen/common/keyhandler.c
@@ -244,9 +244,10 @@ static void dump_domains(unsigned char k
unsigned int i;
printk("General information for domain %u:\n", d->domain_id);
cpuset_print(tmpstr, sizeof(tmpstr), d->domain_dirty_cpumask);
- printk(" refcnt=%d dying=%d nr_pages=%d xenheap_pages=%d "
- "dirty_cpus=%s max_pages=%u\n",
+ printk(" refcnt=%d dying=%d pause_count=%d\n",
atomic_read(&d->refcnt), d->is_dying,
+ atomic_read(&d->pause_count));
+ printk(" nr_pages=%d xenheap_pages=%d dirty_cpus=%s max_pages=%u\n",
d->tot_pages, d->xenheap_pages, tmpstr, d->max_pages);
printk(" handle=%02x%02x%02x%02x-%02x%02x-%02x%02x-"
"%02x%02x-%02x%02x%02x%02x%02x%02x vm_assist=%08lx\n",
@@ -270,17 +271,18 @@ static void dump_domains(unsigned char k
d->domain_id);
for_each_vcpu ( d, v )
{
- printk(" VCPU%d: CPU%d [has=%c] flags=%lx poll=%d "
+ printk(" VCPU%d: CPU%d [has=%c] poll=%d "
"upcall_pend = %02x, upcall_mask = %02x ",
v->vcpu_id, v->processor,
- v->is_running ? 'T':'F',
- v->pause_flags, v->poll_evtchn,
+ v->is_running ? 'T':'F', v->poll_evtchn,
vcpu_info(v, evtchn_upcall_pending),
vcpu_info(v, evtchn_upcall_mask));
cpuset_print(tmpstr, sizeof(tmpstr), v->vcpu_dirty_cpumask);
printk("dirty_cpus=%s ", tmpstr);
cpuset_print(tmpstr, sizeof(tmpstr), v->cpu_affinity);
printk("cpu_affinity=%s\n", tmpstr);
+ printk(" pause_count=%d pause_flags=%lx\n",
+ atomic_read(&v->pause_count), v->pause_flags);
arch_dump_vcpu_info(v);
periodic_timer_print(tmpstr, sizeof(tmpstr), v->periodic_period);
printk(" %s\n", tmpstr);
++++++ 24189-x86-p2m-pod-locking.patch ++++++
# HG changeset patch
# User Andres Lagar-Cavilla
# Date 1322148057 0
# Node ID 7da681c490e0a8a2b3f1fb311d254dc7ce618a43
# Parent b082fdc52ad7607d93b59148fb289aafe21f294b
x86/mm/p2m: fix pod locking
The path p2m-lookup -> p2m-pt->get_entry -> 1GB PoD superpage ->
pod_demand_populate ends in the pod code performing a p2m_set_entry with
no locks held (in order to split the 1GB superpage into 512 2MB ones)
Further, it calls p2m_unlock after that, which will break the spinlock.
This patch attempts to fix that.
Signed-off-by: Andres Lagar-Cavilla
Acked-by: George Dunlap
Acked-by: Tim Deegan
Committed-by: Tim Deegan
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1244,7 +1244,6 @@ p2m_pod_demand_populate(struct p2m_domai
set_p2m_entry(p2m, gfn_aligned, _mfn(POPULATE_ON_DEMAND_MFN), 9,
p2m_populate_on_demand, p2m->default_access);
audit_p2m(p2m, 1);
- p2m_unlock(p2m);
return 0;
}
@@ -1602,7 +1601,8 @@ pod_retry_l3:
{
if ( q != p2m_query )
{
- if ( !p2m_pod_demand_populate(p2m, gfn, 18, q) )
+ if ( !p2m_pod_check_and_populate(p2m, gfn,
+ (l1_pgentry_t *) &l3e, 18, q) )
goto pod_retry_l3;
}
else
@@ -1733,7 +1733,8 @@ static mfn_t p2m_gfn_to_mfn_current(stru
/* The read has succeeded, so we know that mapping exists */
if ( q != p2m_query )
{
- if ( !p2m_pod_demand_populate(p2m, gfn, 18, q) )
+ if ( !p2m_pod_check_and_populate(p2m, gfn,
+ (l1_pgentry_t *) &l3e, 18, q) )
goto pod_retry_l3;
p2mt = p2m_invalid;
printk("%s: Allocate 1GB failed!\n", __func__);
++++++ 24190-hap-log-dirty-disable-rc.patch ++++++
# HG changeset patch
# User Andres Lagar-Cavilla
# Date 1322148057 0
# Node ID 6b3d8250ee2c63d90680c142549123a4b1559f55
# Parent 7da681c490e0a8a2b3f1fb311d254dc7ce618a43
x86/mm: change return code for log-dirty disabling
Disabling log dirty mode in HAP always returns -EINVAL. Make it
return the correct rc on success.
Signed-off-by: Andres Lagar-Cavilla
Signed-off-by: Tim Deegan
Committed-by: Tim Deegan
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -710,6 +710,8 @@ int hap_domctl(struct domain *d, xen_dom
return rc;
case XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION:
sc->mb = hap_get_allocation(d);
+ /* Fall through... */
+ case XEN_DOMCTL_SHADOW_OP_OFF:
return 0;
default:
HAP_ERROR("Bad hap domctl op %u\n", sc->op);
++++++ 24193-hap-track-dirty-vram-rc.patch ++++++
# HG changeset patch
# User Andres Lagar-Cavilla
# Date 1322149491 0
# Node ID 67d2ac426defedad9c10eb339019f9dc9f02d2ae
# Parent 3c864e04c2ad060ca1cac6579994777993fef6e6
Trivial fix for rc val in hap track dirty vram
Signed-off-by: Andres Lagar-Cavilla
Committed-by: Keir Fraser
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -143,7 +143,7 @@ int hap_track_dirty_vram(struct domain *
}
else if ( !paging_mode_log_dirty(d) && !dirty_vram )
{
- rc -ENOMEM;
+ rc = -ENOMEM;
if ( (dirty_vram = xmalloc(struct sh_dirty_vram)) == NULL )
goto param_fail;
++++++ 24195-waitqueue_Detect_saved-stack_overflow_and_crash_the_guest..patch ++++++
changeset: 24195:9b65336f688f
user: Keir Fraser
date: Thu Nov 24 15:48:10 2011 +0000
files: xen/common/wait.c
description:
waitqueue: Detect saved-stack overflow and crash the guest.
Signed-off-by: Keir Fraser
---
xen/common/wait.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
Index: xen-4.1.2-testing/xen/common/wait.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/wait.c
+++ xen-4.1.2-testing/xen/common/wait.c
@@ -106,13 +106,16 @@ void wake_up(struct waitqueue_head *wq)
static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
{
char *cpu_info = (char *)get_cpu_info();
+
asm volatile (
#ifdef CONFIG_X86_64
"push %%rax; push %%rbx; push %%rcx; push %%rdx; push %%rdi; "
"push %%rbp; push %%r8; push %%r9; push %%r10; push %%r11; "
"push %%r12; push %%r13; push %%r14; push %%r15; call 1f; "
"1: mov 80(%%rsp),%%rdi; mov 96(%%rsp),%%rcx; mov %%rsp,%%rsi; "
- "sub %%rsi,%%rcx; rep movsb; mov %%rsp,%%rsi; pop %%rax; "
+ "sub %%rsi,%%rcx; cmp %3,%%rcx; jbe 2f; "
+ "xor %%esi,%%esi; jmp 3f; "
+ "2: rep movsb; mov %%rsp,%%rsi; 3: pop %%rax; "
"pop %%r15; pop %%r14; pop %%r13; pop %%r12; "
"pop %%r11; pop %%r10; pop %%r9; pop %%r8; "
"pop %%rbp; pop %%rdi; pop %%rdx; pop %%rcx; pop %%rbx; pop %%rax"
@@ -120,13 +123,20 @@ static void __prepare_to_wait(struct wai
"push %%eax; push %%ebx; push %%ecx; push %%edx; push %%edi; "
"push %%ebp; call 1f; "
"1: mov 8(%%esp),%%edi; mov 16(%%esp),%%ecx; mov %%esp,%%esi; "
- "sub %%esi,%%ecx; rep movsb; mov %%esp,%%esi; pop %%eax; "
+ "sub %%esi,%%ecx; cmp %3,%%ecx; jbe 2f; "
+ "xor %%esi,%%esi; jmp 3f; "
+ "2: rep movsb; mov %%esp,%%esi; 3: pop %%eax; "
"pop %%ebp; pop %%edi; pop %%edx; pop %%ecx; pop %%ebx; pop %%eax"
#endif
: "=S" (wqv->esp)
- : "c" (cpu_info), "D" (wqv->stack)
+ : "c" (cpu_info), "D" (wqv->stack), "i" (PAGE_SIZE)
: "memory" );
- BUG_ON((cpu_info - (char *)wqv->esp) > PAGE_SIZE);
+
+ if ( unlikely(wqv->esp == 0) )
+ {
+ gdprintk(XENLOG_ERR, "Stack too large in %s\n", __FUNCTION__);
+ domain_crash_synchronous();
+ }
}
static void __finish_wait(struct waitqueue_vcpu *wqv)
@@ -162,6 +172,7 @@ void prepare_to_wait(struct waitqueue_he
struct vcpu *curr = current;
struct waitqueue_vcpu *wqv = curr->waitqueue_vcpu;
+ ASSERT(!in_atomic());
ASSERT(list_empty(&wqv->list));
spin_lock(&wq->lock);
++++++ 24196-waitqueue_Reorder_prepare_to_wait_so_that_vcpu_is_definitely_on_the.patch ++++++
changeset: 24196:de4fe05fe887
user: Keir Fraser
date: Thu Nov 24 15:49:25 2011 +0000
files: xen/common/wait.c
description:
waitqueue: Reorder prepare_to_wait() so that vcpu is definitely on the
queue on exit, even after a wakeup.
Otherwise, when we go round the loop in wait_event(), we may not
actually sleep after the first iteration, as we do not put ourselves
back on the queue on wakeup.
Signed-off-by: Keir Fraser
---
xen/common/wait.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
Index: xen-4.1.2-testing/xen/common/wait.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/wait.c
+++ xen-4.1.2-testing/xen/common/wait.c
@@ -107,6 +107,8 @@ static void __prepare_to_wait(struct wai
{
char *cpu_info = (char *)get_cpu_info();
+ ASSERT(wqv->esp == 0);
+
asm volatile (
#ifdef CONFIG_X86_64
"push %%rax; push %%rbx; push %%rcx; push %%rdx; push %%rdi; "
@@ -173,14 +175,13 @@ void prepare_to_wait(struct waitqueue_he
struct waitqueue_vcpu *wqv = curr->waitqueue_vcpu;
ASSERT(!in_atomic());
- ASSERT(list_empty(&wqv->list));
+ __prepare_to_wait(wqv);
+ ASSERT(list_empty(&wqv->list));
spin_lock(&wq->lock);
list_add_tail(&wqv->list, &wq->list);
vcpu_pause_nosync(curr);
spin_unlock(&wq->lock);
-
- __prepare_to_wait(wqv);
}
void finish_wait(struct waitqueue_head *wq)
++++++ 24197-x86-waitqueue_Because_we_have_per-cpu_stacks_we_must_wake_up_on_teh.patch ++++++
changeset: 24197:ca92c4a8b31f
user: Keir Fraser
date: Thu Nov 24 15:50:08 2011 +0000
files: xen/common/wait.c
description:
x86/waitqueue: Because we have per-cpu stacks, we must wake up on teh
same cpu that we slept on. Otherwise stack references are bogus on
wakeup.
Signed-off-by: Keir Fraser
---
xen/common/wait.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
Index: xen-4.1.2-testing/xen/common/wait.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/wait.c
+++ xen-4.1.2-testing/xen/common/wait.c
@@ -34,6 +34,8 @@ struct waitqueue_vcpu {
*/
void *esp;
char *stack;
+ cpumask_t saved_affinity;
+ unsigned int wakeup_cpu;
#endif
};
@@ -106,9 +108,19 @@ void wake_up(struct waitqueue_head *wq)
static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
{
char *cpu_info = (char *)get_cpu_info();
+ struct vcpu *curr = current;
ASSERT(wqv->esp == 0);
+ /* Save current VCPU affinity; force wakeup on *this* CPU only. */
+ wqv->wakeup_cpu = smp_processor_id();
+ wqv->saved_affinity = curr->cpu_affinity;
+ if ( vcpu_set_affinity(curr, cpumask_of(wqv->wakeup_cpu)) )
+ {
+ gdprintk(XENLOG_ERR, "Unable to set vcpu affinity\n");
+ domain_crash_synchronous();
+ }
+
asm volatile (
#ifdef CONFIG_X86_64
"push %%rax; push %%rbx; push %%rcx; push %%rdx; push %%rdi; "
@@ -144,6 +156,7 @@ static void __prepare_to_wait(struct wai
static void __finish_wait(struct waitqueue_vcpu *wqv)
{
wqv->esp = NULL;
+ (void)vcpu_set_affinity(current, &wqv->saved_affinity);
}
void check_wakeup_from_wait(void)
@@ -155,6 +168,20 @@ void check_wakeup_from_wait(void)
if ( likely(wqv->esp == NULL) )
return;
+ /* Check if we woke up on the wrong CPU. */
+ if ( unlikely(smp_processor_id() != wqv->wakeup_cpu) )
+ {
+ /* Re-set VCPU affinity and re-enter the scheduler. */
+ struct vcpu *curr = current;
+ wqv->saved_affinity = curr->cpu_affinity;
+ if ( vcpu_set_affinity(curr, cpumask_of(wqv->wakeup_cpu)) )
+ {
+ gdprintk(XENLOG_ERR, "Unable to set vcpu affinity\n");
+ domain_crash_synchronous();
+ }
+ wait(); /* takes us back into the scheduler */
+ }
+
asm volatile (
"mov %1,%%"__OP"sp; rep movsb; jmp *(%%"__OP"sp)"
: : "S" (wqv->stack), "D" (wqv->esp),
++++++ 24201-x86-pcpu-platform-op.patch ++++++
# HG changeset patch
# User Jan Beulich
# Date 1322153786 -3600
# Node ID 9c6bea25f71233787a36893deaf0e811f2dcb8d8
# Parent 480531cab3f4468b1ec9b549bc84d66e420ce685
x86: small fixes to pcpu platform op handling
XENPF_get_cpuinfo should init the flags output field rather than only
modify it.
XENPF_cpu_online must check for the input CPU number to be in range.
XENPF_cpu_offline must also do that, and should also reject attempts to
offline CPU 0 (this fails in cpu_down() too, but preventing this here
appears more correct given that the code here calls
continue_hypercall_on_cpu(0, ...), which would be flawed if cpu_down()
would ever allow bringing down CPU 0 (and a distinct error code is
easier to deal with when debugging issues).
Signed-off-by: Jan Beulich
Acked-by: Keir Fraser
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -449,13 +449,14 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
if ( (g_info->xen_cpuid >= NR_CPUS) ||
!cpu_present(g_info->xen_cpuid) )
{
- g_info->flags |= XEN_PCPU_FLAGS_INVALID;
+ g_info->flags = XEN_PCPU_FLAGS_INVALID;
}
else
{
g_info->apic_id = x86_cpu_to_apicid[g_info->xen_cpuid];
g_info->acpi_id = acpi_get_processor_id(g_info->xen_cpuid);
ASSERT(g_info->apic_id != BAD_APICID);
+ g_info->flags = 0;
if (cpu_online(g_info->xen_cpuid))
g_info->flags |= XEN_PCPU_FLAGS_ONLINE;
}
@@ -472,7 +473,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
{
int cpu = op->u.cpu_ol.cpuid;
- if ( !cpu_present(cpu) )
+ if ( cpu >= NR_CPUS || !cpu_present(cpu) )
{
ret = -EINVAL;
break;
@@ -493,7 +494,13 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
{
int cpu = op->u.cpu_ol.cpuid;
- if ( !cpu_present(cpu) )
+ if ( cpu == 0 )
+ {
+ ret = -EOPNOTSUPP;
+ break;
+ }
+
+ if ( cpu >= NR_CPUS || !cpu_present(cpu) )
{
ret = -EINVAL;
break;
++++++ 24208-xenpaging_remove_filename_from_comment.patch ++++++
changeset: 24208:31fce41fc2b2
user: Olaf Hering
date: Sun Nov 20 17:01:15 2011 +0100
files: tools/xenpaging/file_ops.c tools/xenpaging/policy_default.c tools/xenpaging/xenpaging.c
description:
xenpaging: remove filename from comment
Signed-off-by: Olaf Hering
Committed-by: Ian Jackson
---
tools/xenpaging/file_ops.c | 1 -
tools/xenpaging/policy_default.c | 1 -
tools/xenpaging/xenpaging.c | 1 -
3 files changed, 3 deletions(-)
Index: xen-4.1.2-testing/tools/xenpaging/file_ops.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/file_ops.c
+++ xen-4.1.2-testing/tools/xenpaging/file_ops.c
@@ -1,5 +1,4 @@
/******************************************************************************
- * tools/xenpaging/file_ops.c
*
* Common file operations.
*
Index: xen-4.1.2-testing/tools/xenpaging/policy_default.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/policy_default.c
+++ xen-4.1.2-testing/tools/xenpaging/policy_default.c
@@ -1,5 +1,4 @@
/******************************************************************************
- * tools/xenpaging/policy.c
*
* Xen domain paging default policy.
*
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c
@@ -1,5 +1,4 @@
/******************************************************************************
- * tools/xenpaging/xenpaging.c
*
* Domain paging.
* Copyright (c) 2009 by Citrix Systems, Inc. (Patrick Colp)
++++++ 24209-xenpaging_remove_obsolete_comment_in_resume_path.patch ++++++
changeset: 24209:fe8946916512
user: Olaf Hering
date: Sun Nov 20 17:01:20 2011 +0100
files: tools/xenpaging/xenpaging.c
description:
xenpaging: remove obsolete comment in resume path
Remove stale comment.
If a page was populated several times the vcpu is paused and
xenpaging has to unpause it again.
Signed-off-by: Olaf Hering
Committed-by: Ian Jackson
---
tools/xenpaging/xenpaging.c | 1 -
1 file changed, 1 deletion(-)
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c
@@ -744,7 +744,6 @@ int main(int argc, char *argv[])
!!(req.flags & MEM_EVENT_FLAG_EVICT_FAIL) );
/* Tell Xen to resume the vcpu */
- /* XXX: Maybe just check if the vcpu was paused? */
if ( req.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
{
/* Prepare the response */
++++++ 24210-xenpaging_use_PERROR_to_print_errno.patch ++++++
changeset: 24210:d1d54cdc4a7b
user: Olaf Hering
date: Sun Nov 20 17:01:32 2011 +0100
files: tools/xenpaging/xenpaging.c
description:
xenpaging: use PERROR to print errno
v3:
- adjust arguments for xc_mem_paging_enable() failures
v2:
- move changes to file_op() to different patch
Signed-off-by: Olaf Hering
Committed-by: Ian Jackson
---
tools/xenpaging/xenpaging.c | 58 ++++++++++++++++++++++----------------------
1 file changed, 29 insertions(+), 29 deletions(-)
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c
@@ -90,7 +90,7 @@ static int xenpaging_wait_for_event_or_t
if (errno == EINTR)
return 0;
- ERROR("Poll exited with an error");
+ PERROR("Poll exited with an error");
return -errno;
}
@@ -121,7 +121,7 @@ static int xenpaging_wait_for_event_or_t
port = xc_evtchn_pending(xce);
if ( port == -1 )
{
- ERROR("Failed to read port from event channel");
+ PERROR("Failed to read port from event channel");
rc = -1;
goto err;
}
@@ -129,7 +129,7 @@ static int xenpaging_wait_for_event_or_t
rc = xc_evtchn_unmask(xce, port);
if ( rc < 0 )
{
- ERROR("Failed to unmask event channel port");
+ PERROR("Failed to unmask event channel port");
}
}
err:
@@ -185,7 +185,7 @@ static xenpaging_t *xenpaging_init(domid
paging->xs_handle = xs_open(0);
if ( paging->xs_handle == NULL )
{
- ERROR("Error initialising xenstore connection");
+ PERROR("Error initialising xenstore connection");
goto err;
}
@@ -193,7 +193,7 @@ static xenpaging_t *xenpaging_init(domid
snprintf(watch_token, sizeof(watch_token), "%u", domain_id);
if ( xs_watch(paging->xs_handle, "@releaseDomain", watch_token) == false )
{
- ERROR("Could not bind to shutdown watch\n");
+ PERROR("Could not bind to shutdown watch\n");
goto err;
}
@@ -214,7 +214,7 @@ static xenpaging_t *xenpaging_init(domid
paging->mem_event.shared_page = init_page();
if ( paging->mem_event.shared_page == NULL )
{
- ERROR("Error initialising shared page");
+ PERROR("Error initialising shared page");
goto err;
}
@@ -222,7 +222,7 @@ static xenpaging_t *xenpaging_init(domid
paging->mem_event.ring_page = init_page();
if ( paging->mem_event.ring_page == NULL )
{
- ERROR("Error initialising ring page");
+ PERROR("Error initialising ring page");
goto err;
}
@@ -249,7 +249,7 @@ static xenpaging_t *xenpaging_init(domid
ERROR("xenpaging not supported in a PoD guest");
break;
default:
- ERROR("Error initialising shared page: %s", strerror(errno));
+ PERROR("Error initialising shared page");
break;
}
goto err;
@@ -259,7 +259,7 @@ static xenpaging_t *xenpaging_init(domid
paging->mem_event.xce_handle = xc_evtchn_open(NULL, 0);
if ( paging->mem_event.xce_handle == NULL )
{
- ERROR("Failed to open event channel");
+ PERROR("Failed to open event channel");
goto err;
}
@@ -269,7 +269,7 @@ static xenpaging_t *xenpaging_init(domid
paging->mem_event.shared_page->port);
if ( rc < 0 )
{
- ERROR("Failed to bind event channel");
+ PERROR("Failed to bind event channel");
goto err;
}
@@ -279,7 +279,7 @@ static xenpaging_t *xenpaging_init(domid
paging->domain_info = malloc(sizeof(xc_domaininfo_t));
if ( paging->domain_info == NULL )
{
- ERROR("Error allocating memory for domain info");
+ PERROR("Error allocating memory for domain info");
goto err;
}
@@ -287,7 +287,7 @@ static xenpaging_t *xenpaging_init(domid
paging->domain_info);
if ( rc != 1 )
{
- ERROR("Error getting domain info");
+ PERROR("Error getting domain info");
goto err;
}
@@ -295,7 +295,7 @@ static xenpaging_t *xenpaging_init(domid
paging->bitmap = bitmap_alloc(paging->domain_info->max_pages);
if ( !paging->bitmap )
{
- ERROR("Error allocating bitmap");
+ PERROR("Error allocating bitmap");
goto err;
}
DPRINTF("max_pages = %"PRIx64"\n", paging->domain_info->max_pages);
@@ -311,7 +311,7 @@ static xenpaging_t *xenpaging_init(domid
rc = policy_init(paging);
if ( rc != 0 )
{
- ERROR("Error initialising policy");
+ PERROR("Error initialising policy");
goto err;
}
@@ -358,14 +358,14 @@ static int xenpaging_teardown(xenpaging_
rc = xc_mem_paging_disable(xch, paging->mem_event.domain_id);
if ( rc != 0 )
{
- ERROR("Error tearing down domain paging in xen");
+ PERROR("Error tearing down domain paging in xen");
}
/* Unbind VIRQ */
rc = xc_evtchn_unbind(paging->mem_event.xce_handle, paging->mem_event.port);
if ( rc != 0 )
{
- ERROR("Error unbinding event port");
+ PERROR("Error unbinding event port");
}
paging->mem_event.port = -1;
@@ -373,7 +373,7 @@ static int xenpaging_teardown(xenpaging_
rc = xc_evtchn_close(paging->mem_event.xce_handle);
if ( rc != 0 )
{
- ERROR("Error closing event channel");
+ PERROR("Error closing event channel");
}
paging->mem_event.xce_handle = NULL;
@@ -384,7 +384,7 @@ static int xenpaging_teardown(xenpaging_
rc = xc_interface_close(xch);
if ( rc != 0 )
{
- ERROR("Error closing connection to xen");
+ PERROR("Error closing connection to xen");
}
return 0;
@@ -444,7 +444,7 @@ static int xenpaging_evict_page(xenpagin
PROT_READ | PROT_WRITE, &gfn, 1);
if ( page == NULL )
{
- ERROR("Error mapping page");
+ PERROR("Error mapping page");
goto out;
}
@@ -452,8 +452,8 @@ static int xenpaging_evict_page(xenpagin
ret = write_page(fd, page, i);
if ( ret != 0 )
{
+ PERROR("Error copying page");
munmap(page, PAGE_SIZE);
- ERROR("Error copying page");
goto out;
}
@@ -464,7 +464,7 @@ static int xenpaging_evict_page(xenpagin
victim->gfn);
if ( ret != 0 )
{
- ERROR("Error evicting page");
+ PERROR("Error evicting page");
goto out;
}
@@ -520,7 +520,7 @@ static int xenpaging_populate_page(xenpa
sleep(1);
continue;
}
- ERROR("Error preparing for page in");
+ PERROR("Error preparing for page in");
goto out_map;
}
}
@@ -532,7 +532,7 @@ static int xenpaging_populate_page(xenpa
PROT_READ | PROT_WRITE, &gfn, 1);
if ( page == NULL )
{
- ERROR("Error mapping page: page is null");
+ PERROR("Error mapping page: page is null");
goto out_map;
}
@@ -540,7 +540,7 @@ static int xenpaging_populate_page(xenpa
ret = read_page(fd, page, i);
if ( ret != 0 )
{
- ERROR("Error reading page");
+ PERROR("Error reading page");
goto out;
}
@@ -579,7 +579,7 @@ static int evict_victim(xenpaging_t *pag
{
if ( j++ % 1000 == 0 )
if ( xenpaging_mem_paging_flush_ioemu_cache(paging) )
- ERROR("Error flushing ioemu cache");
+ PERROR("Error flushing ioemu cache");
}
}
while ( ret );
@@ -670,7 +670,7 @@ int main(int argc, char *argv[])
rc = xenpaging_wait_for_event_or_timeout(paging);
if ( rc < 0 )
{
- ERROR("Error getting event");
+ PERROR("Error getting event");
goto out;
}
else if ( rc != 0 )
@@ -710,7 +710,7 @@ int main(int argc, char *argv[])
rc = xenpaging_populate_page(paging, req.gfn, fd, i);
if ( rc != 0 )
{
- ERROR("Error populating page");
+ PERROR("Error populating page");
goto out;
}
}
@@ -723,7 +723,7 @@ int main(int argc, char *argv[])
rc = xenpaging_resume_page(paging, &rsp, 1);
if ( rc != 0 )
{
- ERROR("Error resuming page");
+ PERROR("Error resuming page");
goto out;
}
@@ -754,7 +754,7 @@ int main(int argc, char *argv[])
rc = xenpaging_resume_page(paging, &rsp, 0);
if ( rc != 0 )
{
- ERROR("Error resuming");
+ PERROR("Error resuming");
goto out;
}
}
++++++ 24211-xenpaging_simplify_file_op.patch ++++++
changeset: 24211:8ddac056a89e
user: Olaf Hering
date: Sun Nov 20 17:01:39 2011 +0100
files: tools/xenpaging/file_ops.c
description:
xenpaging: simplify file_op
Catch lseek() errors.
Use -1 as return value and let caller read errno.
Remove const casts from buffer pointers, the page is writeable.
Use wrapper for write() which matches the read() prototype.
Remove unused stdarg.h inclusion.
Remove unused macro.
Signed-off-by: Olaf Hering
Committed-by: Ian Jackson
---
tools/xenpaging/file_ops.c | 29 +++++++++--------------------
1 file changed, 9 insertions(+), 20 deletions(-)
Index: xen-4.1.2-testing/tools/xenpaging/file_ops.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/file_ops.c
+++ xen-4.1.2-testing/tools/xenpaging/file_ops.c
@@ -21,55 +21,44 @@
#include
-#include
#include
-
-#define page_offset(_pfn) (((off_t)(_pfn)) << PAGE_SHIFT)
-
-
static int file_op(int fd, void *page, int i,
- ssize_t (*fn)(int, const void *, size_t))
+ ssize_t (*fn)(int, void *, size_t))
{
off_t seek_ret;
- int total;
+ int total = 0;
int bytes;
- int ret;
seek_ret = lseek(fd, i << PAGE_SHIFT, SEEK_SET);
+ if ( seek_ret == (off_t)-1 )
+ return -1;
- total = 0;
while ( total < PAGE_SIZE )
{
bytes = fn(fd, page + total, PAGE_SIZE - total);
if ( bytes <= 0 )
- {
- ret = -errno;
- goto err;
- }
+ return -1;
total += bytes;
}
return 0;
-
- err:
- return ret;
}
-static ssize_t my_read(int fd, const void *buf, size_t count)
+static ssize_t my_write(int fd, void *buf, size_t count)
{
- return read(fd, (void *)buf, count);
+ return write(fd, buf, count);
}
int read_page(int fd, void *page, int i)
{
- return file_op(fd, page, i, &my_read);
+ return file_op(fd, page, i, &read);
}
int write_page(int fd, void *page, int i)
{
- return file_op(fd, page, i, &write);
+ return file_op(fd, page, i, &my_write);
}
++++++ 24212-xenpaging_print_gfn_in_failure_case.patch ++++++
changeset: 24212:fbc31627adde
user: Olaf Hering
date: Sun Nov 20 17:01:41 2011 +0100
files: tools/xenpaging/xenpaging.c
description:
xenpaging: print gfn in failure case
Signed-off-by: Olaf Hering
Committed-by: Ian Jackson
---
tools/xenpaging/xenpaging.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c
@@ -444,7 +444,7 @@ static int xenpaging_evict_page(xenpagin
PROT_READ | PROT_WRITE, &gfn, 1);
if ( page == NULL )
{
- PERROR("Error mapping page");
+ PERROR("Error mapping page %lx", victim->gfn);
goto out;
}
@@ -452,7 +452,7 @@ static int xenpaging_evict_page(xenpagin
ret = write_page(fd, page, i);
if ( ret != 0 )
{
- PERROR("Error copying page");
+ PERROR("Error copying page %lx", victim->gfn);
munmap(page, PAGE_SIZE);
goto out;
}
@@ -464,7 +464,7 @@ static int xenpaging_evict_page(xenpagin
victim->gfn);
if ( ret != 0 )
{
- PERROR("Error evicting page");
+ PERROR("Error evicting page %lx", victim->gfn);
goto out;
}
@@ -520,7 +520,7 @@ static int xenpaging_populate_page(xenpa
sleep(1);
continue;
}
- PERROR("Error preparing for page in");
+ PERROR("Error preparing %"PRI_xen_pfn" for page-in", gfn);
goto out_map;
}
}
@@ -532,7 +532,7 @@ static int xenpaging_populate_page(xenpa
PROT_READ | PROT_WRITE, &gfn, 1);
if ( page == NULL )
{
- PERROR("Error mapping page: page is null");
+ PERROR("Error mapping page %"PRI_xen_pfn": page is null", gfn);
goto out_map;
}
@@ -540,7 +540,7 @@ static int xenpaging_populate_page(xenpa
ret = read_page(fd, page, i);
if ( ret != 0 )
{
- PERROR("Error reading page");
+ PERROR("Error reading page %"PRI_xen_pfn"", gfn);
goto out;
}
@@ -710,7 +710,7 @@ int main(int argc, char *argv[])
rc = xenpaging_populate_page(paging, req.gfn, fd, i);
if ( rc != 0 )
{
- PERROR("Error populating page");
+ PERROR("Error populating page %"PRIx64"", req.gfn);
goto out;
}
}
@@ -723,7 +723,7 @@ int main(int argc, char *argv[])
rc = xenpaging_resume_page(paging, &rsp, 1);
if ( rc != 0 )
{
- PERROR("Error resuming page");
+ PERROR("Error resuming page %"PRIx64"", req.gfn);
goto out;
}
@@ -754,7 +754,7 @@ int main(int argc, char *argv[])
rc = xenpaging_resume_page(paging, &rsp, 0);
if ( rc != 0 )
{
- PERROR("Error resuming");
+ PERROR("Error resuming page %"PRIx64"", req.gfn);
goto out;
}
}
++++++ 24213-xenpaging_update_xenpaging_init.patch ++++++
changeset: 24213:e3cbbad72382
user: Olaf Hering
date: Sun Nov 20 17:02:22 2011 +0100
files: tools/xenpaging/xenpaging.c
description:
xenpaging: update xenpaging_init
Move comment about xc_handle to the right place.
Allocate paging early and use calloc.
Signed-off-by: Olaf Hering
Committed-by: Ian Jackson
---
tools/xenpaging/xenpaging.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c
@@ -169,18 +169,21 @@ static xenpaging_t *xenpaging_init(domid
char *p;
int rc;
+ /* Allocate memory */
+ paging = calloc(1, sizeof(xenpaging_t));
+ if ( !paging )
+ goto err;
+
if ( getenv("XENPAGING_DEBUG") )
dbg = (xentoollog_logger *)xtl_createlogger_stdiostream(stderr, XTL_DEBUG, 0);
- xch = xc_interface_open(dbg, NULL, 0);
+
+ /* Open connection to xen */
+ paging->xc_handle = xch = xc_interface_open(dbg, NULL, 0);
if ( !xch )
- goto err_iface;
+ goto err;
DPRINTF("xenpaging init\n");
- /* Allocate memory */
- paging = malloc(sizeof(xenpaging_t));
- memset(paging, 0, sizeof(xenpaging_t));
-
/* Open connection to xenstore */
paging->xs_handle = xs_open(0);
if ( paging->xs_handle == NULL )
@@ -204,9 +207,6 @@ static xenpaging_t *xenpaging_init(domid
DPRINTF("Setting policy mru_size to %d\n", paging->policy_mru_size);
}
- /* Open connection to xen */
- paging->xc_handle = xch;
-
/* Set domain id */
paging->mem_event.domain_id = domain_id;
@@ -322,7 +322,8 @@ static xenpaging_t *xenpaging_init(domid
{
if ( paging->xs_handle )
xs_close(paging->xs_handle);
- xc_interface_close(xch);
+ if ( xch )
+ xc_interface_close(xch);
if ( paging->mem_event.shared_page )
{
munlock(paging->mem_event.shared_page, PAGE_SIZE);
@@ -340,7 +341,6 @@ static xenpaging_t *xenpaging_init(domid
free(paging);
}
- err_iface:
return NULL;
}
++++++ 24214-xenpaging_remove_xc_dominfo_t_from_paging_t.patch ++++++
changeset: 24214:f06595abfa88
user: Olaf Hering
date: Sun Nov 20 17:02:36 2011 +0100
files: tools/xenpaging/policy_default.c tools/xenpaging/xenpaging.c tools/xenpaging/xenpaging.h
description:
xenpaging: remove xc_dominfo_t from paging_t
Remove xc_dominfo_t from paging_t, record only max_pages.
This value is used to setup internal data structures.
Signed-off-by: Olaf Hering
Committed-by: Ian Jackson
---
tools/xenpaging/policy_default.c | 8 ++++----
tools/xenpaging/xenpaging.c | 27 +++++++++++----------------
tools/xenpaging/xenpaging.h | 4 ++--
3 files changed, 17 insertions(+), 22 deletions(-)
Index: xen-4.1.2-testing/tools/xenpaging/policy_default.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/policy_default.c
+++ xen-4.1.2-testing/tools/xenpaging/policy_default.c
@@ -41,17 +41,17 @@ int policy_init(xenpaging_t *paging)
int i;
int rc = -ENOMEM;
+ max_pages = paging->max_pages;
+
/* Allocate bitmap for pages not to page out */
- bitmap = bitmap_alloc(paging->domain_info->max_pages);
+ bitmap = bitmap_alloc(max_pages);
if ( !bitmap )
goto out;
/* Allocate bitmap to track unusable pages */
- unconsumed = bitmap_alloc(paging->domain_info->max_pages);
+ unconsumed = bitmap_alloc(max_pages);
if ( !unconsumed )
goto out;
- max_pages = paging->domain_info->max_pages;
-
/* Initialise MRU list of paged in pages */
if ( paging->policy_mru_size > 0 )
mru_size = paging->policy_mru_size;
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c
@@ -164,6 +164,7 @@ static void *init_page(void)
static xenpaging_t *xenpaging_init(domid_t domain_id, int num_pages)
{
xenpaging_t *paging;
+ xc_domaininfo_t domain_info;
xc_interface *xch;
xentoollog_logger *dbg = NULL;
char *p;
@@ -275,34 +276,29 @@ static xenpaging_t *xenpaging_init(domid
paging->mem_event.port = rc;
- /* Get domaininfo */
- paging->domain_info = malloc(sizeof(xc_domaininfo_t));
- if ( paging->domain_info == NULL )
- {
- PERROR("Error allocating memory for domain info");
- goto err;
- }
-
rc = xc_domain_getinfolist(xch, paging->mem_event.domain_id, 1,
- paging->domain_info);
+ &domain_info);
if ( rc != 1 )
{
PERROR("Error getting domain info");
goto err;
}
+ /* Record number of max_pages */
+ paging->max_pages = domain_info.max_pages;
+
/* Allocate bitmap for tracking pages that have been paged out */
- paging->bitmap = bitmap_alloc(paging->domain_info->max_pages);
+ paging->bitmap = bitmap_alloc(paging->max_pages);
if ( !paging->bitmap )
{
PERROR("Error allocating bitmap");
goto err;
}
- DPRINTF("max_pages = %"PRIx64"\n", paging->domain_info->max_pages);
+ DPRINTF("max_pages = %d\n", paging->max_pages);
- if ( num_pages < 0 || num_pages > paging->domain_info->max_pages )
+ if ( num_pages < 0 || num_pages > paging->max_pages )
{
- num_pages = paging->domain_info->max_pages;
+ num_pages = paging->max_pages;
DPRINTF("setting num_pages to %d\n", num_pages);
}
paging->num_pages = num_pages;
@@ -337,7 +333,6 @@ static xenpaging_t *xenpaging_init(domid
}
free(paging->bitmap);
- free(paging->domain_info);
free(paging);
}
@@ -765,7 +760,7 @@ int main(int argc, char *argv[])
if ( interrupted == SIGTERM || interrupted == SIGINT )
{
int num = 0;
- for ( i = 0; i < paging->domain_info->max_pages; i++ )
+ for ( i = 0; i < paging->max_pages; i++ )
{
if ( test_bit(i, paging->bitmap) )
{
@@ -781,7 +776,7 @@ int main(int argc, char *argv[])
*/
if ( num )
page_in_trigger();
- else if ( i == paging->domain_info->max_pages )
+ else if ( i == paging->max_pages )
break;
}
else
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h
@@ -44,11 +44,11 @@ typedef struct xenpaging {
xc_interface *xc_handle;
struct xs_handle *xs_handle;
- xc_domaininfo_t *domain_info;
-
unsigned long *bitmap;
mem_event_t mem_event;
+ /* number of pages for which data structures were allocated */
+ int max_pages;
int num_pages;
int policy_mru_size;
unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE];
++++++ 24215-xenpaging_track_the_number_of_paged-out_pages.patch ++++++
changeset: 24215:dc7dabe2fe99
user: Olaf Hering
date: Sun Nov 20 17:02:38 2011 +0100
files: tools/xenpaging/xenpaging.c tools/xenpaging/xenpaging.h
description:
xenpaging: track the number of paged-out pages
This change is required by subsequent changes.
Signed-off-by: Olaf Hering
Committed-by: Ian Jackson
---
tools/xenpaging/xenpaging.c | 8 ++++++++
tools/xenpaging/xenpaging.h | 1 +
2 files changed, 9 insertions(+)
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c
@@ -467,6 +467,9 @@ static int xenpaging_evict_page(xenpagin
/* Notify policy of page being paged out */
policy_notify_paged_out(victim->gfn);
+ /* Record number of evicted pages */
+ paging->num_paged_out++;
+
out:
return ret;
}
@@ -480,8 +483,13 @@ static int xenpaging_resume_page(xenpagi
/* Notify policy of page being paged in */
if ( notify_policy )
+ {
policy_notify_paged_in(rsp->gfn);
+ /* Record number of resumed pages */
+ paging->num_paged_out--;
+ }
+
/* Tell Xen page is ready */
ret = xc_mem_paging_resume(paging->xc_handle, paging->mem_event.domain_id,
rsp->gfn);
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h
@@ -49,6 +49,7 @@ typedef struct xenpaging {
mem_event_t mem_event;
/* number of pages for which data structures were allocated */
int max_pages;
+ int num_paged_out;
int num_pages;
int policy_mru_size;
unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE];
++++++ 24216-xenpaging_move_page_add-resume_loops_into_its_own_function..patch ++++++
changeset: 24216:4fe585c2a3e5
user: Olaf Hering
date: Sun Nov 20 17:02:39 2011 +0100
files: tools/xenpaging/xenpaging.c
description:
xenpaging: move page add/resume loops into its own function.
Move page resume loop into its own function.
Move page eviction loop into its own function.
Allocate all possible slots in a paging file to allow growing and
shrinking of the number of paged-out pages. Adjust other places to
iterate over all slots.
This change is required by subsequent patches.
v2:
- check if victims allocation succeeded
Signed-off-by: Olaf Hering
Committed-by: Ian Jackson
---
tools/xenpaging/xenpaging.c | 94 ++++++++++++++++++++++++++++----------------
1 file changed, 61 insertions(+), 33 deletions(-)
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c
@@ -553,6 +553,27 @@ static int xenpaging_populate_page(xenpa
return ret;
}
+/* Trigger a page-in for a batch of pages */
+static void resume_pages(xenpaging_t *paging, int num_pages)
+{
+ xc_interface *xch = paging->xc_handle;
+ int i, num = 0;
+
+ for ( i = 0; i < paging->max_pages && num < num_pages; i++ )
+ {
+ if ( test_bit(i, paging->bitmap) )
+ {
+ paging->pagein_queue[num] = i;
+ num++;
+ if ( num == XENPAGING_PAGEIN_QUEUE_SIZE )
+ break;
+ }
+ }
+ /* num may be less than num_pages, caller has to try again */
+ if ( num )
+ page_in_trigger();
+}
+
static int evict_victim(xenpaging_t *paging,
xenpaging_victim_t *victim, int fd, int i)
{
@@ -596,6 +617,30 @@ static int evict_victim(xenpaging_t *pag
return ret;
}
+/* Evict a batch of pages and write them to a free slot in the paging file */
+static int evict_pages(xenpaging_t *paging, int fd, xenpaging_victim_t *victims, int num_pages)
+{
+ xc_interface *xch = paging->xc_handle;
+ int rc, slot, num = 0;
+
+ for ( slot = 0; slot < paging->max_pages && num < num_pages; slot++ )
+ {
+ /* Slot is allocated */
+ if ( victims[slot].gfn != INVALID_MFN )
+ continue;
+
+ rc = evict_victim(paging, &victims[slot], fd, slot);
+ if ( rc == -ENOSPC )
+ break;
+ if ( rc == -EINTR )
+ break;
+ if ( num && num % 100 == 0 )
+ DPRINTF("%d pages evicted\n", num);
+ num++;
+ }
+ return num;
+}
+
int main(int argc, char *argv[])
{
struct sigaction act;
@@ -638,7 +683,14 @@ int main(int argc, char *argv[])
return 2;
}
- victims = calloc(paging->num_pages, sizeof(xenpaging_victim_t));
+ /* Allocate upper limit of pages to allow growing and shrinking */
+ victims = calloc(paging->max_pages, sizeof(xenpaging_victim_t));
+ if ( !victims )
+ goto out;
+
+ /* Mark all slots as unallocated */
+ for ( i = 0; i < paging->max_pages; i++ )
+ victims[i].gfn = INVALID_MFN;
/* ensure that if we get a signal, we'll do cleanup, then exit */
act.sa_handler = close_handler;
@@ -652,18 +704,7 @@ int main(int argc, char *argv[])
/* listen for page-in events to stop pager */
create_page_in_thread(paging);
- /* Evict pages */
- for ( i = 0; i < paging->num_pages; i++ )
- {
- rc = evict_victim(paging, &victims[i], fd, i);
- if ( rc == -ENOSPC )
- break;
- if ( rc == -EINTR )
- break;
- if ( i % 100 == 0 )
- DPRINTF("%d pages evicted\n", i);
- }
-
+ i = evict_pages(paging, fd, victims, paging->num_pages);
DPRINTF("%d pages evicted. Done.\n", i);
/* Swap pages in and out */
@@ -689,13 +730,13 @@ int main(int argc, char *argv[])
if ( test_and_clear_bit(req.gfn, paging->bitmap) )
{
/* Find where in the paging file to read from */
- for ( i = 0; i < paging->num_pages; i++ )
+ for ( i = 0; i < paging->max_pages; i++ )
{
if ( victims[i].gfn == req.gfn )
break;
}
- if ( i >= paging->num_pages )
+ if ( i >= paging->max_pages )
{
DPRINTF("Couldn't find page %"PRIx64"\n", req.gfn);
goto out;
@@ -767,25 +808,12 @@ int main(int argc, char *argv[])
/* Write all pages back into the guest */
if ( interrupted == SIGTERM || interrupted == SIGINT )
{
- int num = 0;
- for ( i = 0; i < paging->max_pages; i++ )
- {
- if ( test_bit(i, paging->bitmap) )
- {
- paging->pagein_queue[num] = i;
- num++;
- if ( num == XENPAGING_PAGEIN_QUEUE_SIZE )
- break;
- }
- }
- /*
- * One more round if there are still pages to process.
- * If no more pages to process, exit loop.
- */
- if ( num )
- page_in_trigger();
- else if ( i == paging->max_pages )
+ /* If no more pages to process, exit loop. */
+ if ( !paging->num_paged_out )
break;
+
+ /* One more round if there are still pages to process. */
+ resume_pages(paging, paging->num_paged_out);
}
else
{
++++++ 24217-xenpaging_improve_mainloop_exit_handling.patch ++++++
changeset: 24217:b531f5ceddf0
user: Olaf Hering
date: Sun Nov 20 17:02:39 2011 +0100
files: tools/xenpaging/xenpaging.c
description:
xenpaging: improve mainloop exit handling
Remove the if/else logic to exit from the in case a signal arrives.
Update comments.
Signed-off-by: Olaf Hering
Committed-by: Ian Jackson
---
tools/xenpaging/xenpaging.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c
@@ -805,7 +805,7 @@ int main(int argc, char *argv[])
}
}
- /* Write all pages back into the guest */
+ /* If interrupted, write all pages back into the guest */
if ( interrupted == SIGTERM || interrupted == SIGINT )
{
/* If no more pages to process, exit loop. */
@@ -814,13 +814,15 @@ int main(int argc, char *argv[])
/* One more round if there are still pages to process. */
resume_pages(paging, paging->num_paged_out);
+
+ /* Resume main loop */
+ continue;
}
- else
- {
- /* Exit on any other signal */
- if ( interrupted )
- break;
- }
+
+ /* Exit main loop on any other signal */
+ if ( interrupted )
+ break;
+
}
DPRINTF("xenpaging got signal %d\n", interrupted);
++++++ 24218-libxc_add_bitmap_clear_function.patch ++++++
changeset: 24218:a2b4ae2becdf
user: Olaf Hering
date: Sun Nov 20 17:02:40 2011 +0100
files: tools/libxc/xc_bitops.h
description:
libxc: add bitmap_clear function
Signed-off-by: Olaf Hering
Committed-by: Ian Jackson
---
tools/libxc/xc_bitops.h | 6 ++++++
1 file changed, 6 insertions(+)
Index: xen-4.1.2-testing/tools/libxc/xc_bitops.h
===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xc_bitops.h
+++ xen-4.1.2-testing/tools/libxc/xc_bitops.h
@@ -4,6 +4,7 @@
/* bitmap operations for single threaded access */
#include
+#include
#define BITS_PER_LONG (sizeof(unsigned long) * 8)
#define ORDER_LONG (sizeof(unsigned long) == 4 ? 5 : 6)
@@ -25,6 +26,11 @@ static inline unsigned long *bitmap_allo
return calloc(1, bitmap_size(nr_bits));
}
+static inline void bitmap_clear(unsigned long *addr, int nr_bits)
+{
+ memset(addr, 0, bitmap_size(nr_bits));
+}
+
static inline int test_bit(int nr, volatile unsigned long *addr)
{
return (BITMAP_ENTRY(nr, addr) >> BITMAP_SHIFT(nr)) & 1;
++++++ 24219-xenpaging_retry_unpageable_gfns.patch ++++++
changeset: 24219:8eba32b9598c
user: Olaf Hering
date: Sun Nov 20 17:02:41 2011 +0100
files: tools/xenpaging/policy_default.c
description:
xenpaging: retry unpageable gfns
Nomination of gfns can fail, but may succeed later.
Thats the case for a guest that starts ballooned.
v2:
- print debug when clearing uncosumed happens
Signed-off-by: Olaf Hering
Committed-by: Ian Jackson
---
tools/xenpaging/policy_default.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
Index: xen-4.1.2-testing/tools/xenpaging/policy_default.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/policy_default.c
+++ xen-4.1.2-testing/tools/xenpaging/policy_default.c
@@ -32,6 +32,7 @@ static unsigned int i_mru;
static unsigned int mru_size;
static unsigned long *bitmap;
static unsigned long *unconsumed;
+static unsigned int unconsumed_cleared;
static unsigned long current_gfn;
static unsigned long max_pages;
@@ -87,8 +88,21 @@ int policy_choose_victim(xenpaging_t *pa
current_gfn++;
if ( current_gfn >= max_pages )
current_gfn = 0;
+ /* Could not nominate any gfn */
if ( wrap == current_gfn )
{
+ /* Count wrap arounds */
+ unconsumed_cleared++;
+ /* Force retry every few seconds (depends on poll() timeout) */
+ if ( unconsumed_cleared > 123)
+ {
+ /* Force retry of unconsumed gfns */
+ bitmap_clear(unconsumed, max_pages);
+ unconsumed_cleared = 0;
+ DPRINTF("clearing unconsumed, wrap %lx", wrap);
+ /* One more round before returning ENOSPC */
+ continue;
+ }
victim->gfn = INVALID_MFN;
return -ENOSPC;
}
++++++ 24220-xenpaging_install_into_LIBEXEC_dir.patch ++++++
changeset: 24220:2087f21befc2
user: Olaf Hering
date: Sun Nov 20 17:02:42 2011 +0100
files: tools/xenpaging/Makefile
description:
xenpaging: install into LIBEXEC dir
In preparation of upcoming libxl integration,
move xenpaging binary from /usr/sbin/ to /usr/lib/xen/bin/
Signed-off-by: Olaf Hering
Committed-by: Ian Jackson
---
tools/xenpaging/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: xen-4.1.2-testing/tools/xenpaging/Makefile
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/Makefile
+++ xen-4.1.2-testing/tools/xenpaging/Makefile
@@ -29,8 +29,8 @@ xenpaging: $(OBJS)
install: all
$(INSTALL_DIR) $(DESTDIR)/var/lib/xen/xenpaging
- $(INSTALL_DIR) $(DESTDIR)$(SBINDIR)
- $(INSTALL_PROG) $(IBINS) $(DESTDIR)$(SBINDIR)
+ $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)
+ $(INSTALL_PROG) $(IBINS) $(DESTDIR)$(LIBEXEC)
clean:
rm -f *.o *~ $(DEPS) xen TAGS $(IBINS) $(LIB)
++++++ 24221-xenpaging_add_XEN_PAGING_DIR_-_libxl_xenpaging_dir_path.patch ++++++
changeset: 24221:cd5948592b10
user: Olaf Hering
date: Sun Nov 20 17:02:43 2011 +0100
files: Config.mk config/StdGNU.mk tools/libxl/libxl.h tools/libxl/libxl_paths.c tools/xenpaging/Makefile
description:
xenpaging: add XEN_PAGING_DIR / libxl_xenpaging_dir_path()
Signed-off-by: Olaf Hering
Committed-by: Ian Jackson
---
Config.mk | 1 +
config/StdGNU.mk | 2 ++
tools/xenpaging/Makefile | 2 +-
3 files changed, 4 insertions(+), 1 deletion(-)
Index: xen-4.1.2-testing/Config.mk
===================================================================
--- xen-4.1.2-testing.orig/Config.mk
+++ xen-4.1.2-testing/Config.mk
@@ -124,6 +124,7 @@ define buildmakevars2file-closure
echo "XEN_CONFIG_DIR=\"$(XEN_CONFIG_DIR)\"" >> $(1).tmp; \
echo "XEN_SCRIPT_DIR=\"$(XEN_SCRIPT_DIR)\"" >> $(1).tmp; \
echo "XEN_LOCK_DIR=\"$(XEN_LOCK_DIR)\"" >> $(1).tmp; \
+ echo "XEN_PAGING_DIR=\"$(XEN_PAGING_DIR)\"" >> $(1).tmp; \
if ! cmp $(1).tmp $(1); then mv -f $(1).tmp $(1); fi
endef
Index: xen-4.1.2-testing/config/StdGNU.mk
===================================================================
--- xen-4.1.2-testing.orig/config/StdGNU.mk
+++ xen-4.1.2-testing/config/StdGNU.mk
@@ -46,9 +46,11 @@ PRIVATE_BINDIR = $(PRIVATE_PREFIX)/bin
ifeq ($(PREFIX),/usr)
CONFIG_DIR = /etc
XEN_LOCK_DIR = /var/lock
+XEN_PAGING_DIR = /var/lib/xen/xenpaging
else
CONFIG_DIR = $(PREFIX)/etc
XEN_LOCK_DIR = $(PREFIX)/var/lock
+XEN_PAGING_DIR = $(PREFIX)/var/lib/xen/xenpaging
endif
SYSCONFIG_DIR = $(CONFIG_DIR)/$(CONFIG_LEAF_DIR)
Index: xen-4.1.2-testing/tools/xenpaging/Makefile
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/Makefile
+++ xen-4.1.2-testing/tools/xenpaging/Makefile
@@ -28,7 +28,7 @@ xenpaging: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
install: all
- $(INSTALL_DIR) $(DESTDIR)/var/lib/xen/xenpaging
+ $(INSTALL_DIR) $(DESTDIR)$(XEN_PAGING_DIR)
$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)
$(INSTALL_PROG) $(IBINS) $(DESTDIR)$(LIBEXEC)
++++++ 24222-xenpaging_use_guests_tot_pages_as_working_target.patch ++++++
changeset: 24222:286a741b4d86
user: Olaf Hering
date: Sun Nov 20 17:02:45 2011 +0100
files: tools/xenpaging/policy_default.c tools/xenpaging/xenpaging.c tools/xenpaging/xenpaging.h
description:
xenpaging: use guests tot_pages as working target
This change reverses the task of xenpaging. Before this change a fixed number
of pages was paged out. With this change the guest will not have access to
more than the given number of pages at the same time.
Signed-off-by: Olaf Hering
Committed-by: Ian Jackson
---
tools/xenpaging/policy_default.c | 1
tools/xenpaging/xenpaging.c | 78 ++++++++++++++++++++++++++++++---------
tools/xenpaging/xenpaging.h | 2 -
3 files changed, 61 insertions(+), 20 deletions(-)
Index: xen-4.1.2-testing/tools/xenpaging/policy_default.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/policy_default.c
+++ xen-4.1.2-testing/tools/xenpaging/policy_default.c
@@ -71,7 +71,6 @@ int policy_init(xenpaging_t *paging)
/* Start in the middle to avoid paging during BIOS startup */
current_gfn = max_pages / 2;
- current_gfn -= paging->num_pages / 2;
rc = 0;
out:
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c
@@ -136,6 +136,21 @@ err:
return rc;
}
+static int xenpaging_get_tot_pages(xenpaging_t *paging)
+{
+ xc_interface *xch = paging->xc_handle;
+ xc_domaininfo_t domain_info;
+ int rc;
+
+ rc = xc_domain_getinfolist(xch, paging->mem_event.domain_id, 1, &domain_info);
+ if ( rc != 1 )
+ {
+ PERROR("Error getting domain info");
+ return -1;
+ }
+ return domain_info.tot_pages;
+}
+
static void *init_page(void)
{
void *buffer;
@@ -161,7 +176,7 @@ static void *init_page(void)
return NULL;
}
-static xenpaging_t *xenpaging_init(domid_t domain_id, int num_pages)
+static xenpaging_t *xenpaging_init(domid_t domain_id, int target_tot_pages)
{
xenpaging_t *paging;
xc_domaininfo_t domain_info;
@@ -296,12 +311,7 @@ static xenpaging_t *xenpaging_init(domid
}
DPRINTF("max_pages = %d\n", paging->max_pages);
- if ( num_pages < 0 || num_pages > paging->max_pages )
- {
- num_pages = paging->max_pages;
- DPRINTF("setting num_pages to %d\n", num_pages);
- }
- paging->num_pages = num_pages;
+ paging->target_tot_pages = target_tot_pages;
/* Initialise policy */
rc = policy_init(paging);
@@ -648,7 +658,9 @@ int main(int argc, char *argv[])
xenpaging_victim_t *victims;
mem_event_request_t req;
mem_event_response_t rsp;
+ int num, prev_num = 0;
int i;
+ int tot_pages;
int rc = -1;
int rc1;
xc_interface *xch;
@@ -659,7 +671,7 @@ int main(int argc, char *argv[])
if ( argc != 3 )
{
- fprintf(stderr, "Usage: %s \n", argv[0]);
+ fprintf(stderr, "Usage: %s \n", argv[0]);
return -1;
}
@@ -672,7 +684,7 @@ int main(int argc, char *argv[])
}
xch = paging->xc_handle;
- DPRINTF("starting %s %u %d\n", argv[0], paging->mem_event.domain_id, paging->num_pages);
+ DPRINTF("starting %s %u %d\n", argv[0], paging->mem_event.domain_id, paging->target_tot_pages);
/* Open file */
sprintf(filename, "page_cache_%u", paging->mem_event.domain_id);
@@ -704,9 +716,6 @@ int main(int argc, char *argv[])
/* listen for page-in events to stop pager */
create_page_in_thread(paging);
- i = evict_pages(paging, fd, victims, paging->num_pages);
- DPRINTF("%d pages evicted. Done.\n", i);
-
/* Swap pages in and out */
while ( 1 )
{
@@ -771,12 +780,8 @@ int main(int argc, char *argv[])
goto out;
}
- /* Evict a new page to replace the one we just paged in,
- * or clear this pagefile slot on exit */
- if ( interrupted )
- victims[i].gfn = INVALID_MFN;
- else
- evict_victim(paging, &victims[i], fd, i);
+ /* Clear this pagefile slot */
+ victims[i].gfn = INVALID_MFN;
}
else
{
@@ -823,6 +828,43 @@ int main(int argc, char *argv[])
if ( interrupted )
break;
+ /* Check if the target has been reached already */
+ tot_pages = xenpaging_get_tot_pages(paging);
+ if ( tot_pages < 0 )
+ goto out;
+
+ /* Resume all pages if paging is disabled or no target was set */
+ if ( paging->target_tot_pages == 0 )
+ {
+ if ( paging->num_paged_out )
+ resume_pages(paging, paging->num_paged_out);
+ }
+ /* Evict more pages if target not reached */
+ else if ( tot_pages > paging->target_tot_pages )
+ {
+ num = tot_pages - paging->target_tot_pages;
+ if ( num != prev_num )
+ {
+ DPRINTF("Need to evict %d pages to reach %d target_tot_pages\n", num, paging->target_tot_pages);
+ prev_num = num;
+ }
+ /* Limit the number of evicts to be able to process page-in requests */
+ if ( num > 42 )
+ num = 42;
+ evict_pages(paging, fd, victims, num);
+ }
+ /* Resume some pages if target not reached */
+ else if ( tot_pages < paging->target_tot_pages && paging->num_paged_out )
+ {
+ num = paging->target_tot_pages - tot_pages;
+ if ( num != prev_num )
+ {
+ DPRINTF("Need to resume %d pages to reach %d target_tot_pages\n", num, paging->target_tot_pages);
+ prev_num = num;
+ }
+ resume_pages(paging, num);
+ }
+
}
DPRINTF("xenpaging got signal %d\n", interrupted);
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h
@@ -50,7 +50,7 @@ typedef struct xenpaging {
/* number of pages for which data structures were allocated */
int max_pages;
int num_paged_out;
- int num_pages;
+ int target_tot_pages;
int policy_mru_size;
unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE];
} xenpaging_t;
++++++ 24223-xenpaging_watch_the_guests_memory-target-tot_pages_xenstore_value.patch ++++++
changeset: 24223:9e3c2ef70c8a
user: Olaf Hering
date: Sun Nov 20 17:02:47 2011 +0100
files: tools/xenpaging/xenpaging.c
description:
xenpaging: watch the guests memory/target-tot_pages xenstore value
Subsequent patches will use xenstored to store the numbers of pages
xenpaging is suppose to page-out.
Remove num_pages and use target_pages instead.
Signed-off-by: Olaf Hering
Committed-by: Ian Jackson
---
tools/xenpaging/xenpaging.c | 51 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 50 insertions(+), 1 deletion(-)
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c
@@ -19,8 +19,10 @@
*/
#define _XOPEN_SOURCE 600
+#define _GNU_SOURCE
#include
+#include
#include
#include
#include
@@ -35,6 +37,10 @@
#include "policy.h"
#include "xenpaging.h"
+/* Defines number of mfns a guest should use at a time, in KiB */
+#define WATCH_TARGETPAGES "memory/target-tot_pages"
+static char *watch_target_tot_pages;
+static char *dom_path;
static char watch_token[16];
static char filename[80];
static int interrupted;
@@ -72,7 +78,7 @@ static int xenpaging_wait_for_event_or_t
{
xc_interface *xch = paging->xc_handle;
xc_evtchn *xce = paging->mem_event.xce_handle;
- char **vec;
+ char **vec, *val;
unsigned int num;
struct pollfd fd[2];
int port;
@@ -111,6 +117,25 @@ static int xenpaging_wait_for_event_or_t
rc = 0;
}
}
+ else if ( strcmp(vec[XS_WATCH_PATH], watch_target_tot_pages) == 0 )
+ {
+ int ret, target_tot_pages;
+ val = xs_read(paging->xs_handle, XBT_NULL, vec[XS_WATCH_PATH], NULL);
+ if ( val )
+ {
+ ret = sscanf(val, "%d", &target_tot_pages);
+ if ( ret > 0 )
+ {
+ /* KiB to pages */
+ target_tot_pages >>= 2;
+ if ( target_tot_pages < 0 || target_tot_pages > paging->max_pages )
+ target_tot_pages = paging->max_pages;
+ paging->target_tot_pages = target_tot_pages;
+ DPRINTF("new target_tot_pages %d\n", target_tot_pages);
+ }
+ free(val);
+ }
+ }
free(vec);
}
}
@@ -216,6 +241,25 @@ static xenpaging_t *xenpaging_init(domid
goto err;
}
+ /* Watch xenpagings working target */
+ dom_path = xs_get_domain_path(paging->xs_handle, domain_id);
+ if ( !dom_path )
+ {
+ PERROR("Could not find domain path\n");
+ goto err;
+ }
+ if ( asprintf(&watch_target_tot_pages, "%s/%s", dom_path, WATCH_TARGETPAGES) < 0 )
+ {
+ PERROR("Could not alloc watch path\n");
+ goto err;
+ }
+ DPRINTF("watching '%s'\n", watch_target_tot_pages);
+ if ( xs_watch(paging->xs_handle, watch_target_tot_pages, "") == false )
+ {
+ PERROR("Could not bind to xenpaging watch\n");
+ goto err;
+ }
+
p = getenv("XENPAGING_POLICY_MRU_SIZE");
if ( p && *p )
{
@@ -342,6 +386,8 @@ static xenpaging_t *xenpaging_init(domid
free(paging->mem_event.ring_page);
}
+ free(dom_path);
+ free(watch_target_tot_pages);
free(paging->bitmap);
free(paging);
}
@@ -357,6 +403,9 @@ static int xenpaging_teardown(xenpaging_
if ( paging == NULL )
return 0;
+ xs_unwatch(paging->xs_handle, watch_target_tot_pages, "");
+ xs_unwatch(paging->xs_handle, "@releaseDomain", watch_token);
+
xch = paging->xc_handle;
paging->xc_handle = NULL;
/* Tear down domain paging in Xen */
++++++ 24224-xenpaging_add_cmdline_interface_for_pager.patch ++++++
changeset: 24224:7243fd87410e
user: Olaf Hering
date: Sun Nov 20 17:02:48 2011 +0100
files: tools/xenpaging/xenpaging.c tools/xenpaging/xenpaging.h
description:
xenpaging: add cmdline interface for pager
Introduce a cmdline handling for the pager. This simplifies libxl support,
debug and mru_size are not passed via the environment anymore.
The new interface looks like this:
xenpaging [options] -f <pagefile> -d
options:
-d <domid> --domain=<domid> numerical domain_id of guest. This option is required.
-f <file> --pagefile=<file> pagefile to use. This option is required.
-m --max_memkb= maximum amount of memory to handle.
-r <num> --mru_size=<num> number of paged-in pages to keep in memory.
-d --debug enable debug output.
-h --help this output.
Signed-off-by: Olaf Hering
Committed-by: Ian Jackson
---
tools/xenpaging/xenpaging.c | 139 ++++++++++++++++++++++++++++++++------------
tools/xenpaging/xenpaging.h | 1
2 files changed, 103 insertions(+), 37 deletions(-)
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c
@@ -31,6 +31,7 @@
#include
#include
#include
+#include
#include "xc_bitops.h"
#include "file_ops.h"
@@ -42,12 +43,12 @@
static char *watch_target_tot_pages;
static char *dom_path;
static char watch_token[16];
-static char filename[80];
+static char *filename;
static int interrupted;
static void unlink_pagefile(void)
{
- if ( filename[0] )
+ if ( filename && filename[0] )
{
unlink(filename);
filename[0] = '\0';
@@ -201,11 +202,85 @@ static void *init_page(void)
return NULL;
}
-static xenpaging_t *xenpaging_init(domid_t domain_id, int target_tot_pages)
+static void usage(void)
+{
+ printf("usage:\n\n");
+
+ printf(" xenpaging [options] -f <pagefile> -d \n\n");
+
+ printf("options:\n");
+ printf(" -d <domid> --domain=<domid> numerical domain_id of guest. This option is required.\n");
+ printf(" -f <file> --pagefile=<file> pagefile to use. This option is required.\n");
+ printf(" -m --max_memkb= maximum amount of memory to handle.\n");
+ printf(" -r <num> --mru_size=<num> number of paged-in pages to keep in memory.\n");
+ printf(" -v --verbose enable debug output.\n");
+ printf(" -h --help this output.\n");
+}
+
+static int xenpaging_getopts(xenpaging_t *paging, int argc, char *argv[])
+{
+ int ch;
+ static const char sopts[] = "hvd:f:m:r:";
+ static const struct option lopts[] = {
+ {"help", 0, NULL, 'h'},
+ {"verbose", 0, NULL, 'v'},
+ {"domain", 1, NULL, 'd'},
+ {"pagefile", 1, NULL, 'f'},
+ {"mru_size", 1, NULL, 'm'},
+ { }
+ };
+
+ while ((ch = getopt_long(argc, argv, sopts, lopts, NULL)) != -1)
+ {
+ switch(ch) {
+ case 'd':
+ paging->mem_event.domain_id = atoi(optarg);
+ break;
+ case 'f':
+ filename = strdup(optarg);
+ break;
+ case 'm':
+ /* KiB to pages */
+ paging->max_pages = atoi(optarg) >> 2;
+ break;
+ case 'r':
+ paging->policy_mru_size = atoi(optarg);
+ break;
+ case 'v':
+ paging->debug = 1;
+ break;
+ case 'h':
+ case '?':
+ usage();
+ return 1;
+ }
+ }
+
+ argv += optind; argc -= optind;
+
+ /* Path to pagefile is required */
+ if ( !filename )
+ {
+ printf("Filename for pagefile missing!\n");
+ usage();
+ return 1;
+ }
+
+ /* Set domain id */
+ if ( !paging->mem_event.domain_id )
+ {
+ printf("Numerical missing!\n");
+ return 1;
+ }
+
+ return 0;
+}
+
+static xenpaging_t *xenpaging_init(int argc, char *argv[])
{
xenpaging_t *paging;
xc_domaininfo_t domain_info;
- xc_interface *xch;
+ xc_interface *xch = NULL;
xentoollog_logger *dbg = NULL;
char *p;
int rc;
@@ -215,7 +290,12 @@ static xenpaging_t *xenpaging_init(domid
if ( !paging )
goto err;
- if ( getenv("XENPAGING_DEBUG") )
+ /* Get cmdline options and domain_id */
+ if ( xenpaging_getopts(paging, argc, argv) )
+ goto err;
+
+ /* Enable debug output */
+ if ( paging->debug )
dbg = (xentoollog_logger *)xtl_createlogger_stdiostream(stderr, XTL_DEBUG, 0);
/* Open connection to xen */
@@ -234,7 +314,7 @@ static xenpaging_t *xenpaging_init(domid
}
/* write domain ID to watch so we can ignore other domain shutdowns */
- snprintf(watch_token, sizeof(watch_token), "%u", domain_id);
+ snprintf(watch_token, sizeof(watch_token), "%u", paging->mem_event.domain_id);
if ( xs_watch(paging->xs_handle, "@releaseDomain", watch_token) == false )
{
PERROR("Could not bind to shutdown watch\n");
@@ -242,7 +322,7 @@ static xenpaging_t *xenpaging_init(domid
}
/* Watch xenpagings working target */
- dom_path = xs_get_domain_path(paging->xs_handle, domain_id);
+ dom_path = xs_get_domain_path(paging->xs_handle, paging->mem_event.domain_id);
if ( !dom_path )
{
PERROR("Could not find domain path\n");
@@ -260,16 +340,6 @@ static xenpaging_t *xenpaging_init(domid
goto err;
}
- p = getenv("XENPAGING_POLICY_MRU_SIZE");
- if ( p && *p )
- {
- paging->policy_mru_size = atoi(p);
- DPRINTF("Setting policy mru_size to %d\n", paging->policy_mru_size);
- }
-
- /* Set domain id */
- paging->mem_event.domain_id = domain_id;
-
/* Initialise shared page */
paging->mem_event.shared_page = init_page();
if ( paging->mem_event.shared_page == NULL )
@@ -335,16 +405,20 @@ static xenpaging_t *xenpaging_init(domid
paging->mem_event.port = rc;
- rc = xc_domain_getinfolist(xch, paging->mem_event.domain_id, 1,
- &domain_info);
- if ( rc != 1 )
+ /* Get max_pages from guest if not provided via cmdline */
+ if ( !paging->max_pages )
{
- PERROR("Error getting domain info");
- goto err;
- }
+ rc = xc_domain_getinfolist(xch, paging->mem_event.domain_id, 1,
+ &domain_info);
+ if ( rc != 1 )
+ {
+ PERROR("Error getting domain info");
+ goto err;
+ }
- /* Record number of max_pages */
- paging->max_pages = domain_info.max_pages;
+ /* Record number of max_pages */
+ paging->max_pages = domain_info.max_pages;
+ }
/* Allocate bitmap for tracking pages that have been paged out */
paging->bitmap = bitmap_alloc(paging->max_pages);
@@ -355,8 +429,6 @@ static xenpaging_t *xenpaging_init(domid
}
DPRINTF("max_pages = %d\n", paging->max_pages);
- paging->target_tot_pages = target_tot_pages;
-
/* Initialise policy */
rc = policy_init(paging);
if ( rc != 0 )
@@ -718,25 +790,18 @@ int main(int argc, char *argv[])
mode_t open_mode = S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IWGRP | S_IWOTH;
int fd;
- if ( argc != 3 )
- {
- fprintf(stderr, "Usage: %s \n", argv[0]);
- return -1;
- }
-
/* Initialise domain paging */
- paging = xenpaging_init(atoi(argv[1]), atoi(argv[2]));
+ paging = xenpaging_init(argc, argv);
if ( paging == NULL )
{
- fprintf(stderr, "Error initialising paging");
+ fprintf(stderr, "Error initialising paging\n");
return 1;
}
xch = paging->xc_handle;
- DPRINTF("starting %s %u %d\n", argv[0], paging->mem_event.domain_id, paging->target_tot_pages);
+ DPRINTF("starting %s for domain_id %u with pagefile %s\n", argv[0], paging->mem_event.domain_id, filename);
/* Open file */
- sprintf(filename, "page_cache_%u", paging->mem_event.domain_id);
fd = open(filename, open_flags, open_mode);
if ( fd < 0 )
{
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h
@@ -52,6 +52,7 @@ typedef struct xenpaging {
int num_paged_out;
int target_tot_pages;
int policy_mru_size;
+ int debug;
unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE];
} xenpaging_t;
++++++ 24225-xenpaging_improve_policy_mru_list_handling.patch ++++++
changeset: 24225:d47d1ad56366
user: Olaf Hering
date: Sun Nov 20 17:02:50 2011 +0100
files: tools/xenpaging/policy.h tools/xenpaging/policy_default.c tools/xenpaging/xenpaging.c
description:
xenpaging: improve policy mru list handling
Without this change it is not possible to page-out all guest pages, then
trigger a page-in for all pages, and then page-out everything once
again. All pages in the mru list can not be paged out because they
remain active in the internal bitmap of paged pages.
Use the mru list only if the number of paged-out pages is larger than
the mru list. If the number is smaller, start to clear the mru list. In
case the number of paged-out pages drops to zero the mru list and the
internal bitmap will be empty as well.
Also add a new interface for dropped pages. If a gfn was dropped there
is no need to adjust the mru list because dropping a page is not usage
of a page.
Signed-off-by: Olaf Hering
Committed-by: Ian Jackson
---
tools/xenpaging/policy.h | 2 ++
tools/xenpaging/policy_default.c | 27 ++++++++++++++++++++++++---
tools/xenpaging/xenpaging.c | 11 +++++++++--
3 files changed, 35 insertions(+), 5 deletions(-)
Index: xen-4.1.2-testing/tools/xenpaging/policy.h
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/policy.h
+++ xen-4.1.2-testing/tools/xenpaging/policy.h
@@ -32,6 +32,8 @@ int policy_init(xenpaging_t *paging);
int policy_choose_victim(xenpaging_t *paging, xenpaging_victim_t *victim);
void policy_notify_paged_out(unsigned long gfn);
void policy_notify_paged_in(unsigned long gfn);
+void policy_notify_paged_in_nomru(unsigned long gfn);
+void policy_notify_dropped(unsigned long gfn);
#endif // __XEN_PAGING_POLICY_H__
Index: xen-4.1.2-testing/tools/xenpaging/policy_default.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/policy_default.c
+++ xen-4.1.2-testing/tools/xenpaging/policy_default.c
@@ -57,7 +57,7 @@ int policy_init(xenpaging_t *paging)
if ( paging->policy_mru_size > 0 )
mru_size = paging->policy_mru_size;
else
- mru_size = DEFAULT_MRU_SIZE;
+ mru_size = paging->policy_mru_size = DEFAULT_MRU_SIZE;
mru = malloc(sizeof(*mru) * mru_size);
if ( mru == NULL )
@@ -120,17 +120,38 @@ void policy_notify_paged_out(unsigned lo
clear_bit(gfn, unconsumed);
}
-void policy_notify_paged_in(unsigned long gfn)
+static void policy_handle_paged_in(unsigned long gfn, int do_mru)
{
unsigned long old_gfn = mru[i_mru & (mru_size - 1)];
if ( old_gfn != INVALID_MFN )
clear_bit(old_gfn, bitmap);
- mru[i_mru & (mru_size - 1)] = gfn;
+ if (do_mru) {
+ mru[i_mru & (mru_size - 1)] = gfn;
+ } else {
+ clear_bit(gfn, bitmap);
+ mru[i_mru & (mru_size - 1)] = INVALID_MFN;
+ }
+
i_mru++;
}
+void policy_notify_paged_in(unsigned long gfn)
+{
+ policy_handle_paged_in(gfn, 1);
+}
+
+void policy_notify_paged_in_nomru(unsigned long gfn)
+{
+ policy_handle_paged_in(gfn, 0);
+}
+
+void policy_notify_dropped(unsigned long gfn)
+{
+ clear_bit(gfn, bitmap);
+}
+
/*
* Local variables:
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c
@@ -615,7 +615,14 @@ static int xenpaging_resume_page(xenpagi
/* Notify policy of page being paged in */
if ( notify_policy )
{
- policy_notify_paged_in(rsp->gfn);
+ /*
+ * Do not add gfn to mru list if the target is lower than mru size.
+ * This allows page-out of these gfns if the target grows again.
+ */
+ if (paging->num_paged_out > paging->policy_mru_size)
+ policy_notify_paged_in(rsp->gfn);
+ else
+ policy_notify_paged_in_nomru(rsp->gfn);
/* Record number of resumed pages */
paging->num_paged_out--;
@@ -869,7 +876,7 @@ int main(int argc, char *argv[])
{
DPRINTF("drop_page ^ gfn %"PRIx64" pageslot %d\n", req.gfn, i);
/* Notify policy of page being dropped */
- policy_notify_paged_in(req.gfn);
+ policy_notify_dropped(req.gfn);
}
else
{
++++++ 24226-xenpaging_add_debug_to_show_received_watch_event..patch ++++++
changeset: 24226:c9b75ccd3ebf
user: Olaf Hering
date: Sun Nov 20 18:26:15 2011 +0100
files: tools/xenpaging/xenpaging.c
description:
xenpaging: add debug to show received watch event.
Signed-off-by: Olaf Hering
Committed-by: Ian Jackson
---
tools/xenpaging/xenpaging.c | 1 +
1 file changed, 1 insertion(+)
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c
@@ -108,6 +108,7 @@ static int xenpaging_wait_for_event_or_t
vec = xs_read_watch(paging->xs_handle, &num);
if ( vec )
{
+ DPRINTF("path '%s' token '%s'\n", vec[XS_WATCH_PATH], vec[XS_WATCH_TOKEN]);
if ( strcmp(vec[XS_WATCH_TOKEN], watch_token) == 0 )
{
/* If our guest disappeared, set interrupt flag and fall through */
++++++ 24227-xenpaging_restrict_pagefile_permissions.patch ++++++
changeset: 24227:1027e7d13d02
user: Olaf Hering
date: Sun Nov 20 18:26:16 2011 +0100
files: tools/xenpaging/xenpaging.c
description:
xenpaging: restrict pagefile permissions
Signed-off-by: Olaf Hering
Committed-by: Ian Jackson
---
tools/xenpaging/xenpaging.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c
@@ -795,7 +795,7 @@ int main(int argc, char *argv[])
xc_interface *xch;
int open_flags = O_CREAT | O_TRUNC | O_RDWR;
- mode_t open_mode = S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IWGRP | S_IWOTH;
+ mode_t open_mode = S_IRUSR | S_IWUSR;
int fd;
/* Initialise domain paging */
++++++ 24231-waitqueue_Implement_wake_up_nroneall..patch ++++++
changeset: 24231:2a81ce2b2b93
user: Keir Fraser
date: Fri Nov 25 20:27:11 2011 +0000
files: xen/common/wait.c xen/include/xen/wait.h
description:
waitqueue: Implement wake_up_{nr,one,all}.
Signed-off-by: Keir Fraser
---
xen/common/wait.c | 14 ++++++++++++--
xen/include/xen/wait.h | 6 ++++--
2 files changed, 16 insertions(+), 4 deletions(-)
Index: xen-4.1.2-testing/xen/common/wait.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/wait.c
+++ xen-4.1.2-testing/xen/common/wait.c
@@ -87,13 +87,13 @@ void init_waitqueue_head(struct waitqueu
INIT_LIST_HEAD(&wq->list);
}
-void wake_up(struct waitqueue_head *wq)
+void wake_up_nr(struct waitqueue_head *wq, unsigned int nr)
{
struct waitqueue_vcpu *wqv;
spin_lock(&wq->lock);
- while ( !list_empty(&wq->list) )
+ while ( !list_empty(&wq->list) && nr-- )
{
wqv = list_entry(wq->list.next, struct waitqueue_vcpu, list);
list_del_init(&wqv->list);
@@ -103,6 +103,16 @@ void wake_up(struct waitqueue_head *wq)
spin_unlock(&wq->lock);
}
+void wake_up_one(struct waitqueue_head *wq)
+{
+ wake_up_nr(wq, 1);
+}
+
+void wake_up_all(struct waitqueue_head *wq)
+{
+ wake_up_nr(wq, UINT_MAX);
+}
+
#ifdef CONFIG_X86
static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
Index: xen-4.1.2-testing/xen/include/xen/wait.h
===================================================================
--- xen-4.1.2-testing.orig/xen/include/xen/wait.h
+++ xen-4.1.2-testing/xen/include/xen/wait.h
@@ -28,8 +28,10 @@ struct waitqueue_head {
/* Dynamically initialise a waitqueue. */
void init_waitqueue_head(struct waitqueue_head *wq);
-/* Wake all VCPUs waiting on specified waitqueue. */
-void wake_up(struct waitqueue_head *wq);
+/* Wake VCPU(s) waiting on specified waitqueue. */
+void wake_up_nr(struct waitqueue_head *wq, unsigned int nr);
+void wake_up_one(struct waitqueue_head *wq);
+void wake_up_all(struct waitqueue_head *wq);
/* Wait on specified waitqueue until @condition is true. */
#define wait_event(wq, condition) \
++++++ 24232-waitqueue_Hold_a_reference_to_a_domain_on_a_waitqueue..patch ++++++
changeset: 24232:95d4e2e0bed3
user: Keir Fraser
date: Fri Nov 25 20:32:05 2011 +0000
files: xen/common/wait.c xen/include/xen/wait.h
description:
waitqueue: Hold a reference to a domain on a waitqueue.
Also allow waitqueues to be dynamically destroyed.
Signed-off-by: Keir Fraser
---
xen/common/wait.c | 8 ++++++++
xen/include/xen/wait.h | 3 ++-
2 files changed, 10 insertions(+), 1 deletion(-)
Index: xen-4.1.2-testing/xen/common/wait.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/wait.c
+++ xen-4.1.2-testing/xen/common/wait.c
@@ -87,6 +87,11 @@ void init_waitqueue_head(struct waitqueu
INIT_LIST_HEAD(&wq->list);
}
+void destroy_waitqueue_head(struct waitqueue_head *wq)
+{
+ wake_up_all(wq);
+}
+
void wake_up_nr(struct waitqueue_head *wq, unsigned int nr)
{
struct waitqueue_vcpu *wqv;
@@ -98,6 +103,7 @@ void wake_up_nr(struct waitqueue_head *w
wqv = list_entry(wq->list.next, struct waitqueue_vcpu, list);
list_del_init(&wqv->list);
vcpu_unpause(wqv->vcpu);
+ put_domain(wqv->vcpu->domain);
}
spin_unlock(&wq->lock);
@@ -218,6 +224,7 @@ void prepare_to_wait(struct waitqueue_he
spin_lock(&wq->lock);
list_add_tail(&wqv->list, &wq->list);
vcpu_pause_nosync(curr);
+ get_knownalive_domain(curr->domain);
spin_unlock(&wq->lock);
}
@@ -236,6 +243,7 @@ void finish_wait(struct waitqueue_head *
{
list_del_init(&wqv->list);
vcpu_unpause(curr);
+ put_domain(curr->domain);
}
spin_unlock(&wq->lock);
}
Index: xen-4.1.2-testing/xen/include/xen/wait.h
===================================================================
--- xen-4.1.2-testing.orig/xen/include/xen/wait.h
+++ xen-4.1.2-testing/xen/include/xen/wait.h
@@ -25,8 +25,9 @@ struct waitqueue_head {
.list = LIST_HEAD_INIT((name).list) \
}
-/* Dynamically initialise a waitqueue. */
+/* Dynamically initialise/destroy a waitqueue. */
void init_waitqueue_head(struct waitqueue_head *wq);
+void destroy_waitqueue_head(struct waitqueue_head *wq);
/* Wake VCPU(s) waiting on specified waitqueue. */
void wake_up_nr(struct waitqueue_head *wq, unsigned int nr);
++++++ 24261-x86-cpuidle-Westmere-EX.patch ++++++
# HG changeset patch
# User Jan Beulich
# Date 1322645021 -3600
# Node ID 64088ba60263d3a623851b43a872c93c71cc3cbf
# Parent df7cec2c6c03f07932555954948ce7c8d09e88f4
x86/cpuidle: add Westmere-EX support to hw residencies reading logic
This is in accordance with
http://software.intel.com/en-us/articles/intel-processor-identification-with...
Signed-off-by: Jan Beulich
Acked-by: Haitao Shan
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -113,6 +113,7 @@ static void do_get_hw_residencies(void *
/* Westmere */
case 0x25:
case 0x2C:
+ case 0x2F:
GET_PC3_RES(hw_res->pc3);
GET_PC6_RES(hw_res->pc6);
GET_PC7_RES(hw_res->pc7);
++++++ 24269-mem_event_move_mem_event_domain_out_of_struct_domain.patch ++++++
changeset: 24269:2cbc53a24683
user: Olaf Hering
date: Wed Nov 30 07:08:53 2011 -0800
files: xen/arch/x86/hvm/hvm.c xen/arch/x86/mm/mem_event.c xen/arch/x86/mm/mem_sharing.c xen/arch/x86/mm/p2m.c xen/common/domain.c xen/include/xen/sched.h
description:
mem_event: move mem_event_domain out of struct domain
An upcoming change may increase the size of mem_event_domain. The result
is a build failure because struct domain gets larger than a page.
Allocate the room for the three mem_event_domain members at runtime.
v2:
- remove mem_ prefix from members of new struct
Signed-off-by: Olaf Hering
Committed-by: Keir Fraser
---
xen/arch/x86/hvm/hvm.c | 4 ++--
xen/arch/x86/mm/mem_event.c | 6 +++---
xen/arch/x86/mm/mem_sharing.c | 6 +++---
xen/arch/x86/mm/p2m.c | 18 +++++++++---------
xen/common/domain.c | 5 +++++
xen/include/xen/sched.h | 18 ++++++++++++------
6 files changed, 34 insertions(+), 23 deletions(-)
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3909,7 +3909,7 @@ static int hvm_memory_event_traps(long p
if ( (p & HVMPME_onchangeonly) && (value == old) )
return 1;
- rc = mem_event_check_ring(d, &d->mem_access);
+ rc = mem_event_check_ring(d, &d->mem_event->access);
if ( rc )
return rc;
@@ -3932,7 +3932,7 @@ static int hvm_memory_event_traps(long p
req.gla_valid = 1;
}
- mem_event_put_request(d, &d->mem_access, &req);
+ mem_event_put_request(d, &d->mem_event->access, &req);
return 1;
}
--- a/xen/arch/x86/mm/mem_event.c
+++ b/xen/arch/x86/mm/mem_event.c
@@ -252,7 +252,7 @@ int mem_event_domctl(struct domain *d, x
{
case XEN_DOMCTL_MEM_EVENT_OP_PAGING:
{
- struct mem_event_domain *med = &d->mem_paging;
+ struct mem_event_domain *med = &d->mem_event->paging;
rc = -EINVAL;
switch( mec->op )
@@ -297,7 +297,7 @@ int mem_event_domctl(struct domain *d, x
case XEN_DOMCTL_MEM_EVENT_OP_ACCESS:
{
- struct mem_event_domain *med = &d->mem_access;
+ struct mem_event_domain *med = &d->mem_event->access;
rc = -EINVAL;
switch( mec->op )
@@ -320,7 +320,7 @@ int mem_event_domctl(struct domain *d, x
case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE:
{
if ( med->ring_page )
- rc = mem_event_disable(&d->mem_access);
+ rc = mem_event_disable(med);
}
break;
--- a/xen/arch/x86/mm/mem_sharing.c
+++ b/xen/arch/x86/mm/mem_sharing.c
@@ -322,12 +322,12 @@ static struct page_info* mem_sharing_all
req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED;
}
- if(mem_event_check_ring(d, &d->mem_share)) return page;
+ if(mem_event_check_ring(d, &d->mem_event->share)) return page;
req.gfn = gfn;
req.p2mt = p2m_ram_shared;
req.vcpu_id = v->vcpu_id;
- mem_event_put_request(d, &d->mem_share, &req);
+ mem_event_put_request(d, &d->mem_event->share, &req);
return page;
}
@@ -342,7 +342,7 @@ int mem_sharing_sharing_resume(struct do
mem_event_response_t rsp;
/* Get request off the ring */
- mem_event_get_response(&d->mem_share, &rsp);
+ mem_event_get_response(&d->mem_event->share, &rsp);
/* Unpause domain/vcpu */
if( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -2996,7 +2996,7 @@ void p2m_mem_paging_drop_page(struct p2m
struct domain *d = p2m->domain;
/* Check that there's space on the ring for this request */
- if ( mem_event_check_ring(d, &d->mem_paging) == 0)
+ if ( mem_event_check_ring(d, &d->mem_event->paging) == 0)
{
/* Send release notification to pager */
memset(&req, 0, sizeof(req));
@@ -3004,7 +3004,7 @@ void p2m_mem_paging_drop_page(struct p2m
req.gfn = gfn;
req.vcpu_id = v->vcpu_id;
- mem_event_put_request(d, &d->mem_paging, &req);
+ mem_event_put_request(d, &d->mem_event->paging, &req);
}
}
@@ -3039,7 +3039,7 @@ void p2m_mem_paging_populate(struct p2m_
struct domain *d = p2m->domain;
/* Check that there's space on the ring for this request */
- if ( mem_event_check_ring(d, &d->mem_paging) )
+ if ( mem_event_check_ring(d, &d->mem_event->paging) )
return;
memset(&req, 0, sizeof(req));
@@ -3070,7 +3070,7 @@ void p2m_mem_paging_populate(struct p2m_
else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged )
{
/* gfn is already on its way back and vcpu is not paused */
- mem_event_put_req_producers(&d->mem_paging);
+ mem_event_put_req_producers(&d->mem_event->paging);
return;
}
@@ -3079,7 +3079,7 @@ void p2m_mem_paging_populate(struct p2m_
req.p2mt = p2mt;
req.vcpu_id = v->vcpu_id;
- mem_event_put_request(d, &d->mem_paging, &req);
+ mem_event_put_request(d, &d->mem_event->paging, &req);
}
/**
@@ -3157,7 +3157,7 @@ void p2m_mem_paging_resume(struct p2m_do
mfn_t mfn;
/* Pull the response off the ring */
- mem_event_get_response(&d->mem_paging, &rsp);
+ mem_event_get_response(&d->mem_event->paging, &rsp);
/* Fix p2m entry if the page was not dropped */
if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) )
@@ -3210,7 +3210,7 @@ void p2m_mem_access_check(unsigned long
p2m_unlock(p2m);
/* Otherwise, check if there is a memory event listener, and send the message along */
- res = mem_event_check_ring(d, &d->mem_access);
+ res = mem_event_check_ring(d, &d->mem_event->access);
if ( res < 0 )
{
/* No listener */
@@ -3254,7 +3254,7 @@ void p2m_mem_access_check(unsigned long
req.vcpu_id = v->vcpu_id;
- mem_event_put_request(d, &d->mem_access, &req);
+ mem_event_put_request(d, &d->mem_event->access, &req);
/* VCPU paused, mem event request sent */
}
@@ -3264,7 +3264,7 @@ void p2m_mem_access_resume(struct p2m_do
struct domain *d = p2m->domain;
mem_event_response_t rsp;
- mem_event_get_response(&d->mem_access, &rsp);
+ mem_event_get_response(&d->mem_event->access, &rsp);
/* Unpause domain */
if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -298,6 +298,10 @@ struct domain *domain_create(
init_status |= INIT_gnttab;
poolid = 0;
+
+ d->mem_event = xzalloc(struct mem_event_per_domain);
+ if ( !d->mem_event )
+ goto fail;
}
if ( arch_domain_create(d, domcr_flags) != 0 )
@@ -329,6 +333,7 @@ struct domain *domain_create(
fail:
d->is_dying = DOMDYING_dead;
atomic_set(&d->refcnt, DOMAIN_DESTROYED);
+ xfree(d->mem_event);
if ( init_status & INIT_arch )
arch_domain_destroy(d);
if ( init_status & INIT_gnttab )
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -201,6 +201,16 @@ struct mem_event_domain
int xen_port;
};
+struct mem_event_per_domain
+{
+ /* Memory sharing support */
+ struct mem_event_domain share;
+ /* Memory paging support */
+ struct mem_event_domain paging;
+ /* Memory access support */
+ struct mem_event_domain access;
+};
+
struct domain
{
domid_t domain_id;
@@ -327,12 +337,8 @@ struct domain
/* Non-migratable and non-restoreable? */
bool_t disable_migrate;
- /* Memory sharing support */
- struct mem_event_domain mem_share;
- /* Memory paging support */
- struct mem_event_domain mem_paging;
- /* Memory access support */
- struct mem_event_domain mem_access;
+ /* Various mem_events */
+ struct mem_event_per_domain *mem_event;
/* Currently computed from union of all vcpu cpu-affinity masks. */
nodemask_t node_affinity;
++++++ 24270-Free_d-mem_event_on_domain_destruction..patch ++++++
changeset: 24270:08716a7f1b74
user: Keir Fraser
date: Wed Nov 30 07:12:41 2011 -0800
files: xen/common/domain.c
description:
Free d->mem_event on domain destruction.
Signed-off-by: Keir Fraser
---
xen/common/domain.c | 2 ++
1 file changed, 2 insertions(+)
Index: xen-4.1.2-testing/xen/common/domain.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/domain.c
+++ xen-4.1.2-testing/xen/common/domain.c
@@ -661,6 +661,8 @@ static void complete_domain_destroy(stru
/* Free page used by xen oprofile buffer. */
free_xenoprof_pages(d);
+ xfree(d->mem_event);
+
for ( i = d->max_vcpus - 1; i >= 0; i-- )
if ( (v = d->vcpu[i]) != NULL )
free_vcpu_struct(v);
++++++ 24272-xenpaging_Fix_c-s_235070a29c8c3ddf7_update_machine_to_phys_mapping_during_page_deallocation.patch ++++++
changeset: 24272:62ff6a318c5d
user: Keir Fraser
date: Wed Nov 30 16:59:58 2011 -0800
files: xen/common/page_alloc.c
description:
xenpaging: Fix c/s 23507:0a29c8c3ddf7 ("update machine_to_phys_mapping[] during page deallocation")
This patch clobbers page owner in free_heap_pages() before we are
finished using it. This means that a subsequent test to determine
whether it is safe to avoid safety TLB flushes incorrectly always
determines that it is safe to do so.
The fix is simple: we can defer the original patch's work until after
we are done with the page-owner field.
Thanks to Christian Limpach for spotting this one.
Signed-off-by: Keir Fraser
---
xen/common/page_alloc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: xen-4.1.2-testing/xen/common/page_alloc.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/page_alloc.c
+++ xen-4.1.2-testing/xen/common/page_alloc.c
@@ -540,10 +540,6 @@ static void free_heap_pages(
for ( i = 0; i < (1 << order); i++ )
{
- /* This page is not a guest frame any more. */
- page_set_owner(&pg[i], NULL); /* set_gpfn_from_mfn snoops pg owner */
- set_gpfn_from_mfn(mfn + i, INVALID_M2P_ENTRY);
-
/*
* Cannot assume that count_info == 0, as there are some corner cases
* where it isn't the case and yet it isn't a bug:
@@ -567,6 +563,10 @@ static void free_heap_pages(
pg[i].u.free.need_tlbflush = (page_get_owner(&pg[i]) != NULL);
if ( pg[i].u.free.need_tlbflush )
pg[i].tlbflush_timestamp = tlbflush_current_time();
+
+ /* This page is not a guest frame any more. */
+ page_set_owner(&pg[i], NULL); /* set_gpfn_from_mfn snoops pg owner */
+ set_gpfn_from_mfn(mfn + i, INVALID_M2P_ENTRY);
}
avail[node][zone] += 1 << order;
++++++ 24275-x86-emul-lzcnt.patch ++++++
# HG changeset patch
# User Jan Beulich
# Date 1322725849 -3600
# Node ID 76ea126f21724b72c120aff59460f7bbe9e6960d
# Parent 07cf778d517fdf661a34027af653a489489bf222
x86/emulator: properly handle lzcnt and tzcnt
These instructions are prefix selected flavors of bsf and bsr
respectively, and hence the presences of the F3 prefix must be handled
in the emulation code in order to avoid running into problems on newer
CPUs.
Signed-off-by: Jan Beulich
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -990,6 +990,9 @@ static bool_t vcpu_has(
return rc == X86EMUL_OKAY;
}
+#define vcpu_has_lzcnt() vcpu_has(0x80000001, ECX, 5, ctxt, ops)
+#define vcpu_has_bmi1() vcpu_has(0x00000007, EBX, 3, ctxt, ops)
+
#define vcpu_must_have(leaf, reg, bit) \
generate_exception_if(!vcpu_has(leaf, reg, bit, ctxt, ops), EXC_UD, -1)
#define vcpu_must_have_sse2() vcpu_must_have(0x00000001, EDX, 26)
@@ -4114,13 +4117,24 @@ x86_emulate(
dst.val = (uint8_t)src.val;
break;
- case 0xbc: /* bsf */ {
- int zf;
+ case 0xbc: /* bsf or tzcnt */ {
+ bool_t zf;
asm ( "bsf %2,%0; setz %b1"
: "=r" (dst.val), "=q" (zf)
- : "r" (src.val), "1" (0) );
+ : "r" (src.val) );
_regs.eflags &= ~EFLG_ZF;
- if ( zf )
+ if ( (rep_prefix == REPE_PREFIX) && vcpu_has_bmi1() )
+ {
+ _regs.eflags &= ~EFLG_CF;
+ if ( zf )
+ {
+ _regs.eflags |= EFLG_CF;
+ dst.val = op_bytes * 8;
+ }
+ else if ( !dst.val )
+ _regs.eflags |= EFLG_ZF;
+ }
+ else if ( zf )
{
_regs.eflags |= EFLG_ZF;
dst.type = OP_NONE;
@@ -4128,13 +4142,28 @@ x86_emulate(
break;
}
- case 0xbd: /* bsr */ {
- int zf;
+ case 0xbd: /* bsr or lzcnt */ {
+ bool_t zf;
asm ( "bsr %2,%0; setz %b1"
: "=r" (dst.val), "=q" (zf)
- : "r" (src.val), "1" (0) );
+ : "r" (src.val) );
_regs.eflags &= ~EFLG_ZF;
- if ( zf )
+ if ( (rep_prefix == REPE_PREFIX) && vcpu_has_lzcnt() )
+ {
+ _regs.eflags &= ~EFLG_CF;
+ if ( zf )
+ {
+ _regs.eflags |= EFLG_CF;
+ dst.val = op_bytes * 8;
+ }
+ else
+ {
+ dst.val = op_bytes * 8 - 1 - dst.val;
+ if ( !dst.val )
+ _regs.eflags |= EFLG_ZF;
+ }
+ }
+ else if ( zf )
{
_regs.eflags |= EFLG_ZF;
dst.type = OP_NONE;
++++++ 24277-x86-dom0-features.patch ++++++
# HG changeset patch
# User Liu, Jinsong
# Date 1322738484 -3600
# Node ID 1f6b58c8e1ba8d27dfb97f0da96d18d3ad163317
# Parent 89f7273681696022cc44db4f2ec5b22560482869
X86: expose Intel new features to dom0
This patch expose Intel new features to dom0, including
FMA/AVX2/BMI1/BMI2/LZCNT/MOVBE.
Signed-off-by: Liu, Jinsong
Committed-by: Jan Beulich
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -848,8 +848,11 @@ static void pv_cpuid(struct cpu_user_reg
break;
case 7:
if ( regs->ecx == 0 )
- b &= (cpufeat_mask(X86_FEATURE_FSGSBASE) |
- cpufeat_mask(X86_FEATURE_ERMS));
+ b &= (cpufeat_mask(X86_FEATURE_BMI1) |
+ cpufeat_mask(X86_FEATURE_AVX2) |
+ cpufeat_mask(X86_FEATURE_BMI2) |
+ cpufeat_mask(X86_FEATURE_ERMS) |
+ cpufeat_mask(X86_FEATURE_FSGSBASE));
else
b = 0;
a = c = d = 0;
--- a/xen/include/asm-x86/cpufeature.h
+++ b/xen/include/asm-x86/cpufeature.h
@@ -93,6 +93,7 @@
#define X86_FEATURE_TM2 (4*32+ 8) /* Thermal Monitor 2 */
#define X86_FEATURE_SSSE3 (4*32+ 9) /* Supplemental Streaming SIMD Extensions-3 */
#define X86_FEATURE_CID (4*32+10) /* Context ID */
+#define X86_FEATURE_FMA (4*32+12) /* Fused Multiply Add */
#define X86_FEATURE_CX16 (4*32+13) /* CMPXCHG16B */
#define X86_FEATURE_XTPR (4*32+14) /* Send Task Priority Messages */
#define X86_FEATURE_PDCM (4*32+15) /* Perf/Debug Capability MSR */
@@ -100,6 +101,7 @@
#define X86_FEATURE_SSE4_1 (4*32+19) /* Streaming SIMD Extensions 4.1 */
#define X86_FEATURE_SSE4_2 (4*32+20) /* Streaming SIMD Extensions 4.2 */
#define X86_FEATURE_X2APIC (4*32+21) /* Extended xAPIC */
+#define X86_FEATURE_MOVBE (4*32+22) /* movbe instruction */
#define X86_FEATURE_POPCNT (4*32+23) /* POPCNT instruction */
#define X86_FEATURE_TSC_DEADLINE (4*32+24) /* "tdt" TSC Deadline Timer */
#define X86_FEATURE_XSAVE (4*32+26) /* XSAVE/XRSTOR/XSETBV/XGETBV */
@@ -144,7 +146,10 @@
/* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx), word 7 */
#define X86_FEATURE_FSGSBASE (7*32+ 0) /* {RD,WR}{FS,GS}BASE instructions */
+#define X86_FEATURE_BMI1 (7*32+ 3) /* 1st bit manipulation extensions */
+#define X86_FEATURE_AVX2 (7*32+ 5) /* AVX2 instructions */
#define X86_FEATURE_SMEP (7*32+ 7) /* Supervisor Mode Execution Protection */
+#define X86_FEATURE_BMI2 (7*32+ 8) /* 2nd bit manipulation extensions */
#define X86_FEATURE_ERMS (7*32+ 9) /* Enhanced REP MOVSB/STOSB */
#define cpu_has(c, bit) test_bit(bit, (c)->x86_capability)
++++++ 24278-x86-dom0-no-PCID.patch ++++++
# HG changeset patch
# User Liu, Jinsong
# Date 1322738563 -3600
# Node ID d9cb04ed55398ea4043c85573460afaf023aa1e9
# Parent 1f6b58c8e1ba8d27dfb97f0da96d18d3ad163317
X86: Disable PCID/INVPCID for dom0
PCID (Process-context identifier) is a facility by which a logical
processor may cache information for multiple linear-address spaces.
INVPCID is an new instruction to invalidate TLB. Refer latest Intel SDM
http://www.intel.com/content/www/us/en/processors/architectures-software-dev...
We disable PCID/INVPCID for dom0 and pv. Exposing them into dom0 and pv
may result in performance regression, and it would trigger GP or UD
depending on whether platform suppport INVPCID or not.
This patch disables PCID/INVPCID for dom0.
Signed-off-by: Liu, Jinsong
Committed-by: Jan Beulich
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -836,6 +836,7 @@ static void pv_cpuid(struct cpu_user_reg
__clear_bit(X86_FEATURE_CX16 % 32, &c);
__clear_bit(X86_FEATURE_XTPR % 32, &c);
__clear_bit(X86_FEATURE_PDCM % 32, &c);
+ __clear_bit(X86_FEATURE_PCID % 32, &c);
__clear_bit(X86_FEATURE_DCA % 32, &c);
if ( !xsave_enabled(current) )
{
--- a/xen/include/asm-x86/cpufeature.h
+++ b/xen/include/asm-x86/cpufeature.h
@@ -97,6 +97,7 @@
#define X86_FEATURE_CX16 (4*32+13) /* CMPXCHG16B */
#define X86_FEATURE_XTPR (4*32+14) /* Send Task Priority Messages */
#define X86_FEATURE_PDCM (4*32+15) /* Perf/Debug Capability MSR */
+#define X86_FEATURE_PCID (4*32+17) /* Process Context ID */
#define X86_FEATURE_DCA (4*32+18) /* Direct Cache Access */
#define X86_FEATURE_SSE4_1 (4*32+19) /* Streaming SIMD Extensions 4.1 */
#define X86_FEATURE_SSE4_2 (4*32+20) /* Streaming SIMD Extensions 4.2 */
@@ -151,6 +152,7 @@
#define X86_FEATURE_SMEP (7*32+ 7) /* Supervisor Mode Execution Protection */
#define X86_FEATURE_BMI2 (7*32+ 8) /* 2nd bit manipulation extensions */
#define X86_FEATURE_ERMS (7*32+ 9) /* Enhanced REP MOVSB/STOSB */
+#define X86_FEATURE_INVPCID (7*32+10) /* Invalidate Process Context ID */
#define cpu_has(c, bit) test_bit(bit, (c)->x86_capability)
#define boot_cpu_has(bit) test_bit(bit, boot_cpu_data.x86_capability)
++++++ 24282-x86-log-dirty-bitmap-leak.patch ++++++
# HG changeset patch
# User Tim Deegan
# Date 1322749036 0
# Node ID a06cda9fb25f2d7b7b5c7da170813e4a8bb0cd67
# Parent 75f4e4d9f039ea656051e6dfd73e40d4cb32896b
x86/mm: Don't lose track of the log dirty bitmap
hap_log_dirty_init unconditionally sets the top of the log dirty
bitmap to INVALID_MFN. If there had been a bitmap allocated, it is
then leaked, and the host crashes on an ASSERT when the domain is
cleaned up.
Signed-off-by: Tim Deegan
Acked-by: Andres Lagar-Cavilla
Committed-by: Tim Deegan
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -665,7 +665,6 @@ void paging_log_dirty_init(struct domain
d->arch.paging.log_dirty.enable_log_dirty = enable_log_dirty;
d->arch.paging.log_dirty.disable_log_dirty = disable_log_dirty;
d->arch.paging.log_dirty.clean_dirty_bitmap = clean_dirty_bitmap;
- d->arch.paging.log_dirty.top = _mfn(INVALID_MFN);
}
/* This function fress log dirty bitmap resources. */
@@ -686,6 +685,11 @@ int paging_domain_init(struct domain *d,
if ( (rc = p2m_init(d)) != 0 )
return rc;
+ /* This must be initialized separately from the rest of the
+ * log-dirty init code as that can be called more than once and we
+ * don't want to leak any active log-dirty bitmaps */
+ d->arch.paging.log_dirty.top = _mfn(INVALID_MFN);
+
/* The order of the *_init calls below is important, as the later
* ones may rewrite some common fields. Shadow pagetables are the
* default... */
++++++ 24318-x86-mm_Fix_checks_during_foreign_mapping_of_paged_pages.patch ++++++
changeset: 24318:f25a004a6de8
user: Andres Lagar-Cavilla
date: Thu Dec 01 17:21:24 2011 +0000
files: xen/arch/x86/mm.c
description:
x86/mm: Fix checks during foreign mapping of paged pages
Check that the valid mfn is the one we are mapping, not the
mfn of the page table of the foreign domain.
Signed-off-by: Andres Lagar-Cavilla
Acked-by: Tim Deegan
Committed-by: Tim Deegan
---
xen/arch/x86/mm.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
Index: xen-4.1.2-testing/xen/arch/x86/mm.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm.c
+++ xen-4.1.2-testing/xen/arch/x86/mm.c
@@ -3492,8 +3492,9 @@ int do_mmu_update(
{
l1_pgentry_t l1e = l1e_from_intpte(req.val);
p2m_type_t l1e_p2mt;
+ unsigned long l1emfn = mfn_x(
gfn_to_mfn(p2m_get_hostp2m(pg_owner),
- l1e_get_pfn(l1e), &l1e_p2mt);
+ l1e_get_pfn(l1e), &l1e_p2mt));
if ( p2m_is_paged(l1e_p2mt) )
{
@@ -3502,7 +3503,8 @@ int do_mmu_update(
rc = -ENOENT;
break;
}
- else if ( p2m_ram_paging_in_start == l1e_p2mt && !mfn_valid(mfn) )
+ else if ( p2m_ram_paging_in_start == l1e_p2mt &&
+ !mfn_valid(l1emfn) )
{
rc = -ENOENT;
break;
@@ -3534,7 +3536,8 @@ int do_mmu_update(
{
l2_pgentry_t l2e = l2e_from_intpte(req.val);
p2m_type_t l2e_p2mt;
- gfn_to_mfn(p2m_get_hostp2m(pg_owner), l2e_get_pfn(l2e), &l2e_p2mt);
+ unsigned long l2emfn = mfn_x(
+ gfn_to_mfn(p2m_get_hostp2m(pg_owner), l2e_get_pfn(l2e), &l2e_p2mt));
if ( p2m_is_paged(l2e_p2mt) )
{
@@ -3543,7 +3546,8 @@ int do_mmu_update(
rc = -ENOENT;
break;
}
- else if ( p2m_ram_paging_in_start == l2e_p2mt && !mfn_valid(mfn) )
+ else if ( p2m_ram_paging_in_start == l2e_p2mt &&
+ !mfn_valid(l2emfn) )
{
rc = -ENOENT;
break;
@@ -3563,7 +3567,8 @@ int do_mmu_update(
{
l3_pgentry_t l3e = l3e_from_intpte(req.val);
p2m_type_t l3e_p2mt;
- gfn_to_mfn(p2m_get_hostp2m(pg_owner), l3e_get_pfn(l3e), &l3e_p2mt);
+ unsigned long l3emfn = mfn_x(
+ gfn_to_mfn(p2m_get_hostp2m(pg_owner), l3e_get_pfn(l3e), &l3e_p2mt));
if ( p2m_is_paged(l3e_p2mt) )
{
@@ -3572,7 +3577,8 @@ int do_mmu_update(
rc = -ENOENT;
break;
}
- else if ( p2m_ram_paging_in_start == l3e_p2mt && !mfn_valid(mfn) )
+ else if ( p2m_ram_paging_in_start == l3e_p2mt &&
+ !mfn_valid(l3emfn) )
{
rc = -ENOENT;
break;
@@ -3592,8 +3598,9 @@ int do_mmu_update(
{
l4_pgentry_t l4e = l4e_from_intpte(req.val);
p2m_type_t l4e_p2mt;
+ unsigned long l4emfn = mfn_x(
gfn_to_mfn(p2m_get_hostp2m(pg_owner),
- l4e_get_pfn(l4e), &l4e_p2mt);
+ l4e_get_pfn(l4e), &l4e_p2mt));
if ( p2m_is_paged(l4e_p2mt) )
{
@@ -3602,7 +3609,8 @@ int do_mmu_update(
rc = -ENOENT;
break;
}
- else if ( p2m_ram_paging_in_start == l4e_p2mt && !mfn_valid(mfn) )
+ else if ( p2m_ram_paging_in_start == l4e_p2mt &&
+ !mfn_valid(l4emfn) )
{
rc = -ENOENT;
break;
++++++ 24327-After_preparing_a_page_for_page-in_allow_immediate_fill-in_of_the_page_contents.patch ++++++
changeset: 24327:8529bca7a3f0
parent: 24322:6bac46816504
user: Andres Lagar-Cavilla
date: Thu Dec 01 18:14:24 2011 +0000
files: xen/arch/x86/mm/mem_event.c xen/arch/x86/mm/mem_paging.c xen/arch/x86/mm/p2m.c xen/include/asm-x86/p2m.h xen/include/public/domctl.h
description:
After preparing a page for page-in, allow immediate fill-in of the page contents
p2m_mem_paging_prep ensures that an mfn is backing the paged-out gfn, and
transitions to the next state in the paging state machine for that page.
Foreign mappings of the gfn will now succeed. This is the key idea, as
it allows the pager to now map the gfn and fill in its contents.
Unfortunately, it also allows any other foreign mapper to map the gfn and read
its contents. This is particularly dangerous when the populate is launched
by a foreign mapper in the first place, which will be actively retrying the
map operation and might race with the pager. Qemu-dm being a prime example.
Fix the race by allowing a buffer to be optionally passed in the prep
operation, and having the hypervisor memcpy from that buffer into the newly
prepped page before promoting the gfn type.
Signed-off-by: Andres Lagar-Cavilla
Acked-by: Tim Deegan
Committed-by: Tim Deegan
---
xen/arch/x86/mm/mem_event.c | 2 +-
xen/arch/x86/mm/mem_paging.c | 2 +-
xen/arch/x86/mm/p2m.c | 32 ++++++++++++++++++++++++++++++--
xen/include/asm-x86/p2m.h | 2 +-
xen/include/public/domctl.h | 8 ++++++--
5 files changed, 39 insertions(+), 7 deletions(-)
--- a/xen/arch/x86/mm/mem_event.c
+++ b/xen/arch/x86/mm/mem_event.c
@@ -45,7 +45,7 @@ static int mem_event_enable(struct domai
struct domain *dom_mem_event = current->domain;
struct vcpu *v = current;
unsigned long ring_addr = mec->ring_addr;
- unsigned long shared_addr = mec->shared_addr;
+ unsigned long shared_addr = mec->u.shared_addr;
l1_pgentry_t l1e;
unsigned long gfn;
p2m_type_t p2mt;
--- a/xen/arch/x86/mm/mem_paging.c
+++ b/xen/arch/x86/mm/mem_paging.c
@@ -50,7 +50,7 @@ int mem_paging_domctl(struct domain *d,
case XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP:
{
unsigned long gfn = mec->gfn;
- rc = p2m_mem_paging_prep(p2m, gfn);
+ rc = p2m_mem_paging_prep(p2m, gfn, mec->u.buffer);
}
break;
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -3093,13 +3093,20 @@ void p2m_mem_paging_populate(struct p2m_
* mfn if populate was called for gfn which was nominated but not evicted. In
* this case only the p2mt needs to be forwarded.
*/
-int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn)
+int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn, uint64_t buffer)
{
struct page_info *page;
p2m_type_t p2mt;
p2m_access_t a;
mfn_t mfn;
- int ret;
+ int ret, page_extant = 1;
+ const void *user_ptr = (const void *) buffer;
+
+ if ( user_ptr )
+ /* Sanity check the buffer and bail out early if trouble */
+ if ( (buffer & (PAGE_SIZE - 1)) ||
+ (!access_ok(user_ptr, PAGE_SIZE)) )
+ return -EINVAL;
p2m_lock(p2m);
@@ -3119,6 +3126,28 @@ int p2m_mem_paging_prep(struct p2m_domai
if ( unlikely(page == NULL) )
goto out;
mfn = page_to_mfn(page);
+ page_extant = 0;
+ }
+
+ /* If we were given a buffer, now is the time to use it */
+ if ( !page_extant && user_ptr )
+ {
+ void *guest_map;
+ int rc;
+
+ ASSERT( mfn_valid(mfn) );
+ guest_map = map_domain_page(mfn_x(mfn));
+ rc = copy_from_user(guest_map, user_ptr, PAGE_SIZE);
+ unmap_domain_page(guest_map);
+ if ( rc )
+ {
+ gdprintk(XENLOG_ERR, "Failed to load paging-in gfn %lx domain %u "
+ "bytes left %d\n",
+ gfn, p2m->domain->domain_id, rc);
+ ret = -EFAULT;
+ put_page(page); /* Don't leak pages */
+ goto out;
+ }
}
/* Fix p2m mapping */
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -524,7 +524,7 @@ void p2m_mem_paging_drop_page(struct p2m
/* Start populating a paged out frame */
void p2m_mem_paging_populate(struct p2m_domain *p2m, unsigned long gfn);
/* Prepare the p2m for paging a frame in */
-int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn);
+int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn, uint64_t buffer);
/* Resume normal operation (in case a domain was paused) */
void p2m_mem_paging_resume(struct p2m_domain *p2m);
#else
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -741,8 +741,12 @@ struct xen_domctl_mem_event_op {
uint32_t op; /* XEN_DOMCTL_MEM_EVENT_OP_*_* */
uint32_t mode; /* XEN_DOMCTL_MEM_EVENT_OP_* */
- /* OP_ENABLE */
- uint64_aligned_t shared_addr; /* IN: Virtual address of shared page */
+ union {
+ /* OP_ENABLE IN: Virtual address of shared page */
+ uint64_aligned_t shared_addr;
+ /* PAGING_PREP IN: buffer to immediately fill page in */
+ uint64_aligned_t buffer;
+ } u;
uint64_aligned_t ring_addr; /* IN: Virtual address of ring page */
/* Other OPs */
++++++ 24328-Tools_Libxc_wrappers_to_automatically_fill_in_page_oud_page_contents_on_prepare.patch ++++++
changeset: 24328:8ad47b48047d
user: Andres Lagar-Cavilla
date: Thu Dec 01 18:14:24 2011 +0000
files: tools/libxc/xc_mem_event.c tools/libxc/xc_mem_paging.c tools/libxc/xenctrl.h
description:
Tools: Libxc wrappers to automatically fill in page oud page contents on prepare
Signed-off-by: Andres Lagar-Cavilla
Acked-by: Ian Jackson
Committed-by: Tim Deegan
---
tools/libxc/xc_mem_event.c | 4 ++--
tools/libxc/xc_mem_paging.c | 23 +++++++++++++++++++++++
tools/libxc/xenctrl.h | 2 ++
3 files changed, 27 insertions(+), 2 deletions(-)
Index: xen-4.1.2-testing/tools/libxc/xc_mem_event.c
===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xc_mem_event.c
+++ xen-4.1.2-testing/tools/libxc/xc_mem_event.c
@@ -24,7 +24,7 @@
#include "xc_private.h"
int xc_mem_event_control(xc_interface *xch, domid_t domain_id, unsigned int op,
- unsigned int mode, void *shared_page,
+ unsigned int mode, void *page,
void *ring_page, unsigned long gfn)
{
DECLARE_DOMCTL;
@@ -34,7 +34,7 @@ int xc_mem_event_control(xc_interface *x
domctl.u.mem_event_op.op = op;
domctl.u.mem_event_op.mode = mode;
- domctl.u.mem_event_op.shared_addr = (unsigned long)shared_page;
+ domctl.u.mem_event_op.u.shared_addr = (unsigned long)page;
domctl.u.mem_event_op.ring_addr = (unsigned long)ring_page;
domctl.u.mem_event_op.gfn = gfn;
Index: xen-4.1.2-testing/tools/libxc/xc_mem_paging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xc_mem_paging.c
+++ xen-4.1.2-testing/tools/libxc/xc_mem_paging.c
@@ -65,6 +65,29 @@ int xc_mem_paging_prep(xc_interface *xch
NULL, NULL, gfn);
}
+int xc_mem_paging_load(xc_interface *xch, domid_t domain_id,
+ unsigned long gfn, void *buffer)
+{
+ int rc;
+
+ if ( !buffer )
+ return -EINVAL;
+
+ if ( ((unsigned long) buffer) & (XC_PAGE_SIZE - 1) )
+ return -EINVAL;
+
+ if ( mlock(buffer, XC_PAGE_SIZE) )
+ return -errno;
+
+ rc = xc_mem_event_control(xch, domain_id,
+ XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP,
+ XEN_DOMCTL_MEM_EVENT_OP_PAGING,
+ buffer, NULL, gfn);
+
+ (void)munlock(buffer, XC_PAGE_SIZE);
+ return rc;
+}
+
int xc_mem_paging_resume(xc_interface *xch, domid_t domain_id, unsigned long gfn)
{
return xc_mem_event_control(xch, domain_id,
Index: xen-4.1.2-testing/tools/libxc/xenctrl.h
===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xenctrl.h
+++ xen-4.1.2-testing/tools/libxc/xenctrl.h
@@ -1742,6 +1742,8 @@ int xc_mem_paging_nominate(xc_interface
unsigned long gfn);
int xc_mem_paging_evict(xc_interface *xch, domid_t domain_id, unsigned long gfn);
int xc_mem_paging_prep(xc_interface *xch, domid_t domain_id, unsigned long gfn);
+int xc_mem_paging_load(xc_interface *xch, domid_t domain_id,
+ unsigned long gfn, void *buffer);
int xc_mem_paging_resume(xc_interface *xch, domid_t domain_id,
unsigned long gfn);
++++++ 24329-Teach_xenpaging_to_use_the_new_and_non-racy_xc_mem_paging_load_interface.patch ++++++
changeset: 24329:a8f5faa127c4
user: Andres Lagar-Cavilla
date: Thu Dec 01 18:14:24 2011 +0000
files: tools/xenpaging/xenpaging.c
description:
Teach xenpaging to use the new and non-racy xc_mem_paging_load interface
Signed-off-by: Andres Lagar-Cavilla
Acked-by: Olaf Hering
Committed-by: Tim Deegan
---
tools/xenpaging/xenpaging.c | 43 +++++++++++++++++++++----------------------
1 file changed, 21 insertions(+), 22 deletions(-)
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c
@@ -45,6 +45,7 @@ static char *dom_path;
static char watch_token[16];
static char *filename;
static int interrupted;
+static void *paging_buffer = NULL;
static void unlink_pagefile(void)
{
@@ -438,6 +439,13 @@ static xenpaging_t *xenpaging_init(int a
goto err;
}
+ paging_buffer = init_page();
+ if ( !paging_buffer )
+ {
+ ERROR("Creating page aligned load buffer");
+ goto err;
+ }
+
return paging;
err:
@@ -649,10 +657,20 @@ static int xenpaging_populate_page(xenpa
unsigned char oom = 0;
DPRINTF("populate_page < gfn %"PRI_xen_pfn" pageslot %d\n", gfn, i);
+
+ /* Read page */
+ ret = read_page(fd, paging_buffer, i);
+ if ( ret != 0 )
+ {
+ ERROR("Error reading page");
+ goto out;
+ }
+
do
{
/* Tell Xen to allocate a page for the domain */
- ret = xc_mem_paging_prep(xch, paging->mem_event.domain_id, gfn);
+ ret = xc_mem_paging_load(xch, paging->mem_event.domain_id, gfn,
+ paging_buffer);
if ( ret != 0 )
{
if ( errno == ENOMEM )
@@ -662,33 +680,14 @@ static int xenpaging_populate_page(xenpa
sleep(1);
continue;
}
- PERROR("Error preparing %"PRI_xen_pfn" for page-in", gfn);
- goto out_map;
+ PERROR("Error loading %"PRI_xen_pfn" during page-in", gfn);
+ goto out;
}
}
while ( ret && !interrupted );
- /* Map page */
- ret = -EFAULT;
- page = xc_map_foreign_pages(xch, paging->mem_event.domain_id,
- PROT_READ | PROT_WRITE, &gfn, 1);
- if ( page == NULL )
- {
- PERROR("Error mapping page %"PRI_xen_pfn": page is null", gfn);
- goto out_map;
- }
-
- /* Read page */
- ret = read_page(fd, page, i);
- if ( ret != 0 )
- {
- PERROR("Error reading page %"PRI_xen_pfn"", gfn);
- goto out;
- }
out:
- munmap(page, PAGE_SIZE);
- out_map:
return ret;
}
++++++ 24344-tools-x86_64_Fix_cpuid_inline_asm_to_not_clobber_stacks_red_zone.patch ++++++
# HG changeset patch
# User Keir Fraser
# Date 1322836274 28800
# Node ID 72f4e4cb7440c6ab64d4c08dfdc3158112cc95ac
# Parent 109b99239b21275ee2249873dcdb9a413741142d
tools/x86_64: Fix cpuid() inline asm to not clobber stack's red zone
Pushing stuff onto the stack on x86-64 when we do not specify
-mno-red-zone is unsafe. Since the complicated asm is due to register
pressure on i386, we simply implement an all-new simpler alternative
for x86-64.
Signed-off-by: Keir Fraser
Acked-by: Jan Beulich
# HG changeset patch
# User Keir Fraser
# Date 1322844002 28800
# Node ID 491c3ebf1d371d03fdd0aabe82b0f422037c67ba
# Parent 72f4e4cb7440c6ab64d4c08dfdc3158112cc95ac
tools/libxc: Fix x86_32 build breakage in previous changeset.
Signed-off-by: Keir Fraser
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -42,23 +42,23 @@ static int hypervisor_is_64bit(xc_interf
static void cpuid(const unsigned int *input, unsigned int *regs)
{
unsigned int count = (input[1] == XEN_CPUID_INPUT_UNUSED) ? 0 : input[1];
- asm (
#ifdef __i386__
+ /* Use the stack to avoid reg constraint failures with some gcc flags */
+ asm (
"push %%ebx; push %%edx\n\t"
-#else
- "push %%rbx; push %%rdx\n\t"
-#endif
"cpuid\n\t"
"mov %%ebx,4(%4)\n\t"
"mov %%edx,12(%4)\n\t"
-#ifdef __i386__
"pop %%edx; pop %%ebx\n\t"
-#else
- "pop %%rdx; pop %%rbx\n\t"
-#endif
: "=a" (regs[0]), "=c" (regs[2])
: "0" (input[0]), "1" (count), "S" (regs)
: "memory" );
+#else
+ asm (
+ "cpuid"
+ : "=a" (regs[0]), "=b" (regs[1]), "=c" (regs[2]), "=d" (regs[3])
+ : "0" (input[0]), "2" (count) );
+#endif
}
/* Get the manufacturer brand name of the host processor. */
--- a/tools/misc/xen-detect.c
+++ b/tools/misc/xen-detect.c
@@ -35,18 +35,21 @@
static void cpuid(uint32_t idx, uint32_t *regs, int pv_context)
{
- asm volatile (
#ifdef __i386__
-#define R(x) "%%e"#x"x"
-#else
-#define R(x) "%%r"#x"x"
-#endif
- "push "R(a)"; push "R(b)"; push "R(c)"; push "R(d)"\n\t"
+ /* Use the stack to avoid reg constraint failures with some gcc flags */
+ asm volatile (
+ "push %%eax; push %%ebx; push %%ecx; push %%edx\n\t"
"test %1,%1 ; jz 1f ; ud2a ; .ascii \"xen\" ; 1: cpuid\n\t"
"mov %%eax,(%2); mov %%ebx,4(%2)\n\t"
"mov %%ecx,8(%2); mov %%edx,12(%2)\n\t"
- "pop "R(d)"; pop "R(c)"; pop "R(b)"; pop "R(a)"\n\t"
+ "pop %%edx; pop %%ecx; pop %%ebx; pop %%eax\n\t"
: : "a" (idx), "c" (pv_context), "S" (regs) : "memory" );
+#else
+ asm volatile (
+ "test %5,%5 ; jz 1f ; ud2a ; .ascii \"xen\" ; 1: cpuid\n\t"
+ : "=a" (regs[0]), "=b" (regs[1]), "=c" (regs[2]), "=d" (regs[3])
+ : "0" (idx), "1" (pv_context), "2" (0) );
+#endif
}
static int check_for_xen(int pv_context)
++++++ 24357-firmware-no-_PS0-_PS3.patch ++++++
References: bnc#711219
# HG changeset patch
# User Xudong Hao
# Date 1323113706 0
# Node ID 832fa3f3543298a7125cd5f996d1e28dd7ba47b1
# Parent 60ea36c0512b779f291bb6c007e1f05c16054ec2
tools/firmware: remove "_PS0/3" Method
Do not expose the ACPI power management "_PS0/3" Method to guest
firmware. According to section 3.4 of the APCI specification 4.0, PCI
device control the device power through its own specification but not
through APCI.
Qemu pushes "_PS0/3" to guest will cause a mess between ACPI PM and
PCI PM as a result of incorrect ACPI table shipped with the guest
BIOS, it may cause a failure of PCI device PM state transition(from
PCI_UNKNOWN to PCI_D0).
Signed-off-by: Xudong Hao
Signed-off-by: Haitao Shan
Committed-by: Keir Fraser
--- a/tools/firmware/hvmloader/acpi/mk_dsdt.c
+++ b/tools/firmware/hvmloader/acpi/mk_dsdt.c
@@ -251,8 +251,6 @@ int main(int argc, char **argv)
* the ACPI event:
* _EJ0: eject a device
* _STA: return a device's status, e.g. enabled or removed
- * Other methods are optional:
- * _PS0/3: put them here for debug purpose
*
* Eject button would generate a general-purpose event, then the
* control method for this event uses Notify() to inform OSPM which
@@ -271,14 +269,6 @@ int main(int argc, char **argv)
stmt("Name", "_ADR, 0x%08x", ((slot & ~7) << 13) | (slot & 7));
/* _SUN == dev */
stmt("Name", "_SUN, 0x%08x", slot >> 3);
- push_block("Method", "_PS0, 0");
- stmt("Store", "0x%02x, \\_GPE.DPT1", slot);
- stmt("Store", "0x80, \\_GPE.DPT2");
- pop_block();
- push_block("Method", "_PS3, 0");
- stmt("Store", "0x%02x, \\_GPE.DPT1", slot);
- stmt("Store", "0x83, \\_GPE.DPT2");
- pop_block();
push_block("Method", "_EJ0, 1");
stmt("Store", "0x%02x, \\_GPE.DPT1", slot);
stmt("Store", "0x88, \\_GPE.DPT2");
++++++ 24358-kexec-compat-overflow.patch ++++++
# HG changeset patch
# User Andrew Cooper
# Date 1323114166 0
# Node ID 9961a6d5356a57685b06f65133c6ade5041e3356
# Parent 832fa3f3543298a7125cd5f996d1e28dd7ba47b1
KEXEC: fix kexec_get_range_compat to fail vocally.
Fail with -ERANGE rather than silently truncating 64bit values (a
physical address and size) into 32bit integers for dom0 to consume.
Signed-off-by: Andrew Cooper
Simplify the bitwise arithmetic a bit.
Signed-off-by: Keir Fraser
--- a/xen/common/kexec.c
+++ b/xen/common/kexec.c
@@ -395,6 +395,10 @@ static int kexec_get_range_compat(XEN_GU
ret = kexec_get_range_internal(&range);
+ /* Dont silently truncate physical addresses or sizes. */
+ if ( (range.start | range.size) & ~(unsigned long)(~0u) )
+ return -ERANGE;
+
if ( ret == 0 ) {
XLAT_kexec_range(&compat_range, &range);
if ( unlikely(copy_to_guest(uarg, &compat_range, 1)) )
++++++ 24359-x86-domU-features.patch ++++++
# HG changeset patch
# User Liu, Jinsong
# Date 1323170838 0
# Node ID a0befa32e927cc147aaee9bce42c51f53580a875
# Parent 9961a6d5356a57685b06f65133c6ade5041e3356
X86: expose Intel new features to pv/hvm
Intel recently release some new features, including
FMA/AVX2/BMI1/BMI2/LZCNT/MOVBE.
Refer to http://software.intel.com/file/36945
This patch expose these new features to pv and hvm.
Signed-off-by: Liu, Jinsong
Committed-by: Keir Fraser
--- a/tools/libxc/xc_cpufeature.h
+++ b/tools/libxc/xc_cpufeature.h
@@ -74,6 +74,7 @@
#define X86_FEATURE_TM2 8 /* Thermal Monitor 2 */
#define X86_FEATURE_SSSE3 9 /* Supplemental Streaming SIMD Exts-3 */
#define X86_FEATURE_CID 10 /* Context ID */
+#define X86_FEATURE_FMA 12 /* Fused Multiply Add */
#define X86_FEATURE_CX16 13 /* CMPXCHG16B */
#define X86_FEATURE_XTPR 14 /* Send Task Priority Messages */
#define X86_FEATURE_PDCM 15 /* Perf/Debug Capability MSR */
@@ -81,6 +82,7 @@
#define X86_FEATURE_SSE4_1 19 /* Streaming SIMD Extensions 4.1 */
#define X86_FEATURE_SSE4_2 20 /* Streaming SIMD Extensions 4.2 */
#define X86_FEATURE_X2APIC 21 /* x2APIC */
+#define X86_FEATURE_MOVBE 22 /* movbe instruction */
#define X86_FEATURE_POPCNT 23 /* POPCNT instruction */
#define X86_FEATURE_TSC_DEADLINE 24 /* "tdt" TSC Deadline Timer */
#define X86_FEATURE_AES 25 /* AES acceleration instructions */
@@ -125,7 +127,10 @@
/* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx) */
#define X86_FEATURE_FSGSBASE 0 /* {RD,WR}{FS,GS}BASE instructions */
+#define X86_FEATURE_BMI1 3 /* 1st group bit manipulation extensions */
+#define X86_FEATURE_AVX2 5 /* AVX2 instructions */
#define X86_FEATURE_SMEP 7 /* Supervisor Mode Execution Protection */
+#define X86_FEATURE_BMI2 8 /* 2nd group bit manipulation extensions */
#define X86_FEATURE_ERMS 9 /* Enhanced REP MOVSB/STOSB */
#endif /* __LIBXC_CPUFEATURE_H */
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -148,7 +148,8 @@ static void intel_xc_cpuid_policy(
int is_64bit = hypervisor_is_64bit(xch) && is_pae;
/* Only a few features are advertised in Intel's 0x80000001. */
- regs[2] &= (is_64bit ? bitmaskof(X86_FEATURE_LAHF_LM) : 0);
+ regs[2] &= (is_64bit ? bitmaskof(X86_FEATURE_LAHF_LM) : 0) |
+ bitmaskof(X86_FEATURE_ABM);
regs[3] &= ((is_pae ? bitmaskof(X86_FEATURE_NX) : 0) |
(is_64bit ? bitmaskof(X86_FEATURE_LM) : 0) |
(is_64bit ? bitmaskof(X86_FEATURE_SYSCALL) : 0) |
@@ -256,9 +257,11 @@ static void xc_cpuid_hvm_policy(
regs[2] &= (bitmaskof(X86_FEATURE_XMM3) |
bitmaskof(X86_FEATURE_PCLMULQDQ) |
bitmaskof(X86_FEATURE_SSSE3) |
+ bitmaskof(X86_FEATURE_FMA) |
bitmaskof(X86_FEATURE_CX16) |
bitmaskof(X86_FEATURE_SSE4_1) |
bitmaskof(X86_FEATURE_SSE4_2) |
+ bitmaskof(X86_FEATURE_MOVBE) |
bitmaskof(X86_FEATURE_POPCNT) |
bitmaskof(X86_FEATURE_AES) |
bitmaskof(X86_FEATURE_F16C) |
@@ -303,7 +306,10 @@ static void xc_cpuid_hvm_policy(
case 0x00000007: /* Intel-defined CPU features */
if ( input[1] == 0 ) {
- regs[1] &= (bitmaskof(X86_FEATURE_SMEP) |
+ regs[1] &= (bitmaskof(X86_FEATURE_BMI1) |
+ bitmaskof(X86_FEATURE_AVX2) |
+ bitmaskof(X86_FEATURE_SMEP) |
+ bitmaskof(X86_FEATURE_BMI2) |
bitmaskof(X86_FEATURE_ERMS) |
bitmaskof(X86_FEATURE_FSGSBASE));
} else
@@ -427,8 +433,11 @@ static void xc_cpuid_pv_policy(
case 7:
if ( input[1] == 0 )
- regs[1] &= (bitmaskof(X86_FEATURE_FSGSBASE) |
- bitmaskof(X86_FEATURE_ERMS));
+ regs[1] &= (bitmaskof(X86_FEATURE_BMI1) |
+ bitmaskof(X86_FEATURE_AVX2) |
+ bitmaskof(X86_FEATURE_BMI2) |
+ bitmaskof(X86_FEATURE_ERMS) |
+ bitmaskof(X86_FEATURE_FSGSBASE));
else
regs[1] = 0;
regs[0] = regs[2] = regs[3] = 0;
++++++ 24360-x86-pv-domU-no-PCID.patch ++++++
# HG changeset patch
# User Liu, Jinsong
# Date 1323170884 0
# Node ID d313582d4fa2157332f1d50e599aebca36c41b3b
# Parent a0befa32e927cc147aaee9bce42c51f53580a875
X86: Disable PCID/INVPCID for pv
This patch disable PCID/INVPCID for pv.
Signed-off-by: Liu, Jinsong
Committed-by: Keir Fraser
--- a/tools/libxc/xc_cpufeature.h
+++ b/tools/libxc/xc_cpufeature.h
@@ -78,6 +78,7 @@
#define X86_FEATURE_CX16 13 /* CMPXCHG16B */
#define X86_FEATURE_XTPR 14 /* Send Task Priority Messages */
#define X86_FEATURE_PDCM 15 /* Perf/Debug Capability MSR */
+#define X86_FEATURE_PCID 17 /* Process Context ID */
#define X86_FEATURE_DCA 18 /* Direct Cache Access */
#define X86_FEATURE_SSE4_1 19 /* Streaming SIMD Extensions 4.1 */
#define X86_FEATURE_SSE4_2 20 /* Streaming SIMD Extensions 4.2 */
@@ -132,5 +133,6 @@
#define X86_FEATURE_SMEP 7 /* Supervisor Mode Execution Protection */
#define X86_FEATURE_BMI2 8 /* 2nd group bit manipulation extensions */
#define X86_FEATURE_ERMS 9 /* Enhanced REP MOVSB/STOSB */
+#define X86_FEATURE_INVPCID 10 /* Invalidate Process Context ID */
#endif /* __LIBXC_CPUFEATURE_H */
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -427,6 +427,7 @@ static void xc_cpuid_pv_policy(
}
clear_bit(X86_FEATURE_XTPR, regs[2]);
clear_bit(X86_FEATURE_PDCM, regs[2]);
+ clear_bit(X86_FEATURE_PCID, regs[2]);
clear_bit(X86_FEATURE_DCA, regs[2]);
set_bit(X86_FEATURE_HYPERVISOR, regs[2]);
break;
++++++ 24389-amd-fam10-gart-tlb-walk-err.patch ++++++
# HG changeset patch
# User Jan Beulich
# Date 1323765911 -3600
# Node ID 868d82faf6511de3b3edce18cc6a9e1c938f0b8f
# Parent 7ca56cca09ade16645fb4806be2c5b2b0bc3332b
x86, amd: Disable GartTlbWlkErr when BIOS forgets it
This patch disables GartTlbWlk errors on AMD Fam10h CPUs if the BIOS
forgets to do is (or is just too old). Letting these errors enabled
can cause a sync-flood on the CPU causing a reboot.
The AMD BKDG recommends disabling GART TLB Wlk Error completely.
Based on a Linux patch from Joerg Roedel ; see e.g.
https://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=patch;h=5bbc...
Signed-off-by: Jan Beulich
Acked-by: Keir Fraser
--- a/xen/arch/x86/cpu/mcheck/amd_f10.c
+++ b/xen/arch/x86/cpu/mcheck/amd_f10.c
@@ -46,6 +46,7 @@
#include
#include "mce.h"
+#include "mce_quirks.h"
#include "x86_mca.h"
@@ -91,9 +92,14 @@ amd_f10_handler(struct mc_info *mi, uint
/* AMD Family10 machine check */
enum mcheck_type amd_f10_mcheck_init(struct cpuinfo_x86 *c)
{
+ enum mcequirk_amd_flags quirkflag = mcequirk_lookup_amd_quirkdata(c);
+
if (amd_k8_mcheck_init(c) == mcheck_none)
return mcheck_none;
+ if (quirkflag == MCEQUIRK_F10_GART)
+ mcequirk_amd_apply(quirkflag);
+
x86_mce_callback_register(amd_f10_handler);
return mcheck_amd_famXX;
--- a/xen/arch/x86/cpu/mcheck/mce_amd_quirks.c
+++ b/xen/arch/x86/cpu/mcheck/mce_amd_quirks.c
@@ -29,6 +29,8 @@ static const struct mce_quirkdata mce_am
MCEQUIRK_K7_BANK0 },
{ 0xf /* cpu family */, ANY /* all models */, ANY /* all steppings */,
MCEQUIRK_K8_GART },
+ { 0x10 /* cpu family */, ANY /* all models */, ANY /* all steppings */,
+ MCEQUIRK_F10_GART },
};
enum mcequirk_amd_flags
@@ -54,6 +56,8 @@ mcequirk_lookup_amd_quirkdata(struct cpu
int mcequirk_amd_apply(enum mcequirk_amd_flags flags)
{
+ u64 val;
+
switch (flags) {
case MCEQUIRK_K7_BANK0:
return 1; /* first bank */
@@ -67,6 +71,10 @@ int mcequirk_amd_apply(enum mcequirk_amd
wrmsrl(MSR_IA32_MC4_CTL, ~(1ULL << 10));
wrmsrl(MSR_IA32_MC4_STATUS, 0ULL);
break;
+ case MCEQUIRK_F10_GART:
+ if (rdmsr_safe(MSR_AMD64_MCx_MASK(4), val) == 0)
+ wrmsr_safe(MSR_AMD64_MCx_MASK(4), val | (1 << 10));
+ break;
}
return 0;
--- a/xen/arch/x86/cpu/mcheck/mce_quirks.h
+++ b/xen/arch/x86/cpu/mcheck/mce_quirks.h
@@ -33,8 +33,9 @@ struct mce_quirkdata {
*/
enum mcequirk_amd_flags {
- MCEQUIRK_K7_BANK0 = 0x1,
- MCEQUIRK_K8_GART = 0x2,
+ MCEQUIRK_K7_BANK0 = 1,
+ MCEQUIRK_K8_GART,
+ MCEQUIRK_F10_GART
};
enum mcequirk_intel_flags {
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -98,6 +98,8 @@
#define CMCI_EN (1UL<<30)
#define CMCI_THRESHOLD_MASK 0x7FFF
+#define MSR_AMD64_MC0_MASK 0xc0010044
+
#define MSR_IA32_MC1_CTL 0x00000404
#define MSR_IA32_MC1_CTL2 0x00000281
#define MSR_IA32_MC1_STATUS 0x00000405
@@ -151,6 +153,8 @@
#define MSR_IA32_MCx_ADDR(x) (MSR_IA32_MC0_ADDR + 4*(x))
#define MSR_IA32_MCx_MISC(x) (MSR_IA32_MC0_MISC + 4*(x))
+#define MSR_AMD64_MCx_MASK(x) (MSR_AMD64_MC0_MASK + (x))
+
#define MSR_P6_PERFCTR0 0x000000c1
#define MSR_P6_PERFCTR1 0x000000c2
#define MSR_P6_EVNTSEL0 0x00000186
++++++ 24391-x86-pcpu-version.patch ++++++
# HG changeset patch
# User Jan Beulich
# Date 1323766131 -3600
# Node ID 3f4ffde189f228d88e534865023fd795f77f0d05
# Parent 77528dbced3ea74901be6b1aeddedda22bfdaf63
x86: add platform hypercall to retrieve pCPU-s' family, model, and stepping
With the recent hotplug changes to the Xen part of the microcode
loading, this allows the kernel driver to avoid unnecessary calls into
the hypervisor during pCPU hot-enabling: Knowing that the hypervisor
retains the data for already booted CPUs, only data for CPUs with a
different signature needs to be passed down. Since the microcode
loading code can be pretty verbose, avoiding to invoke it can make the
log much easier to look at in case of problems.
Signed-off-by: Jan Beulich
Acked-by: Keir Fraser
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -469,6 +469,42 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
}
break;
+ case XENPF_get_cpu_version:
+ {
+ struct xenpf_pcpu_version *ver = &op->u.pcpu_version;
+
+ if ( !get_cpu_maps() )
+ {
+ ret = -EBUSY;
+ break;
+ }
+
+ if ( (ver->xen_cpuid >= NR_CPUS) || !cpu_online(ver->xen_cpuid) )
+ {
+ memset(ver->vendor_id, 0, sizeof(ver->vendor_id));
+ ver->family = 0;
+ ver->model = 0;
+ ver->stepping = 0;
+ }
+ else
+ {
+ const struct cpuinfo_x86 *c = &cpu_data[ver->xen_cpuid];
+
+ memcpy(ver->vendor_id, c->x86_vendor_id, sizeof(ver->vendor_id));
+ ver->family = c->x86;
+ ver->model = c->x86_model;
+ ver->stepping = c->x86_mask;
+ }
+
+ ver->max_present = cpumask_last(&cpu_present_map);
+
+ put_cpu_maps();
+
+ if ( copy_field_to_guest(u_xenpf_op, op, u.pcpu_version) )
+ ret = -EFAULT;
+ }
+ break;
+
case XENPF_cpu_online:
{
int cpu = op->u.cpu_ol.cpuid;
--- a/xen/arch/x86/x86_64/platform_hypercall.c
+++ b/xen/arch/x86/x86_64/platform_hypercall.c
@@ -3,7 +3,7 @@
*/
#include
-#include
+#include
#include
DEFINE_XEN_GUEST_HANDLE(compat_platform_op_t);
@@ -26,8 +26,13 @@ DEFINE_XEN_GUEST_HANDLE(compat_platform_
#define xen_processor_power_t compat_processor_power_t
#define set_cx_pminfo compat_set_cx_pminfo
-#define xenpf_pcpuinfo compat_pf_pcpuinfo
-#define xenpf_pcpuinfo_t compat_pf_pcpuinfo_t
+#define xen_pf_pcpuinfo xenpf_pcpuinfo
+CHECK_pf_pcpuinfo;
+#undef xen_pf_pcpuinfo
+
+#define xen_pf_pcpu_version xenpf_pcpu_version
+CHECK_pf_pcpu_version;
+#undef xen_pf_pcpu_version
#define xenpf_enter_acpi_sleep compat_pf_enter_acpi_sleep
--- a/xen/include/public/platform.h
+++ b/xen/include/public/platform.h
@@ -425,6 +425,21 @@ struct xenpf_pcpuinfo {
typedef struct xenpf_pcpuinfo xenpf_pcpuinfo_t;
DEFINE_XEN_GUEST_HANDLE(xenpf_pcpuinfo_t);
+#define XENPF_get_cpu_version 48
+struct xenpf_pcpu_version {
+ /* IN */
+ uint32_t xen_cpuid;
+ /* OUT */
+ /* The maxium cpu_id that is present */
+ uint32_t max_present;
+ char vendor_id[12];
+ uint32_t family;
+ uint32_t model;
+ uint32_t stepping;
+};
+typedef struct xenpf_pcpu_version xenpf_pcpu_version_t;
+DEFINE_XEN_GUEST_HANDLE(xenpf_pcpu_version_t);
+
#define XENPF_cpu_online 56
#define XENPF_cpu_offline 57
struct xenpf_cpu_ol
@@ -468,6 +483,7 @@ struct xen_platform_op {
struct xenpf_getidletime getidletime;
struct xenpf_set_processor_pminfo set_pminfo;
struct xenpf_pcpuinfo pcpu_info;
+ struct xenpf_pcpu_version pcpu_version;
struct xenpf_cpu_ol cpu_ol;
struct xenpf_cpu_hotadd cpu_add;
struct xenpf_mem_hotadd mem_add;
--- a/xen/include/xlat.lst
+++ b/xen/include/xlat.lst
@@ -61,6 +61,17 @@
! memory_reservation memory.h
! pod_target memory.h
? physdev_pci_mmcfg_reserved physdev.h
+! pct_register platform.h
+! power_register platform.h
+? processor_csd platform.h
+! processor_cx platform.h
+! processor_flags platform.h
+! processor_performance platform.h
+! processor_power platform.h
+? processor_px platform.h
+! psd_package platform.h
+? xenpf_pcpuinfo platform.h
+? xenpf_pcpu_version platform.h
! sched_poll sched.h
? sched_remote_shutdown sched.h
? sched_shutdown sched.h
@@ -73,12 +84,3 @@
! vcpu_set_singleshot_timer vcpu.h
? xenoprof_init xenoprof.h
? xenoprof_passive xenoprof.h
-! power_register platform.h
-? processor_csd platform.h
-! processor_cx platform.h
-! processor_flags platform.h
-! processor_power platform.h
-! pct_register platform.h
-? processor_px platform.h
-! psd_package platform.h
-! processor_performance platform.h
++++++ 24411-x86-ucode-AMD-Fam15.patch ++++++
References: bnc#736824
# HG changeset patch
# User Christoph Egger
# Date 1323943209 -3600
# Node ID ca5f588bd203c9207e0988fcc80f43d83eed5420
# Parent 25f8952313ae683f41b634163f62651185d7be38
x86/ucode: fix for AMD Fam15 CPUs
Remove hardcoded maximum size a microcode patch can have. This is
dynamic now.
The microcode patch for family15h can be larger than 2048 bytes and
gets silently truncated.
Signed-off-by: Christoph Egger
Signed-off-by: Jan Beulich
--- 2011-12-14.orig/xen/arch/x86/microcode_amd.c 2011-12-15 14:55:15.000000000 +0100
+++ 2011-12-14/xen/arch/x86/microcode_amd.c 2011-12-15 14:59:47.000000000 +0100
@@ -27,18 +27,10 @@
#include
#include
-#define pr_debug(x...) ((void)0)
-
#define UCODE_MAGIC 0x00414d44
#define UCODE_EQUIV_CPU_TABLE_TYPE 0x00000000
#define UCODE_UCODE_TYPE 0x00000001
-#define UCODE_MAX_SIZE (2048)
-#define DEFAULT_UCODE_DATASIZE (896)
-#define MC_HEADER_SIZE (sizeof(struct microcode_header_amd))
-#define DEFAULT_UCODE_TOTALSIZE (DEFAULT_UCODE_DATASIZE + MC_HEADER_SIZE)
-#define DWSIZE (sizeof(uint32_t))
-
/* serialize access to the physical write */
static DEFINE_SPINLOCK(microcode_update_lock);
@@ -99,7 +91,7 @@ static int microcode_fits(void *mc, int
}
if ( mc_header->patch_id <= uci->cpu_sig.rev )
- return -EINVAL;
+ return 0;
printk(KERN_DEBUG "microcode: CPU%d found a matching microcode "
"update with version 0x%x (current=0x%x)\n",
@@ -147,8 +139,12 @@ static int apply_microcode(int cpu)
return 0;
}
-static int get_next_ucode_from_buffer_amd(void *mc, const void *buf,
- size_t size, unsigned long *offset)
+static int get_next_ucode_from_buffer_amd(
+ void **mc,
+ size_t *mc_size,
+ const void *buf,
+ size_t size,
+ unsigned long *offset)
{
struct microcode_header_amd *mc_header;
size_t total_size;
@@ -181,8 +177,17 @@ static int get_next_ucode_from_buffer_am
return -EINVAL;
}
- memset(mc, 0, UCODE_MAX_SIZE);
- memcpy(mc, (const void *)(&bufp[off + 8]), total_size);
+ if ( *mc_size < total_size )
+ {
+ xfree(*mc);
+ *mc = xmalloc_bytes(total_size);
+ if ( !*mc )
+ return -ENOMEM;
+ *mc_size = total_size;
+ }
+ else if ( *mc_size > total_size )
+ memset(*mc + total_size, 0, *mc_size - total_size);
+ memcpy(*mc, mc_header, total_size);
*offset = off + total_size + 8;
@@ -236,10 +241,10 @@ static int cpu_request_microcode(int cpu
{
const uint32_t *buf_pos;
unsigned long offset = 0;
- int error = 0;
- int ret;
+ int error;
struct ucode_cpu_info *uci = &per_cpu(ucode_cpu_info, cpu);
void *mc;
+ size_t mc_size;
/* We should bind the task to the CPU */
BUG_ON(cpu != raw_smp_processor_id());
@@ -260,7 +265,9 @@ static int cpu_request_microcode(int cpu
return -EINVAL;
}
- mc = xmalloc_bytes(UCODE_MAX_SIZE);
+ /* Size of 1st microcode patch in bytes */
+ mc_size = buf_pos[offset / sizeof(*buf_pos) + 1];
+ mc = xmalloc_bytes(mc_size);
if ( mc == NULL )
{
printk(KERN_ERR "microcode: error! "
@@ -276,24 +284,33 @@ static int cpu_request_microcode(int cpu
* It's possible the data file has multiple matching ucode,
* lets keep searching till the latest version
*/
- while ( (ret = get_next_ucode_from_buffer_amd(mc, buf, size, &offset)) == 0)
+ while ( (error = get_next_ucode_from_buffer_amd(&mc, &mc_size, buf, size,
+ &offset)) == 0 )
{
+ uci->mc.mc_amd = mc;
+
error = microcode_fits(mc, cpu);
if (error <= 0)
continue;
error = apply_microcode(cpu);
if (error == 0)
+ {
+ error = 1;
break;
+ }
}
/* On success keep the microcode patch for
* re-apply on resume.
*/
- if (error) {
+ if ( error <= 0 )
+ {
xfree(mc);
mc = NULL;
}
+ else
+ error = 0;
uci->mc.mc_amd = mc;
out:
++++++ 24412-x86-AMD-errata-model-shift.patch ++++++
# HG changeset patch
# User Jan Beulich
# Date 1323955725 -3600
# Node ID 99caac2e35df41cbece606f663cb5570a62613c3
# Parent ca5f588bd203c9207e0988fcc80f43d83eed5420
x86/AMD: use correct shift count when merging model and stepping
... for legacy errata matching.
Signed-off-by: Jan Beulich
Acked-by: Keir Fraser
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -216,7 +216,7 @@ int cpu_has_amd_erratum(const struct cpu
}
/* OSVW unavailable or ID unknown, match family-model-stepping range */
- ms = (cpu->x86_model << 8) | cpu->x86_mask;
+ ms = (cpu->x86_model << 4) | cpu->x86_mask;
while ((range = va_arg(ap, int))) {
if ((cpu->x86 == AMD_MODEL_RANGE_FAMILY(range)) &&
(ms >= AMD_MODEL_RANGE_START(range)) &&
++++++ 24417-amd-erratum-573.patch ++++++
# HG changeset patch
# User Jan Beulich
# Date 1324046740 -3600
# Node ID 1452fb248cd513832cfbbd1100b9b72a0dde7ea6
# Parent 01c8b27e3d7d4ad2b469be9922bb04b5eb0195e8
x86/emulator: workaround for AMD erratum 573
The only cases where we might end up emulating fsincos (as any other
x87 operations without memory operands) are
- when a HVM guest is in real mode (not applicable on AMD)
- between two half page table updates in PAE mode (unlikely, and not
doing the emulation here does affect only performance, not
correctness)
- when a guest maliciously (or erroneously) modifies an (MMIO or page
table update) instruction under emulation (unspecified behavior)
Hence, in order to avoid the erratum to cause harm to the entire host,
don't emulate fsincos on the affected AMD CPU families.
Signed-off-by: Jan Beulich
Acked-by: Keir Fraser
--- a/tools/tests/x86_emulator/x86_emulate.c
+++ b/tools/tests/x86_emulator/x86_emulate.c
@@ -3,5 +3,7 @@
#include
#include
+#define cpu_has_amd_erratum(nr) 0
+
#include "x86_emulate/x86_emulate.h"
#include "x86_emulate/x86_emulate.c"
--- a/xen/arch/x86/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate.c
@@ -10,8 +10,15 @@
*/
#include
+#include /* current_cpu_info */
+#include /* cpu_has_amd_erratum() */
/* Avoid namespace pollution. */
#undef cmpxchg
+#undef cpuid
+#undef wbinvd
+
+#define cpu_has_amd_erratum(nr) \
+ cpu_has_amd_erratum(¤t_cpu_data, AMD_ERRATUM_##nr)
#include "x86_emulate/x86_emulate.c"
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -2621,6 +2621,9 @@ x86_emulate(
case 0xd9: /* FPU 0xd9 */
switch ( modrm )
{
+ case 0xfb: /* fsincos */
+ fail_if(cpu_has_amd_erratum(573));
+ /* fall through */
case 0xc0 ... 0xc7: /* fld %stN */
case 0xc8 ... 0xcf: /* fxch %stN */
case 0xd0: /* fnop */
@@ -2646,7 +2649,6 @@ x86_emulate(
case 0xf8: /* fprem */
case 0xf9: /* fyl2xp1 */
case 0xfa: /* fsqrt */
- case 0xfb: /* fsincos */
case 0xfc: /* frndint */
case 0xfd: /* fscale */
case 0xfe: /* fsin */
--- a/xen/include/asm-x86/amd.h
+++ b/xen/include/asm-x86/amd.h
@@ -138,6 +138,12 @@
AMD_OSVW_ERRATUM(1, AMD_MODEL_RANGE(0xf, 0x41, 0x2, 0xff, 0xf), \
AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0xff, 0xf))
+#define AMD_ERRATUM_573 \
+ AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x0f, 0x0, 0x0, 0xff, 0xf), \
+ AMD_MODEL_RANGE(0x10, 0x0, 0x0, 0xff, 0xf), \
+ AMD_MODEL_RANGE(0x11, 0x0, 0x0, 0xff, 0xf), \
+ AMD_MODEL_RANGE(0x12, 0x0, 0x0, 0xff, 0xf))
+
struct cpuinfo_x86;
int cpu_has_amd_erratum(const struct cpuinfo_x86 *, int, ...);
++++++ 24429-mceinj-tool.patch ++++++
# HG changeset patch
# User Liu, Jinsong
# Date 1324219200 0
# Node ID 9587ccc2ae3192fd5625a87fa58e840377471867
# Parent 5b4b7e565ab82b06940889f2be7e30042b2881fc
X86-MCE: fix a bug of xen-mceinj tool
Fix a bug of xen-mceinj tool which used to test mce by software way.
Signed-off-by: Liu, Jinsong
Committed-by: Keir Fraser
--- a/tools/tests/mce-test/tools/xen-mceinj.c
+++ b/tools/tests/mce-test/tools/xen-mceinj.c
@@ -134,8 +134,12 @@ static int mca_cpuinfo(xc_interface *xc_
{
struct xen_mc mc;
+ memset(&mc, 0, sizeof(struct xen_mc));
+
mc.cmd = XEN_MC_physcpuinfo;
- if (xc_mca_op(xc_handle, &mc))
+ mc.interface_version = XEN_MCA_INTERFACE_VERSION;
+
+ if (!xc_mca_op(xc_handle, &mc))
return mc.u.mc_physcpuinfo.ncpus;
else
return 0;
++++++ 24447-x86-TXT-INIT-SIPI-delay.patch ++++++
# HG changeset patch
# User Gang Wei
# Date 1325153274 0
# Node ID a7b2610b8e5c9a15b1f5de9a3eabf7f19d0b4199
# Parent 2863b2f43a3bc9268885379d6fd55ed325b8c0a2
X86: Add a delay between INIT & SIPIs for tboot AP bring-up in X2APIC case
Without this delay, Xen could not bring APs up while working with
TXT/tboot, because tboot needs some time in APs to handle INIT before
becoming ready for receiving SIPIs (this delay was removed as part of
c/s 23724 by Tim Deegan).
Signed-off-by: Gang Wei
Acked-by: Keir Fraser
Acked-by: Tim Deegan
Committed-by: Tim Deegan
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -42,6 +42,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -473,6 +474,18 @@ static int wakeup_secondary_cpu(int phys
send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY;
} while ( send_status && (timeout++ < 1000) );
}
+ else if ( tboot_in_measured_env() )
+ {
+ /*
+ * With tboot AP is actually spinning in a mini-guest before
+ * receiving INIT. Upon receiving INIT ipi, AP need time to VMExit,
+ * update VMCS to tracking SIPIs and VMResume.
+ *
+ * While AP is in root mode handling the INIT the CPU will drop
+ * any SIPIs
+ */
+ udelay(10);
+ }
/*
* Should we send STARTUP IPIs ?
++++++ 24448-x86-pt-irq-leak.patch ++++++
References: bnc#735806
# HG changeset patch
# User Jan Beulich
# Date 1325492779 -3600
# Node ID 3a22ed3ec534799b3cab55b0dc0a7380e701ecbe
# Parent a7b2610b8e5c9a15b1f5de9a3eabf7f19d0b4199
x86/passthrough: don't leak guest IRQs
As unmap_domain_pirq_emuirq() fails on a never mapped pIRQ, it must not
be called for the non-emu-IRQ case (to prevent the entire unmap
operation failing).
Based on a suggestion from Stefano.
Signed-off-by: Jan Beulich
Tested-by: Yongjie Ren
Acked-by: Stefano Stabellini
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -228,7 +228,8 @@ static int physdev_unmap_pirq(struct phy
if ( is_hvm_domain(d) )
{
spin_lock(&d->event_lock);
- ret = unmap_domain_pirq_emuirq(d, unmap->pirq);
+ if ( domain_pirq_to_emuirq(d, unmap->pirq) != IRQ_UNBOUND )
+ ret = unmap_domain_pirq_emuirq(d, unmap->pirq);
spin_unlock(&d->event_lock);
if ( unmap->domid == DOMID_SELF || ret )
goto free_domain;
++++++ 24453-x86-vIRQ-IRR-TMR-race.patch ++++++
# HG changeset patch
# User Yongan Liu
# Date 1325752199 -3600
# Node ID 02b92d035f6484ea33f03c4a59630d82e0469eeb
# Parent efaa28639a71524a693ba500624f8512e5795e18
x86/vIRQ: IRR and TMR race condition bug fix
In vlapic_set_irq, we set the IRR register before the TMR. And the IRR
might be serviced before setting TMR, and even worse EOI might occur
before TMR setting, in which case the vioapic_update_EOI won't be
called, and further prevent all the subsequent interrupt injecting.
Reorder setting the TMR and IRR will solve the problem.
Besides, KVM has fixed a similar bug in: