[pve-devel] [PATCH v2 qemu-server 09/12] fix #2318: allow phys-bits and host-phys-bits CPU settings

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Oct 2 08:34:50 CEST 2019


On 9/30/19 12:58 PM, Stefan Reiter wrote:
> Can be specified for a particular VM or via a custom CPU model (VM takes
> precedence).

Maybe add a hint for why this is needed at all here too, something like:
> allows to boot a VM with more than 1TB of memory
> ... ?

else I've no idea what this is for without doing research myself..

> 
> Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
> ---
>  PVE/QemuServer/CPUConfig.pm | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/PVE/QemuServer/CPUConfig.pm b/PVE/QemuServer/CPUConfig.pm
> index e595a69..f0bfeee 100644
> --- a/PVE/QemuServer/CPUConfig.pm
> +++ b/PVE/QemuServer/CPUConfig.pm
> @@ -137,6 +137,19 @@ my $cpu_fmt = {
>  	pattern => qr/[+-][a-zA-Z0-9\-_\.]+(;[+-][a-zA-Z0-9\-_\.]+)*/,
>  	optional => 1,
>      },
> +    'phys-bits' => {
> +	type => 'integer',
> +	minimum => 1,

does 1 really works or makes sense? maybe set a minimum which
is a bit more relevant in practice like 8 or even 16..

> +	maximum => 64,
> +	description => "The physical memory address bits that are reported to the guest OS. Should be smaller or equal to the host's.",
> +	optional => 1,
> +    },
> +    'host-phys-bits' => {
> +	type => 'boolean',
> +	default => 0,
> +	description => "Whether to report the host's physical memory address bits. Overrides 'phys-bits' when set.",
> +	optional => 1,
> +    },
>  };
>  
>  # $cpu_fmt describes both the CPU config passed as part of a VM config, as well
> @@ -445,6 +458,17 @@ sub get_cpu_options {
>      $cpu .= resolve_cpu_flags($pve_flags, $hv_flags, $custom_cputype_flags,
>  			      $vm_flags, $pve_forced_flags);
>  
> +    my $phys_bits = '';
> +    foreach my $conf ($custom_cpuconf, $cpuconf) {
> +	next if !defined($conf);
> +	if ($conf->{'host-phys-bits'}) {
> +	    $phys_bits = ",host-phys-bits=true";
> +	} elsif ($conf->{'phys-bits'}) {
> +	    $phys_bits = ",phys-bits=$conf->{'phys-bits'}";
> +	}
> +    }
> +    $cpu .= $phys_bits;
> +
>      return ('-cpu', $cpu);
>  }
>  
> 





More information about the pve-devel mailing list