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.rei...@proxmox.com> --- v5: check for empty file debian/rules | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/debian/rules b/debian/rules index 8f428c7..bc43ade 100755 --- a/debian/rules +++ b/debian/rules @@ -21,6 +21,8 @@ ARCH ?= $(shell dpkg-architecture -qDEB_HOST_GNU_CPU) PACKAGE=pve-qemu-kvm destdir := $(CURDIR)/debian/$(PACKAGE) +flagfile := $(destdir)/usr/share/kvm/cpu-flags-understood-x86_64 + CFLAGS = -Wall ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) @@ -128,6 +130,18 @@ 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 \ + ' > $(flagfile) + + # check that file is not empty + [ -s $(flagfile) ] + # 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@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel