[pve-devel] [PATCH v4 qemu 02/12] Write understood CPU flags into static file

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Oct 14 12:49:56 CEST 2019


On October 7, 2019 2:47 pm, Stefan Reiter wrote:
> located at /usr/share/kvm/cpu-flags-understood-$arch
> 
> This file can be read by qemu-server's "query_understood_cpu_flags"
> function, avoiding a more expensive call to QEMU.
> 
> For now, only x86_64 is implemented, since aarch64 doesn't print any flags when
> called this way.
> 
> Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
> ---
>  debian/rules | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/debian/rules b/debian/rules
> index 8f428c7..7cf73fb 100755
> --- a/debian/rules
> +++ b/debian/rules
> @@ -128,6 +128,15 @@ install: build
>  	rm -Rf $(destdir)/usr/include
>  	rm -Rf $(destdir)/usr/lib*
>  
> +	# write files for understood CPU flags, since these are static for every
> +	# version (saves a QEMU call in qemu-server at runtime)
> +	$(destdir)/usr/bin/qemu-system-x86_64 -cpu help \
> +		| perl -0777 -pe ' \
> +			s/^.*Recognized CPUID flags://s; # remove up to flags \
> +			s/\n{2,}.*$$//s; # remove any trailing text \
> +			s/\s{2,}|\n/\s/g; # remove unnecessary whitespace \
> +		' > $(destdir)/usr/share/kvm/cpu-flags-understood-x86_64

might make sense to add a check that the file is non-empty afterwards, 
to catch breakage early?

> +
>  # Build architecture-independent files here.
>  binary-indep: build install
>  # We have nothing to do by default.
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 




More information about the pve-devel mailing list