Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package xen for openSUSE:Factory checked in at 2021-12-03 20:35:25 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/xen (Old) and /work/SRC/openSUSE:Factory/.xen.new.31177 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "xen" Fri Dec 3 20:35:25 2021 rev:307 rq:935029 version:4.16.0_02 Changes: -------- --- /work/SRC/openSUSE:Factory/xen/xen.changes 2021-11-20 02:39:17.320750755 +0100 +++ /work/SRC/openSUSE:Factory/.xen.new.31177/xen.changes 2021-12-03 20:35:32.584191426 +0100 @@ -1,0 +2,24 @@ +Wed Dec 1 09:45:10 MST 2021 - carn...@suse.com + +- Update to Xen 4.16.0 FCS release + xen-4.16.0-testing-src.tar.bz2 + * Miscellaneous fixes to the TPM manager software in preparation + for TPM 2.0 support. + * Increased reliance on the PV shim as 32-bit PV guests will only + be supported in shim mode going forward. This change reduces + the attack surface in the hypervisor. + * Increased hardware support by allowing Xen to boot on Intel + devices that lack a Programmable Interval Timer. + * Cleanup of legacy components by no longer building QEMU + Traditional or PV-Grub by default. Note both projects have + upstream Xen support merged now, so it is no longer recommended + to use the Xen specific forks. + * Initial support for guest virtualized Performance Monitor + Counters on Arm. + * Improved support for dom0less mode by allowing the usage on + Arm 64bit hardware with EFI firmware. + * Improved support for Arm 64-bit heterogeneous systems by + leveling the CPU features across all to improve big.LITTLE + support. + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ xen.spec ++++++ --- /var/tmp/diff_new_pack.TG7EYh/_old 2021-12-03 20:35:34.120185814 +0100 +++ /var/tmp/diff_new_pack.TG7EYh/_new 2021-12-03 20:35:34.128185784 +0100 @@ -28,7 +28,6 @@ Name: xen ExclusiveArch: %ix86 x86_64 aarch64 -%define changeset 41121 %define xen_build_dir xen-4.16.0-testing # %define with_gdbsx 0 @@ -120,7 +119,7 @@ %endif Provides: installhint(reboot-needed) -Version: 4.16.0_01 +Version: 4.16.0_02 Release: 0 Summary: Xen Virtualization: Hypervisor (aka VMM aka Microkernel) License: GPL-2.0-only @@ -452,7 +451,6 @@ XEN_FULLVERSION=$XEN_FULLVERSION _EOV_ source ./.our_xenversion -echo "%{changeset}" > xen/.scmversion sed -i~ " s/XEN_VERSION[[:blank:]]*=.*/XEN_VERSION = $XEN_VERSION/ s/XEN_SUBVERSION[[:blank:]]*=.*/XEN_SUBVERSION = $XEN_SUBVERSION/ ++++++ xen-4.16.0-testing-src.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/CHANGELOG.md new/xen-4.16.0-testing/CHANGELOG.md --- old/xen-4.16.0-testing/CHANGELOG.md 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/CHANGELOG.md 2021-12-01 17:44:20.000000000 +0100 @@ -4,7 +4,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) -## [unstable UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD +## [4.16.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=staging) - 2021-12-02 ### Removed - XENSTORED_ROOTDIR environment variable from configuartion files and @@ -21,8 +21,33 @@ - qemu-traditional based device models (both, qemu-traditional and ioemu-stubdom) will no longer be built per default. In order to be able to use those, configure needs to be called with "--enable-qemu-traditional" as parameter. + - Fixes for credit2 scheduler stability in corner case conditions. + - Ongoing improvements in the hypervisor build system. + - vtpmmgr miscellaneous fixes in preparation for TPM 2.0 support. + - 32bit PV guests only supported in shim mode. + - Improved PVH dom0 debug key handling. + - Fix booting on some Intel systems without a PIT (i8254). + - Cleanup of the xenstore library interface. + - Fix truncation of return value from xencall2 by introducing a new helper + that returns a long instead. + - Fix system register accesses on Arm to use the proper 32/64bit access size. + - Various fixes for Arm OP-TEE mediator. + - Switch to domheap for Xen page tables. + +### Added + - 32bit Arm builds to the gitlab-ci automated tests. + - x86 full system tests to the gitlab-ci automated tests. + - Arm limited vPMU support for guests. + - Static physical memory allocation for dom0less on arm64. + - dom0less EFI support on arm64. + - GICD_ICPENDR register handling in vGIC emulation to support Zephyr OS. + - CPU feature leveling on arm64 platform with heterogeneous cores. + - Report unpopulated memory regions safe to use for external mappings, Arm and + device tree only. + - Support of generic DT IOMMU bindings for Arm SMMU v2. + - Limit grant table version on a per-domain basis. -## [4.15.0 UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - TBD +## [4.15.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - 2021-04-08 ### Added / support upgraded - ARM IOREQ servers (device emulation etc.) (Tech Preview) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/ChangeLog new/xen-4.16.0-testing/ChangeLog --- old/xen-4.16.0-testing/ChangeLog 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/ChangeLog 2021-12-01 17:44:20.000000000 +0100 @@ -1,12 +1,7 @@ -commit 2d72d2784eb71d8532bfbd6462d261739c9e82e4 -Author: Jan Beulich <jbeul...@suse.com> -Date: Tue Nov 16 17:34:06 2021 +0100 +commit b0b4661fa3cba995e433b94ea569c90f65a3e5fc +Author: Ian Jackson <i...@xenproject.org> +Date: Tue Nov 30 11:42:42 2021 +0000 - public/gnttab: relax v2 recommendation + xen/Makefile: Set 4.16 version - With there being a way to disable v2 support, telling new guests to use - v2 exclusively is not a good suggestion. - - Signed-off-by: Jan Beulich <jbeul...@suse.com> - Reviewed-by: Luca Fancellu <luca.fance...@arm.com> - Release-Acked-by: Ian Jackson <i...@xenproject.org> + Signed-off-by: Ian Jackson <i...@xenproject.org> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/Config.mk new/xen-4.16.0-testing/Config.mk --- old/xen-4.16.0-testing/Config.mk 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/Config.mk 2021-12-01 17:44:20.000000000 +0100 @@ -239,17 +239,15 @@ MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git endif OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5 -QEMU_UPSTREAM_REVISION ?= b6e539830bf45e2d7a6bd86ddfdf003088b173b0 -MINIOS_UPSTREAM_REVISION ?= 9f09744aa3e5982a083ecf8e9cd2123f477081f9 +QEMU_UPSTREAM_REVISION ?= qemu-xen-4.16.0 +MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.16.0 SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0 ETHERBOOT_NICS ?= rtl8139 8086100e -QEMU_TRADITIONAL_REVISION ?= 3d273dd05e51e5a1ffba3d98c7437ee84e8f8764 -# Wed Jul 15 10:01:40 2020 +0100 -# qemu-trad: remove Xen path dependencies +QEMU_TRADITIONAL_REVISION ?= xen-4.16.0 # Specify which qemu-dm to use. This may be `ioemu' to use the old # Mercurial in-tree version, or a local directory, or a git URL. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/README new/xen-4.16.0-testing/README --- old/xen-4.16.0-testing/README 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/README 2021-12-01 17:44:20.000000000 +0100 @@ -1,9 +1,9 @@ ############################################################ __ __ _ _ _ __ -\ \/ /___ _ __ | || | / |/ /_ _ __ ___ - \ // _ \ '_ \ | || |_ | | '_ \ _____| '__/ __| - / \ __/ | | | |__ _|| | (_) |_____| | | (__ -/_/\_\___|_| |_| |_|(_)_|\___/ |_| \___| +\ \/ /___ _ __ | || | / |/ /_ + \ // _ \ '_ \ | || |_ | | '_ \ + / \ __/ | | | |__ _|| | (_) | +/_/\_\___|_| |_| |_|(_)_|\___/ ############################################################ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/SUPPORT.md new/xen-4.16.0-testing/SUPPORT.md --- old/xen-4.16.0-testing/SUPPORT.md 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/SUPPORT.md 2021-12-01 17:44:20.000000000 +0100 @@ -9,13 +9,13 @@ # Release Support - Xen-Version: unstable - Initial-Release: n/a - Supported-Until: TBD - Security-Support-Until: Unreleased - not yet security-supported + Xen-Version: 4.16 + Initial-Release: 2021-12-02 + Supported-Until: 2023-06-02 + Security-Support-Until: 2024-12-02 Release Notes -: <a href="https://wiki.xenproject.org/wiki/Xen_Project_X.YY_Release_Notes">RN</a> +: <a href="https://wiki.xenproject.org/wiki/Xen_Project_4.16_Release_Notes">RN</a> # Feature Support diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/tools/Rules.mk new/xen-4.16.0-testing/tools/Rules.mk --- old/xen-4.16.0-testing/tools/Rules.mk 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/tools/Rules.mk 2021-12-01 17:44:20.000000000 +0100 @@ -25,7 +25,7 @@ XENSTORE_XENSTORED ?= y # A debug build of tools? -debug ?= y +debug ?= n debug_symbols ?= $(debug) XEN_GOCODE_URL = golang.xenproject.org diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/tools/examples/xeninfo.pl new/xen-4.16.0-testing/tools/examples/xeninfo.pl --- old/xen-4.16.0-testing/tools/examples/xeninfo.pl 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/tools/examples/xeninfo.pl 1970-01-01 01:00:00.000000000 +0100 @@ -1,284 +0,0 @@ -#!/usr/bin/perl -w - -############################################################################################################# -# # -# Developed by Ingard Mev??g @ Oslo University College, spring 2007 # -# ingard [at] mevaag [dot] no # -# # -# This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 License. # -# To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter # -# to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. # -# # -############################################################################################################# - -use strict; -# http://search.cpan.org/~rjray/RPC-XML-0.59/lib/RPC/XML/Client.pm -require RPC::XML; -require RPC::XML::Client; - -# for debug purposes -#use Data::Dumper; - -##### CONFIG ###### - -my %xenhosts = ("192.0.2.10" => {"port" => "9363"}, - "192.0.2.11" => {"port" => "9363"}, - "192.0.2.12" => {"port" => "9363"}, - "192.0.2.13" => {"port" => "9363"}); - -##### CONFIG END ### - -##### STATIC VARS ##### -my %host_info; - -####################### -sub apiconnect -{ - foreach my $xenhost (keys %xenhosts) - { - my $xen = RPC::XML::Client->new("http://$xenhost:$xenhosts{$xenhost}{'port'}"); - my $session = $xen->simple_request("session.login_with_password", "user",""); - if (! $session) - { - print "Can't connect to $xenhost :(\n"; - $xenhosts{$xenhost} = {'xen' => $xen, 'session' => ""}; - } - else - { - $xenhosts{$xenhost} = {'xen' => $xen, 'session' => $session->{'Value'}}; - print "Connected successfully to $xenhost..\n"; - } - } -} - -sub validate_response -{ - my ($result_ref) = @_; - if ($result_ref->{'Status'} eq "Success") - { - return $result_ref->{'Value'}; - } - else - { - # status = Failure ! -# die ("xmlrpc failed! ErrorDescription: $result_ref->{'ErrorDescription'}[1] -> $result_ref->{'ErrorDescription'}[0]"); - print "xmlrpc failed! ErrorDescription: $result_ref->{'ErrorDescription'}[1] -> $result_ref->{'ErrorDescription'}[0]\n"; - } -} - -sub get_host_cpu_utilisation -{ - my ($xen, $session, $host_name, $host_ref) = @_; - my $host_cpu_ref = validate_response($xen->simple_request("host.get_host_CPUs", $session, $host_ref)); - foreach (@$host_cpu_ref) - { - my $host_cpu_utilisation = validate_response($xen->simple_request("host_cpu.get_utilisation", $session, $_)); - $host_info{$host_name}{'cpus'}{$_} = $host_cpu_utilisation; - print " CPUiNFO: $host_cpu_utilisation\n"; - } -} - -sub get_host_pif_utilisation -{ - my ($xen, $session, $host_name, $host_ref) = @_; - -# This method isnt implemented yet it seems so using PIF.get_all for now.. -# This will break when xen is made cluster aware.. -# my $host_pif_ref = validate_response($xen->simple_request("host.get_PIFs", $session, $host_ref)); - my $host_pif_ref = validate_response($xen->simple_request("PIF.get_all", $session)); - foreach (@$host_pif_ref) - { - my $host_pif_device = validate_response($xen->simple_request("PIF.get_device", $session, $_)); - my $host_pif_metrics_ref = validate_response($xen->simple_request("PIF.get_metrics", $session, $_)); - -# Whats the best solution performancewise? -# Collecting stats from get_records, or pulling individually? - -# my $host_pif_record = validate_response($xen->simple_request("PIF_metrics.get_record", $session, $host_pif_metrics_ref)); -# my $host_pif_io_read = $host_pif_record->{'io_read_kbs'}; -# my $host_pif_io_write = $host_pif_record->{'io_write_kbs'}; - my $host_pif_io_read = validate_response($xen->simple_request("PIF_metrics.get_io_read_kbs", $session, $host_pif_metrics_ref)); - my $host_pif_io_write = validate_response($xen->simple_request("PIF_metrics.get_io_write_kbs", $session, $host_pif_metrics_ref)); - - $host_info{$host_name}{'pifs'}{$host_pif_device} = {'read' => $host_pif_io_read, 'write' => $host_pif_io_write}; - print " PiFiNFO: $host_pif_device READ: $host_pif_io_read - WRITE: $host_pif_io_write\n"; -# $host_info{$host_name}{'pifs'}{$host_pif_device}{'read'} = $host_pif_io_read; -# $host_info{$host_name}{'pifs'}{$host_pif_device}{'write'} = $host_pif_io_write; - } -} - -sub get_host_mem_utilisation -{ - my ($xen, $session, $host_name, $host_ref) = @_; - my $host_metrics_ref = validate_response($xen->simple_request("host.get_metrics", $session, $host_ref)); - my $host_mem_total = validate_response($xen->simple_request("host_metrics.get_memory_total", $session, $host_metrics_ref)) / 1024 / 1024; - my $host_mem_free = validate_response($xen->simple_request("host_metrics.get_memory_free", $session, $host_metrics_ref)) / 1024 / 1024; - $host_info{$host_name}{'memory'} = {'total' => $host_mem_total, 'free' => $host_mem_free}; - print " MEMiNFO: Total: $host_mem_total MB - Free: $host_mem_free MB\n"; -} - -sub get_vm_mem_info -{ - my ($xen, $session, $host_name, $vm_ref, $vm_name_label) = @_; - my $vm_mem_stat_max = validate_response($xen->simple_request("VM.get_memory_static_max",$session,$vm_ref)); - my $vm_mem_stat_min = validate_response($xen->simple_request("VM.get_memory_static_min",$session,$vm_ref)); - my $vm_mem_dyn_max = validate_response($xen->simple_request("VM.get_memory_dynamic_max",$session,$vm_ref)); - my $vm_mem_dyn_min = validate_response($xen->simple_request("VM.get_memory_dynamic_min",$session,$vm_ref)); - - # not implemented yet.. We'll do this at the same time as getting cpu utilisation - # in the get_vm_metrics sub instead.. - #my $vm_metrics_ref = validate_response($xen->simple_request("VM.get_metrics",$session,$vm_ref)); - #my $vm_mem_actual = validate_response($xen->simple_request("VM_metrics.get_memory_actual",$session,$vm_metrics_ref)); - - $host_info{$host_name}{'vms'}{$vm_name_label}{'memory'} = {'static_max' => $vm_mem_stat_max, - 'static_min' => $vm_mem_stat_min, - 'dynamic_max' => $vm_mem_dyn_max, - 'dynamic_min' => $vm_mem_dyn_min}; - - # xm list uses the dynamic min var as far as i can tell.. or? - # Lets print the memactual info instead of this... I'll do that in the get_vm_metrics sub instead.. - # print " |- MEMiNFO: Dynamic Min: $vm_mem_dyn_min - Actually in use: $vm_mem_actual\n"; -} - -sub get_vm_metrics -{ - my ($xen, $session, $host_name, $vm_ref, $vm_name_label) = @_; - my $vm_metrics_ref = validate_response($xen->simple_request("VM.get_metrics",$session,$vm_ref)); - - my %vm_vcpu_utilisation = %{validate_response($xen->simple_request("VM_metrics.get_vcpus_utilisation",$session,$vm_metrics_ref))}; - for my $tempcpu (keys %vm_vcpu_utilisation) - { - print " |- CPUiNFO: $tempcpu - $vm_vcpu_utilisation{$tempcpu}\n"; - $host_info{$host_name}{'vms'}{$vm_name_label}{'vcpus'} = {$tempcpu => $vm_vcpu_utilisation{$tempcpu}}; - } - my $vm_mem_actual = validate_response($xen->simple_request("VM_metrics.get_memory_actual",$session,$vm_metrics_ref)) / 1024 / 1024; - $host_info{$host_name}{'vms'}{$vm_name_label}{'memory'}{'actual'} = "$vm_mem_actual"; - print " |- MEMiNFO: Actually in use: $vm_mem_actual MB\n"; -} - -sub get_vm_vif_utilisation -{ - my ($xen, $session, $host_name, $vm_ref, $vm_name_label) = @_; - my $vm_vifs = validate_response($xen->simple_request("VM.get_VIFs",$session,$vm_ref)); - foreach (@$vm_vifs) - { - my $vif_device = validate_response($xen->simple_request("VIF.get_device",$session,$_)); - my $vif_io_read = validate_response($xen->simple_request("VIF_metrics.get_io_read_kbs", $session, $_)); - my $vif_io_write = validate_response($xen->simple_request("VIF_metrics.get_io_write_kbs", $session, $_)); - $host_info{$host_name}{'vms'}{$vm_name_label}{'vifs'}{$vif_device} = {'read' => $vif_io_read, 'write' => $vif_io_write}; - print " |- ViFiNFO: $vif_device READ: $vif_io_read - WRITE: $vif_io_write\n"; - } -} - -sub get_vm_vbd_utilisation -{ - my ($xen, $session, $host_name, $vm_ref, $vm_name_label) = @_; - my $vm_vbds = validate_response($xen->simple_request("VM.get_VBDs",$session,$vm_ref)); - foreach (@$vm_vbds) - { - my $vbd_device = validate_response($xen->simple_request("VBD.get_device",$session,$_)); - my $vbd_io_read = validate_response($xen->simple_request("VBD_metrics.get_io_read_kbs", $session, $_)); - my $vbd_io_write = validate_response($xen->simple_request("VBD_metrics.get_io_write_kbs", $session, $_)); - $host_info{$host_name}{'vms'}{$vm_name_label}{'vbds'}{$vbd_device} = {'read' => $vbd_io_read, 'write' => $vbd_io_write}; - print " |- VBDiNFO: $vbd_device READ: $vbd_io_read - WRITE: $vbd_io_write\n"; - } -} - - -sub get_vm_type -{ - my ($xen, $session, $host_name, $vm_ref, $vm_name_label) = @_; - # not running response through validate_response() here to stop it from crashing.. - # - # api docs says if this (following) field is set, its a HVM domain. - my $vm_bootloader_results = $xen->simple_request("VM.get_HVM_boot_policy",$session,$vm_ref); - if ("$vm_bootloader_results->{'Status'}" eq "Success") - { - if ("$vm_bootloader_results->{'Value'}" ne "") - { - $host_info{$host_name}{'vms'}{$vm_name_label}{'type'} = "HVM"; - } - else - { - $host_info{$host_name}{'vms'}{$vm_name_label}{'type'} = "PV"; - } - } - else - { - # However, xen 3.0.4 doest support this part of the api, so afaik I can get the difference with: - my $vm_pv_kernel_results = $xen->simple_request("VM.get_PV_kernel",$session,$vm_ref); - # which is something like: - # 'PV_kernel': '/boot/vmlinuz-2.6.18-xen', - # or - # 'PV_kernel': 'hvmloader', - if ("$vm_pv_kernel_results->{'Value'}" =~ m/hvm/i) - { - $host_info{$host_name}{'vms'}{$vm_name_label}{'type'} = "HVM"; - } - else - { - $host_info{$host_name}{'vms'}{$vm_name_label}{'type'} = "PV"; - } - } -} - -sub get_complete_info -{ - my %all_vms; - foreach my $xenhost (sort keys %xenhosts) - { - next unless $xenhosts{$xenhost}{'session'}; - my $xen = $xenhosts{$xenhost}{'xen'}; - my $session = $xenhosts{$xenhost}{'session'}; - print "_______________________\n## $xenhost ##\n-----------------------\n"; - - my $host_ref = validate_response($xen->simple_request("session.get_this_host", $session)); - - my $host_name = validate_response($xen->simple_request("host.get_name_label", $session, $host_ref)); - $xenhosts{$xenhost}{'hostname'} = $host_name; - $host_info{$host_name}{'ip'} = $xenhost; - - get_host_cpu_utilisation($xen, $session, $host_name, $host_ref); - - get_host_mem_utilisation($xen, $session, $host_name, $host_ref); - - get_host_pif_utilisation($xen, $session, $host_name, $host_ref); - - - my $all_vm_refs = validate_response($xen->simple_request("host.get_resident_VMs",$session, $host_ref)); - - foreach my $vm_ref (@$all_vm_refs) - { - my $vm_name_label = validate_response($xen->simple_request("VM.get_name_label",$session,$vm_ref)); - get_vm_type($xen,$session,$host_name,$vm_ref,$vm_name_label); - - my $vm_id = validate_response($xen->simple_request("VM.get_domid",$session,$vm_ref)); - - print "vm: $vm_id\t$vm_name_label\ttype: $host_info{$host_name}{'vms'}->{$vm_name_label}{'type'}\n"; - - # vm_metrics includes both mem_actual & cpu utilisation - # So we'll add all stats found in that class in one go.. - get_vm_metrics($xen,$session,$host_name,$vm_ref,$vm_name_label); -# get_vm_cpu_utilisation($xen,$session,$host_name,$vm_ref,$vm_name_label); - - # all other mem stats are added seperately.. - # This might not be needed at all as xen doesnt have functionality to - # resize mem for a VM atm (afaik) - get_vm_mem_info($xen,$session,$host_name,$vm_ref,$vm_name_label); - - get_vm_vif_utilisation($xen,$session,$host_name,$vm_ref,$vm_name_label); - - get_vm_vbd_utilisation($xen,$session,$host_name,$vm_ref,$vm_name_label); - - $all_vms{$vm_name_label} = "" unless ("$vm_name_label" eq "Domain-0"); - } - print "\n"; - } - # Debug: Uncomment to see the nested datastructure.. - #print Dumper(%host_info); -} - - - -apiconnect(); -get_complete_info(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/tools/golang/xenlight/helpers.gen.go new/xen-4.16.0-testing/tools/golang/xenlight/helpers.gen.go --- old/xen-4.16.0-testing/tools/golang/xenlight/helpers.gen.go 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/tools/golang/xenlight/helpers.gen.go 2021-12-01 17:44:20.000000000 +0100 @@ -323,6 +323,7 @@ x.VcpuMaxId = uint32(xc.vcpu_max_id) x.VcpuOnline = uint32(xc.vcpu_online) x.Cpupool = uint32(xc.cpupool) +x.GpaddrBits = byte(xc.gpaddr_bits) x.DomainType = DomainType(xc.domain_type) return nil} @@ -355,6 +356,7 @@ xc.vcpu_max_id = C.uint32_t(x.VcpuMaxId) xc.vcpu_online = C.uint32_t(x.VcpuOnline) xc.cpupool = C.uint32_t(x.Cpupool) +xc.gpaddr_bits = C.uint8_t(x.GpaddrBits) xc.domain_type = C.libxl_domain_type(x.DomainType) return nil @@ -1012,6 +1014,7 @@ } x.MaxGrantFrames = uint32(xc.max_grant_frames) x.MaxMaptrackFrames = uint32(xc.max_maptrack_frames) +x.MaxGrantVersion = int(xc.max_grant_version) x.DeviceModelVersion = DeviceModelVersion(xc.device_model_version) if err := x.DeviceModelStubdomain.fromC(&xc.device_model_stubdomain);err != nil { return fmt.Errorf("converting field DeviceModelStubdomain: %v", err) @@ -1341,6 +1344,7 @@ } xc.max_grant_frames = C.uint32_t(x.MaxGrantFrames) xc.max_maptrack_frames = C.uint32_t(x.MaxMaptrackFrames) +xc.max_grant_version = C.int(x.MaxGrantVersion) xc.device_model_version = C.libxl_device_model_version(x.DeviceModelVersion) if err := x.DeviceModelStubdomain.toC(&xc.device_model_stubdomain); err != nil { return fmt.Errorf("converting field DeviceModelStubdomain: %v", err) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/tools/golang/xenlight/types.gen.go new/xen-4.16.0-testing/tools/golang/xenlight/types.gen.go --- old/xen-4.16.0-testing/tools/golang/xenlight/types.gen.go 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/tools/golang/xenlight/types.gen.go 2021-12-01 17:44:20.000000000 +0100 @@ -316,6 +316,7 @@ VcpuMaxId uint32 VcpuOnline uint32 Cpupool uint32 +GpaddrBits byte DomainType DomainType } @@ -479,6 +480,7 @@ VnumaNodes []VnodeInfo MaxGrantFrames uint32 MaxMaptrackFrames uint32 +MaxGrantVersion int DeviceModelVersion DeviceModelVersion DeviceModelStubdomain Defbool StubdomainMemkb uint64 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/tools/helpers/init-xenstore-domain.c new/xen-4.16.0-testing/tools/helpers/init-xenstore-domain.c --- old/xen-4.16.0-testing/tools/helpers/init-xenstore-domain.c 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/tools/helpers/init-xenstore-domain.c 2021-12-01 17:44:20.000000000 +0100 @@ -89,7 +89,7 @@ */ .max_grant_frames = 4, .max_maptrack_frames = 128, - .grant_opts = 1, + .grant_opts = XEN_DOMCTL_GRANT_version(1), }; xs_fd = open("/dev/xen/xenbus_backend", O_RDWR); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/tools/libs/guest/xg_cpuid_x86.c new/xen-4.16.0-testing/tools/libs/guest/xg_cpuid_x86.c --- old/xen-4.16.0-testing/tools/libs/guest/xg_cpuid_x86.c 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/tools/libs/guest/xg_cpuid_x86.c 2021-12-01 17:44:20.000000000 +0100 @@ -638,13 +638,6 @@ } } - /* - * Do not try to shrink the policy if restoring, as that could cause - * guest visible changes in the maximum leaf fields. - */ - if ( !restore ) - x86_cpuid_policy_shrink_max_leaves(p); - rc = x86_cpuid_copy_to_buffer(p, leaves, &nr_leaves); if ( rc ) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/tools/libs/light/libxl_create.c new/xen-4.16.0-testing/tools/libs/light/libxl_create.c --- old/xen-4.16.0-testing/tools/libs/light/libxl_create.c 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/tools/libs/light/libxl_create.c 2021-12-01 17:44:20.000000000 +0100 @@ -629,7 +629,7 @@ .max_evtchn_port = b_info->event_channels, .max_grant_frames = b_info->max_grant_frames, .max_maptrack_frames = b_info->max_maptrack_frames, - .grant_opts = b_info->max_grant_version, + .grant_opts = XEN_DOMCTL_GRANT_version(b_info->max_grant_version), .vmtrace_size = ROUNDUP(b_info->vmtrace_buf_kb << 10, XC_PAGE_SHIFT), }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/tools/ocaml/libs/xc/xenctrl_stubs.c new/xen-4.16.0-testing/tools/ocaml/libs/xc/xenctrl_stubs.c --- old/xen-4.16.0-testing/tools/ocaml/libs/xc/xenctrl_stubs.c 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/tools/ocaml/libs/xc/xenctrl_stubs.c 2021-12-01 17:44:20.000000000 +0100 @@ -199,7 +199,8 @@ .max_evtchn_port = Int_val(VAL_MAX_EVTCHN_PORT), .max_grant_frames = Int_val(VAL_MAX_GRANT_FRAMES), .max_maptrack_frames = Int_val(VAL_MAX_MAPTRACK_FRAMES), - .grant_opts = Int_val(VAL_MAX_GRANT_VERSION), + .grant_opts = + XEN_DOMCTL_GRANT_version(Int_val(VAL_MAX_GRANT_VERSION)), }; domain_handle_of_uuid_string(cfg.handle, String_val(VAL_HANDLE)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/tools/python/xen/lowlevel/xc/xc.c new/xen-4.16.0-testing/tools/python/xen/lowlevel/xc/xc.c --- old/xen-4.16.0-testing/tools/python/xen/lowlevel/xc/xc.c 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/tools/python/xen/lowlevel/xc/xc.c 2021-12-01 17:44:20.000000000 +0100 @@ -116,7 +116,7 @@ PyObject *args, PyObject *kwds) { - uint32_t dom = 0, target = 0; + uint32_t dom = 0, target = 0, max_grant_version = 2; int ret; size_t i; PyObject *pyhandle = NULL; @@ -132,12 +132,13 @@ }; static char *kwd_list[] = { "domid", "ssidref", "handle", "flags", - "target", "max_vcpus", NULL }; + "target", "max_vcpus", "max_grant_version", + NULL }; - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiOiii", kwd_list, + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiOiiii", kwd_list, &dom, &config.ssidref, &pyhandle, &config.flags, &target, - &config.max_vcpus) ) + &config.max_vcpus, &max_grant_version) ) return NULL; if ( pyhandle != NULL ) { @@ -162,6 +163,7 @@ #else #error Architecture not supported #endif + config.grant_opts = XEN_DOMCTL_GRANT_version(max_grant_version); if ( (ret = xc_domain_create(self->xc_handle, &dom, &config)) < 0 ) return pyxc_error_to_exception(self->xc_handle); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/tools/tests/cpu-policy/test-cpu-policy.c new/xen-4.16.0-testing/tools/tests/cpu-policy/test-cpu-policy.c --- old/xen-4.16.0-testing/tools/tests/cpu-policy/test-cpu-policy.c 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/tools/tests/cpu-policy/test-cpu-policy.c 2021-12-01 17:44:20.000000000 +0100 @@ -8,13 +8,10 @@ #include <err.h> #include <xen-tools/libs.h> -#include <xen/asm/x86-defns.h> #include <xen/asm/x86-vendors.h> #include <xen/lib/x86/cpu-policy.h> #include <xen/domctl.h> -#define XSTATE_FP_SSE (X86_XCR0_FP | X86_XCR0_SSE) - static unsigned int nr_failures; #define fail(fmt, ...) \ ({ \ @@ -573,103 +570,6 @@ } } -static void test_cpuid_maximum_leaf_shrinking(void) -{ - static const struct test { - const char *name; - struct cpuid_policy p; - } tests[] = { - { - .name = "basic", - .p = { - /* Very basic information only. */ - .basic.max_leaf = 1, - .basic.raw_fms = 0xc2, - }, - }, - { - .name = "cache", - .p = { - /* Cache subleaves present. */ - .basic.max_leaf = 4, - .cache.subleaf[0].type = 1, - }, - }, - { - .name = "feat#0", - .p = { - /* Subleaf 0 only with some valid bit. */ - .basic.max_leaf = 7, - .feat.max_subleaf = 0, - .feat.fsgsbase = 1, - }, - }, - { - .name = "feat#1", - .p = { - /* Subleaf 1 only with some valid bit. */ - .basic.max_leaf = 7, - .feat.max_subleaf = 1, - .feat.avx_vnni = 1, - }, - }, - { - .name = "topo", - .p = { - /* Topology subleaves present. */ - .basic.max_leaf = 0xb, - .topo.subleaf[0].type = 1, - }, - }, - { - .name = "xstate", - .p = { - /* First subleaf always valid (and then non-zero). */ - .basic.max_leaf = 0xd, - .xstate.xcr0_low = XSTATE_FP_SSE, - }, - }, - { - .name = "extd", - .p = { - /* Commonly available information only. */ - .extd.max_leaf = 0x80000008, - .extd.maxphysaddr = 0x28, - .extd.maxlinaddr = 0x30, - }, - }, - }; - - printf("Testing CPUID maximum leaf shrinking:\n"); - - for ( size_t i = 0; i < ARRAY_SIZE(tests); ++i ) - { - const struct test *t = &tests[i]; - struct cpuid_policy *p = memdup(&t->p); - - p->basic.max_leaf = ARRAY_SIZE(p->basic.raw) - 1; - p->feat.max_subleaf = ARRAY_SIZE(p->feat.raw) - 1; - p->extd.max_leaf = 0x80000000 | (ARRAY_SIZE(p->extd.raw) - 1); - - x86_cpuid_policy_shrink_max_leaves(p); - - /* Check the the resulting max (sub)leaf values against expecations. */ - if ( p->basic.max_leaf != t->p.basic.max_leaf ) - fail(" Test %s basic fail - expected %#x, got %#x\n", - t->name, t->p.basic.max_leaf, p->basic.max_leaf); - - if ( p->extd.max_leaf != t->p.extd.max_leaf ) - fail(" Test %s extd fail - expected %#x, got %#x\n", - t->name, t->p.extd.max_leaf, p->extd.max_leaf); - - if ( p->feat.max_subleaf != t->p.feat.max_subleaf ) - fail(" Test %s feat fail - expected %#x, got %#x\n", - t->name, t->p.feat.max_subleaf, p->feat.max_subleaf); - - free(p); - } -} - static void test_is_compatible_success(void) { static struct test { @@ -785,7 +685,6 @@ test_cpuid_serialise_success(); test_cpuid_deserialise_failure(); test_cpuid_out_of_range_clearing(); - test_cpuid_maximum_leaf_shrinking(); test_msr_serialise_success(); test_msr_deserialise_failure(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/tools/tests/resource/test-resource.c new/xen-4.16.0-testing/tools/tests/resource/test-resource.c --- old/xen-4.16.0-testing/tools/tests/resource/test-resource.c 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/tools/tests/resource/test-resource.c 2021-12-01 17:44:20.000000000 +0100 @@ -120,6 +120,7 @@ .create = { .max_vcpus = 2, .max_grant_frames = 40, + .grant_opts = XEN_DOMCTL_GRANT_version(1), }, }, { @@ -128,6 +129,7 @@ .flags = XEN_DOMCTL_CDF_hvm, .max_vcpus = 2, .max_grant_frames = 40, + .grant_opts = XEN_DOMCTL_GRANT_version(1), .arch = { .emulation_flags = XEN_X86_EMU_LAPIC, }, @@ -140,6 +142,7 @@ .flags = XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap, .max_vcpus = 2, .max_grant_frames = 40, + .grant_opts = XEN_DOMCTL_GRANT_version(1), }, }, #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/tools/tests/tsx/test-tsx.c new/xen-4.16.0-testing/tools/tests/tsx/test-tsx.c --- old/xen-4.16.0-testing/tools/tests/tsx/test-tsx.c 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/tools/tests/tsx/test-tsx.c 2021-12-01 17:44:20.000000000 +0100 @@ -444,6 +444,7 @@ struct xen_domctl_createdomain c = { .max_vcpus = 1, .max_grant_frames = 1, + .grant_opts = XEN_DOMCTL_GRANT_version(1), }; printf("Testing PV guest\n"); @@ -456,6 +457,7 @@ .flags = XEN_DOMCTL_CDF_hvm, .max_vcpus = 1, .max_grant_frames = 1, + .grant_opts = XEN_DOMCTL_GRANT_version(1), .arch = { .emulation_flags = XEN_X86_EMU_LAPIC, }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/xen/Kconfig.debug new/xen-4.16.0-testing/xen/Kconfig.debug --- old/xen-4.16.0-testing/xen/Kconfig.debug 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/xen/Kconfig.debug 2021-12-01 17:44:20.000000000 +0100 @@ -3,7 +3,7 @@ config DEBUG bool "Developer Checks" - default y + default n ---help--- If you say Y here this will enable developer checks such as asserts and extra printks. This option is intended for development purposes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/xen/Makefile new/xen-4.16.0-testing/xen/Makefile --- old/xen-4.16.0-testing/xen/Makefile 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/xen/Makefile 2021-12-01 17:44:20.000000000 +0100 @@ -2,7 +2,7 @@ # All other places this is stored (eg. compile.h) should be autogenerated. export XEN_VERSION = 4 export XEN_SUBVERSION = 16 -export XEN_EXTRAVERSION ?= -rc$(XEN_VENDORVERSION) +export XEN_EXTRAVERSION ?= .0$(XEN_VENDORVERSION) export XEN_FULLVERSION = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION) -include xen-version diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/xen/arch/arm/domain_build.c new/xen-4.16.0-testing/xen/arch/arm/domain_build.c --- old/xen-4.16.0-testing/xen/arch/arm/domain_build.c 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/xen/arch/arm/domain_build.c 2021-12-01 17:44:20.000000000 +0100 @@ -2986,7 +2986,7 @@ .max_evtchn_port = -1, .max_grant_frames = -1, .max_maptrack_frames = -1, - .grant_opts = opt_gnttab_max_version, + .grant_opts = XEN_DOMCTL_GRANT_version(opt_gnttab_max_version), }; if ( !dt_device_is_compatible(node, "xen,domain") ) @@ -3094,7 +3094,7 @@ .max_evtchn_port = -1, .max_grant_frames = gnttab_dom0_frames(), .max_maptrack_frames = -1, - .grant_opts = opt_gnttab_max_version, + .grant_opts = XEN_DOMCTL_GRANT_version(opt_gnttab_max_version), }; /* The vGIC for DOM0 is exactly emulating the hardware GIC */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/xen/arch/x86/cpuid.c new/xen-4.16.0-testing/xen/arch/x86/cpuid.c --- old/xen-4.16.0-testing/xen/arch/x86/cpuid.c 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/xen/arch/x86/cpuid.c 2021-12-01 17:44:20.000000000 +0100 @@ -353,8 +353,6 @@ p->extd.raw[0xa].d |= ((1u << SVM_FEATURE_VMCBCLEAN) | (1u << SVM_FEATURE_TSCRATEMSR)); } - - x86_cpuid_policy_shrink_max_leaves(p); } static void __init guest_common_default_feature_adjustments(uint32_t *fs) @@ -434,8 +432,6 @@ recalculate_xstate(p); p->extd.raw[0xa] = EMPTY_LEAF; /* No SVM for PV guests. */ - - x86_cpuid_policy_shrink_max_leaves(p); } static void __init calculate_pv_def_policy(void) @@ -456,8 +452,6 @@ sanitise_featureset(pv_featureset); cpuid_featureset_to_policy(pv_featureset, p); recalculate_xstate(p); - - x86_cpuid_policy_shrink_max_leaves(p); } static void __init calculate_hvm_max_policy(void) @@ -523,8 +517,6 @@ sanitise_featureset(hvm_featureset); cpuid_featureset_to_policy(hvm_featureset, p); recalculate_xstate(p); - - x86_cpuid_policy_shrink_max_leaves(p); } static void __init calculate_hvm_def_policy(void) @@ -549,8 +541,6 @@ sanitise_featureset(hvm_featureset); cpuid_featureset_to_policy(hvm_featureset, p); recalculate_xstate(p); - - x86_cpuid_policy_shrink_max_leaves(p); } void __init init_guest_cpuid(void) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/xen/arch/x86/mm/p2m-pod.c new/xen-4.16.0-testing/xen/arch/x86/mm/p2m-pod.c --- old/xen-4.16.0-testing/xen/arch/x86/mm/p2m-pod.c 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/xen/arch/x86/mm/p2m-pod.c 2021-12-01 17:44:20.000000000 +0100 @@ -113,15 +113,13 @@ /* Then add to the appropriate populate-on-demand list. */ switch ( order ) { - case PAGE_ORDER_1G: - for ( i = 0; i < (1UL << PAGE_ORDER_1G); i += 1UL << PAGE_ORDER_2M ) + case PAGE_ORDER_2M ... PAGE_ORDER_1G: + for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_2M ) page_list_add_tail(page + i, &p2m->pod.super); break; - case PAGE_ORDER_2M: - page_list_add_tail(page, &p2m->pod.super); - break; - case PAGE_ORDER_4K: - page_list_add_tail(page, &p2m->pod.single); + case PAGE_ORDER_4K ... PAGE_ORDER_2M - 1: + for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_4K ) + page_list_add_tail(page + i, &p2m->pod.single); break; default: BUG(); @@ -504,7 +502,7 @@ } /* - * This function is needed for two reasons: + * This pair of functions is needed for two reasons: * + To properly handle clearing of PoD entries * + To "steal back" memory being freed for the PoD cache, rather than * releasing it. @@ -512,8 +510,8 @@ * Once both of these functions have been completed, we can return and * allow decrease_reservation() to handle everything else. */ -unsigned long -p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order) +static unsigned long +decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order) { unsigned long ret = 0, i, n; struct p2m_domain *p2m = p2m_get_hostp2m(d); @@ -561,8 +559,10 @@ * All PoD: Mark the whole region invalid and tell caller * we're done. */ - if ( p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid, - p2m->default_access) ) + int rc = p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid, + p2m->default_access); + + if ( rc ) { /* * If this fails, we can't tell how much of the range was changed. @@ -570,7 +570,12 @@ * impossible. */ if ( order != 0 ) + { + printk(XENLOG_G_ERR + "%pd: marking GFN %#lx (order %u) as non-PoD failed: %d\n", + d, gfn_x(gfn), order, rc); domain_crash(d); + } goto out_unlock; } ret = 1UL << order; @@ -679,6 +684,22 @@ return ret; } +unsigned long +p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order) +{ + unsigned long left = 1UL << order, ret = 0; + unsigned int chunk_order = find_first_set_bit(gfn_x(gfn) | left); + + do { + ret += decrease_reservation(d, gfn, chunk_order); + + left -= 1UL << chunk_order; + gfn = gfn_add(gfn, 1UL << chunk_order); + } while ( left ); + + return ret; +} + void p2m_pod_dump_data(struct domain *d) { struct p2m_domain *p2m = p2m_get_hostp2m(d); @@ -1289,19 +1310,15 @@ return true; } - -int -guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l, - unsigned int order) +static int +mark_populate_on_demand(struct domain *d, unsigned long gfn_l, + unsigned int order) { struct p2m_domain *p2m = p2m_get_hostp2m(d); gfn_t gfn = _gfn(gfn_l); unsigned long i, n, pod_count = 0; int rc = 0; - if ( !paging_mode_translate(d) ) - return -EINVAL; - gfn_lock(p2m, gfn, order); P2M_DEBUG("mark pod gfn=%#lx\n", gfn_l); @@ -1341,12 +1358,44 @@ ioreq_request_mapcache_invalidate(d); } + else if ( order ) + { + /* + * If this failed, we can't tell how much of the range was changed. + * Best to crash the domain. + */ + printk(XENLOG_G_ERR + "%pd: marking GFN %#lx (order %u) as PoD failed: %d\n", + d, gfn_l, order, rc); + domain_crash(d); + } out: gfn_unlock(p2m, gfn, order); return rc; } + +int +guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn, + unsigned int order) +{ + unsigned long left = 1UL << order; + unsigned int chunk_order = find_first_set_bit(gfn | left); + int rc; + + if ( !paging_mode_translate(d) ) + return -EINVAL; + + do { + rc = mark_populate_on_demand(d, gfn, chunk_order); + + left -= 1UL << chunk_order; + gfn += 1UL << chunk_order; + } while ( !rc && left ); + + return rc; +} void p2m_pod_init(struct p2m_domain *p2m) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/xen/arch/x86/mm/p2m.c new/xen-4.16.0-testing/xen/arch/x86/mm/p2m.c --- old/xen-4.16.0-testing/xen/arch/x86/mm/p2m.c 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/xen/arch/x86/mm/p2m.c 2021-12-01 17:44:20.000000000 +0100 @@ -794,6 +794,7 @@ unsigned long i; p2m_type_t t; p2m_access_t a; + int rc; ASSERT(gfn_locked_by_me(p2m, gfn)); P2M_DEBUG("removing gfn=%#lx mfn=%#lx\n", gfn_x(gfn), mfn_x(mfn)); @@ -825,8 +826,27 @@ ioreq_request_mapcache_invalidate(p2m->domain); - return p2m_set_entry(p2m, gfn, INVALID_MFN, page_order, p2m_invalid, - p2m->default_access); + rc = p2m_set_entry(p2m, gfn, INVALID_MFN, page_order, p2m_invalid, + p2m->default_access); + if ( likely(!rc) || !mfn_valid(mfn) ) + return rc; + + /* + * The operation may have partially succeeded. For the failed part we need + * to undo the M2P update and, out of precaution, mark the pages dirty + * again. + */ + for ( i = 0; i < (1UL << page_order); ++i ) + { + p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0, NULL, NULL); + if ( !p2m_is_hole(t) && !p2m_is_special(t) && !p2m_is_shared(t) ) + { + set_gpfn_from_mfn(mfn_x(mfn) + i, gfn_x(gfn) + i); + paging_mark_pfn_dirty(p2m->domain, _pfn(gfn_x(gfn) + i)); + } + } + + return rc; } int @@ -1022,13 +1042,8 @@ /* Now, actually do the two-way mapping */ rc = p2m_set_entry(p2m, gfn, mfn, page_order, t, p2m->default_access); - if ( rc == 0 ) + if ( likely(!rc) ) { - pod_lock(p2m); - p2m->pod.entry_count -= pod_count; - BUG_ON(p2m->pod.entry_count < 0); - pod_unlock(p2m); - if ( !p2m_is_grant(t) ) { for ( i = 0; i < (1UL << page_order); i++ ) @@ -1036,6 +1051,42 @@ gfn_x(gfn_add(gfn, i))); } } + else + { + /* + * The operation may have partially succeeded. For the successful part + * we need to update M2P and dirty state, while for the failed part we + * may need to adjust PoD stats as well as undo the earlier M2P update. + */ + for ( i = 0; i < (1UL << page_order); ++i ) + { + omfn = p2m->get_entry(p2m, gfn_add(gfn, i), &ot, &a, 0, NULL, NULL); + if ( p2m_is_pod(ot) ) + { + BUG_ON(!pod_count); + --pod_count; + } + else if ( mfn_eq(omfn, mfn_add(mfn, i)) && ot == t && + a == p2m->default_access && !p2m_is_grant(t) ) + { + set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i); + paging_mark_pfn_dirty(d, _pfn(gfn_x(gfn) + i)); + } + else if ( p2m_is_ram(ot) && !p2m_is_paged(ot) ) + { + ASSERT(mfn_valid(omfn)); + set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i); + } + } + } + + if ( pod_count ) + { + pod_lock(p2m); + p2m->pod.entry_count -= pod_count; + BUG_ON(p2m->pod.entry_count < 0); + pod_unlock(p2m); + } out: p2m_unlock(p2m); @@ -1325,6 +1376,49 @@ return 0; } } + + P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn)); + rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access); + if ( unlikely(rc) ) + { + gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n", + gfn_l, order, rc, mfn_x(mfn)); + + /* + * The operation may have partially succeeded. For the successful part + * we need to update PoD stats, M2P, and dirty state. + */ + if ( order != PAGE_ORDER_4K ) + { + unsigned long i; + + for ( i = 0; i < (1UL << order); ++i ) + { + p2m_type_t t; + mfn_t cmfn = p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0, + NULL, NULL); + + if ( !mfn_eq(cmfn, mfn_add(mfn, i)) || t != gfn_p2mt || + a != access ) + continue; + + if ( p2m_is_ram(ot) ) + { + ASSERT(mfn_valid(mfn_add(omfn, i))); + set_gpfn_from_mfn(mfn_x(omfn) + i, INVALID_M2P_ENTRY); + + ioreq_request_mapcache_invalidate(d); + } + else if ( p2m_is_pod(ot) ) + { + pod_lock(p2m); + BUG_ON(!p2m->pod.entry_count); + --p2m->pod.entry_count; + pod_unlock(p2m); + } + } + } + } else if ( p2m_is_ram(ot) ) { unsigned long i; @@ -1337,12 +1431,6 @@ ioreq_request_mapcache_invalidate(d); } - - P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn)); - rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access); - if ( rc ) - gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n", - gfn_l, order, rc, mfn_x(mfn)); else if ( p2m_is_pod(ot) ) { pod_lock(p2m); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/xen/arch/x86/setup.c new/xen-4.16.0-testing/xen/arch/x86/setup.c --- old/xen-4.16.0-testing/xen/arch/x86/setup.c 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/xen/arch/x86/setup.c 2021-12-01 17:44:20.000000000 +0100 @@ -755,7 +755,7 @@ .max_evtchn_port = -1, .max_grant_frames = -1, .max_maptrack_frames = -1, - .grant_opts = opt_gnttab_max_version, + .grant_opts = XEN_DOMCTL_GRANT_version(opt_gnttab_max_version), .max_vcpus = dom0_max_vcpus(), .arch = { .misc_flags = opt_dom0_msr_relaxed ? XEN_X86_MSR_RELAXED : 0, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/xen/common/efi/runtime.c new/xen-4.16.0-testing/xen/common/efi/runtime.c --- old/xen-4.16.0-testing/xen/common/efi/runtime.c 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/xen/common/efi/runtime.c 2021-12-01 17:44:20.000000000 +0100 @@ -607,6 +607,9 @@ break; case XEN_EFI_query_variable_info: + { + uint64_t max_store_size, remain_store_size, max_size; + if ( op->misc & ~XEN_EFI_VARINFO_BOOT_SNAPSHOT ) return -EINVAL; @@ -638,16 +641,36 @@ if ( !efi_enabled(EFI_RS) || (efi_rs->Hdr.Revision >> 16) < 2 ) return -EOPNOTSUPP; + + /* + * Bounce the variables onto the stack to make them 8 byte aligned when + * called from the compat handler, as their placement in + * compat_pf_efi_runtime_call will make them 4 byte aligned instead and + * and compilers may validly complain. + * + * Note that while the function parameters are OUT only, copy the + * values here anyway just in case. This is done regardless of whether + * called from the compat handler or not, as it's not worth the extra + * logic to differentiate. + */ + max_store_size = op->u.query_variable_info.max_store_size; + remain_store_size = op->u.query_variable_info.remain_store_size; + max_size = op->u.query_variable_info.max_size; + state = efi_rs_enter(); if ( !state.cr3 ) return -EOPNOTSUPP; status = efi_rs->QueryVariableInfo( - op->u.query_variable_info.attr, - &op->u.query_variable_info.max_store_size, - &op->u.query_variable_info.remain_store_size, - &op->u.query_variable_info.max_size); + op->u.query_variable_info.attr, &max_store_size, &remain_store_size, + &max_size); efi_rs_leave(&state); + + op->u.query_variable_info.max_store_size = max_store_size; + op->u.query_variable_info.remain_store_size = remain_store_size; + op->u.query_variable_info.max_size = max_size; + break; + } case XEN_EFI_query_capsule_capabilities: case XEN_EFI_update_capsule: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/xen/common/grant_table.c new/xen-4.16.0-testing/xen/common/grant_table.c --- old/xen-4.16.0-testing/xen/common/grant_table.c 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/xen/common/grant_table.c 2021-12-01 17:44:20.000000000 +0100 @@ -2341,7 +2341,8 @@ * pages when it is dying. */ if ( unlikely(e->is_dying) || - unlikely(domain_tot_pages(e) >= e->max_pages) ) + unlikely(domain_tot_pages(e) >= e->max_pages) || + unlikely(!(e->tot_pages + 1)) ) { spin_unlock(&e->page_alloc_lock); @@ -2350,8 +2351,8 @@ e->domain_id); else gdprintk(XENLOG_INFO, - "Transferee d%d has no headroom (tot %u, max %u)\n", - e->domain_id, domain_tot_pages(e), e->max_pages); + "Transferee %pd has no headroom (tot %u, max %u, ex %u)\n", + e, domain_tot_pages(e), e->max_pages, e->extra_pages); gop.status = GNTST_general_error; goto unlock_and_copyback; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/xen/common/page_alloc.c new/xen-4.16.0-testing/xen/common/page_alloc.c --- old/xen-4.16.0-testing/xen/common/page_alloc.c 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/xen/common/page_alloc.c 2021-12-01 17:44:20.000000000 +0100 @@ -2310,20 +2310,41 @@ } else if ( !(memflags & MEMF_no_refcount) ) { - unsigned int tot_pages = domain_tot_pages(d) + nr; + unsigned int tot_pages = domain_tot_pages(d); if ( unlikely(tot_pages > d->max_pages) ) { - gprintk(XENLOG_INFO, "Over-allocation for domain %u: " - "%u > %u\n", d->domain_id, tot_pages, d->max_pages); + gprintk(XENLOG_INFO, "Inconsistent allocation for %pd: %u > %u\n", + d, tot_pages, d->max_pages); + rc = -EPERM; + goto out; + } + + if ( unlikely(nr > d->max_pages - tot_pages) ) + { + gprintk(XENLOG_INFO, "Over-allocation for %pd: %Lu > %u\n", + d, tot_pages + 0ull + nr, d->max_pages); rc = -E2BIG; goto out; } } - if ( !(memflags & MEMF_no_refcount) && - unlikely(domain_adjust_tot_pages(d, nr) == nr) ) - get_knownalive_domain(d); + if ( !(memflags & MEMF_no_refcount) ) + { + if ( unlikely(d->tot_pages + nr < nr) ) + { + gprintk(XENLOG_INFO, + "Excess allocation for %pd: %Lu (%u extra)\n", + d, d->tot_pages + 0ull + nr, d->extra_pages); + if ( pg[0].count_info & PGC_extra ) + d->extra_pages -= nr; + rc = -E2BIG; + goto out; + } + + if ( unlikely(domain_adjust_tot_pages(d, nr) == nr) ) + get_knownalive_domain(d); + } for ( i = 0; i < nr; i++ ) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/xen/drivers/passthrough/vtd/iommu.c new/xen-4.16.0-testing/xen/drivers/passthrough/vtd/iommu.c --- old/xen-4.16.0-testing/xen/drivers/passthrough/vtd/iommu.c 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/xen/drivers/passthrough/vtd/iommu.c 2021-12-01 17:44:20.000000000 +0100 @@ -340,19 +340,21 @@ { pagetable_t pgt = p2m_get_pagetable(p2m_get_hostp2m(d)); - return pagetable_get_paddr(pgt); + pgd_maddr = pagetable_get_paddr(pgt); } - - if ( !hd->arch.vtd.pgd_maddr ) + else { - /* Ensure we have pagetables allocated down to leaf PTE. */ - addr_to_dma_page_maddr(d, 0, 1); - if ( !hd->arch.vtd.pgd_maddr ) - return 0; - } + { + /* Ensure we have pagetables allocated down to leaf PTE. */ + addr_to_dma_page_maddr(d, 0, 1); - pgd_maddr = hd->arch.vtd.pgd_maddr; + if ( !hd->arch.vtd.pgd_maddr ) + return 0; + } + + pgd_maddr = hd->arch.vtd.pgd_maddr; + } /* Skip top levels of page tables for 2- and 3-level DRHDs. */ for ( agaw = level_to_agaw(4); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/xen/include/public/domctl.h new/xen-4.16.0-testing/xen/include/public/domctl.h --- old/xen-4.16.0-testing/xen/include/public/domctl.h 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/xen/include/public/domctl.h 2021-12-01 17:44:20.000000000 +0100 @@ -99,6 +99,7 @@ /* Grant version, use low 4 bits. */ #define XEN_DOMCTL_GRANT_version_mask 0xf +#define XEN_DOMCTL_GRANT_version(v) ((v) & XEN_DOMCTL_GRANT_version_mask) uint32_t grant_opts; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/xen/include/xen/lib/x86/cpuid.h new/xen-4.16.0-testing/xen/include/xen/lib/x86/cpuid.h --- old/xen-4.16.0-testing/xen/include/xen/lib/x86/cpuid.h 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/xen/include/xen/lib/x86/cpuid.h 2021-12-01 17:44:20.000000000 +0100 @@ -386,13 +386,6 @@ */ void x86_cpuid_policy_clear_out_of_range_leaves(struct cpuid_policy *p); -/** - * Shrink max leaf/subleaf values such that the last respective valid entry - * isn't all blank. While permitted by the spec, such extraneous leaves may - * provide undue "hints" to guests. - */ -void x86_cpuid_policy_shrink_max_leaves(struct cpuid_policy *p); - #ifdef __XEN__ #include <public/arch-x86/xen.h> typedef XEN_GUEST_HANDLE_64(xen_cpuid_leaf_t) cpuid_leaf_buffer_t; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.16.0-testing/xen/lib/x86/cpuid.c new/xen-4.16.0-testing/xen/lib/x86/cpuid.c --- old/xen-4.16.0-testing/xen/lib/x86/cpuid.c 2021-11-17 15:24:23.000000000 +0100 +++ new/xen-4.16.0-testing/xen/lib/x86/cpuid.c 2021-12-01 17:44:20.000000000 +0100 @@ -236,45 +236,6 @@ ARRAY_SIZE(p->extd.raw) - 1); } -void x86_cpuid_policy_shrink_max_leaves(struct cpuid_policy *p) -{ - unsigned int i; - - p->basic.raw[0x4] = p->cache.raw[0]; - - for ( i = p->feat.max_subleaf; i; --i ) - if ( p->feat.raw[i].a | p->feat.raw[i].b | - p->feat.raw[i].c | p->feat.raw[i].d ) - break; - p->feat.max_subleaf = i; - p->basic.raw[0x7] = p->feat.raw[i]; - - p->basic.raw[0xb] = p->topo.raw[0]; - - /* - * Due to the way xstate gets handled in the hypervisor (see - * recalculate_xstate()) there is (for now at least) no need to fiddle - * with the xstate subleaves (IOW we assume they're already in consistent - * shape, for coming from either hardware or recalculate_xstate()). - */ - p->basic.raw[0xd] = p->xstate.raw[0]; - - for ( i = p->basic.max_leaf; i; --i ) - if ( p->basic.raw[i].a | p->basic.raw[i].b | - p->basic.raw[i].c | p->basic.raw[i].d ) - break; - p->basic.max_leaf = i; - - for ( i = p->extd.max_leaf & 0xffff; i; --i ) - if ( p->extd.raw[i].a | p->extd.raw[i].b | - p->extd.raw[i].c | p->extd.raw[i].d ) - break; - if ( i | p->extd.raw[0].b | p->extd.raw[0].c | p->extd.raw[0].d ) - p->extd.max_leaf = 0x80000000 | i; - else - p->extd.max_leaf = 0; -} - const uint32_t *x86_cpuid_lookup_deep_deps(uint32_t feature) { static const uint32_t deep_features[] = INIT_DEEP_FEATURES;