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

Stefan Reiter s.reiter at proxmox.com
Mon Oct 7 14:47:21 CEST 2019


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
+
 # Build architecture-independent files here.
 binary-indep: build install
 # We have nothing to do by default.
-- 
2.20.1





More information about the pve-devel mailing list