Re: [systemd-devel] [PATCH 1/2] detect-virt: detect in best-heuristic order
Mantas Mikulėnason Wed, 2015/11/04 15:55: > On Wed, Nov 4, 2015 at 3:52 PM, Lennart Poettering > wrote: > > > On Wed, 04.11.15 15:54, Andrei Borzenkov (arvidj...@gmail.com) wrote: > > > > > 04.11.2015 00:04, Andrew Jones пишет: > > > >afaict, this will fix a regression caused by commit 75f86906c5. > > > >Where we used to report "kvm" before that patch, without this patch, > > > >we would only report "qemu". > > > > > > Are you sure it is regression? QEMU is a program (platform) while KVM is > > > technology. Modern VirtualBox can use KVM as PV interface but it still > > > remains VirtualBox. QEMU may use KVM as PV interface but it still > > > remains QEMU. > > > > > > Where does it matter? Is anything broken because of this change? > > > > I am pretty sure that vbox should be reported as vbox even if it uses > > kvm as backend. qemu-kvm should be reported as kvm, and any other qemu > > as qemu. > > > > As I understand it, VirtualBox doesn't use KVM as *backend*; it only > exposes a KVM-like paravirt interface to *guests*. It does use kvm since version 5.0. -- main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/*Chris get my mail address:*/=0;b=c[a++];) putchar(b-1/(/* gcc -o sig sig.c && ./sig*/b/42*2-3)*42);} pgpHcb6_mOMPF.pgp Description: OpenPGP digital signature ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/2] detect-virt: detect in best-heuristic order
On 04.11.2015 14:52, Lennart Poettering wrote: > On Wed, 04.11.15 15:54, Andrei Borzenkov (arvidj...@gmail.com) wrote: > >> 04.11.2015 00:04, Andrew Jones пишет: >>> afaict, this will fix a regression caused by commit 75f86906c5. >>> Where we used to report "kvm" before that patch, without this patch, >>> we would only report "qemu". >> >> Are you sure it is regression? QEMU is a program (platform) while KVM is >> technology. Modern VirtualBox can use KVM as PV interface but it still >> remains VirtualBox. QEMU may use KVM as PV interface but it still remains >> QEMU. >> >> Where does it matter? Is anything broken because of this change? > > I am pretty sure that vbox should be reported as vbox even if it uses > kvm as backend. qemu-kvm should be reported as kvm, and any other qemu > as qemu. > > Yeah, it's not fully symmetric, but I am pretty sure that's what most > people would expect. > > Lennart > Comparing with 'virt-what' it is not symmetrical, yeah. = QEMU = - HOST: # /usr/bin/qemu-system-x86_64 -m 2048 -smp 2 -drive file=/iso/Rawhide-Xfce-Live-1104.iso,format=raw - GUEST: # dmesg -t | grep DMI DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.8.1-20150318_183358- 04/01/2014 # systemd-detect-virt vm-other # virt-what qemu ~ = QEMU-KVM = - HOST: # /usr/bin/qemu-system-x86_64 -machine accel=kvm -m 2048 -smp 2 -drive file=/iso/Rawhide-Xfce-Live-1104.iso,format=raw - GUEST: # dmesg -t | grep DMI DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.8.1-20150318_183358- 04/01/2014 # systemd-detect-virt kvm # virt-what kvm ~ /proc/cmdline BOOT_IMAGE=vmlinuz0 initrd=initrd0.img root=live:CDLABEL=Rawhide-Xfce-Live-1104 rootfstype=auto ro rd.live.image console=ttyS0 console=tty0 3 SW: kernel-core-4.3.0-1.fc24.x86_64 virt-what-1.15-2.fc23.x86_64 systemd-227-4.gita6bff4a.fc24.x86_64 Ref. http://pkgs.fedoraproject.org/cgit/virt-what.git/tree/virt-what.spec#n37 http://people.redhat.com/~rjones/virt-what ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/2] detect-virt: detect in best-heuristic order
04.11.2015 00:04, Andrew Jones пишет: afaict, this will fix a regression caused by commit 75f86906c5. Where we used to report "kvm" before that patch, without this patch, we would only report "qemu". Are you sure it is regression? QEMU is a program (platform) while KVM is technology. Modern VirtualBox can use KVM as PV interface but it still remains VirtualBox. QEMU may use KVM as PV interface but it still remains QEMU. Where does it matter? Is anything broken because of this change? The reason is because cpuid detection must come before dmi detection. Also, both can safely come before other xen heuristics. --- src/basic/virt.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/basic/virt.c b/src/basic/virt.c index fb181e5b55ee5..1e10fc755f201 100644 --- a/src/basic/virt.c +++ b/src/basic/virt.c @@ -267,12 +267,7 @@ int detect_vm(void) { if (cached_found >= 0) return cached_found; -/* Try xen capabilities file first, if not found try - * high-level hypervisor sysfs file: - * - * https://bugs.freedesktop.org/show_bug.cgi?id=77271 */ - -r = detect_vm_xen(); +r = detect_vm_cpuid(); if (r < 0) return r; if (r != VIRTUALIZATION_NONE) @@ -284,7 +279,14 @@ int detect_vm(void) { if (r != VIRTUALIZATION_NONE) goto finish; -r = detect_vm_cpuid(); +/* x86 xen will most likely be detected by cpuid. If not (most likely + * because we're not an x86 guest), then we should try the xen capabilities + * file next. If that's not found, then we check for the high-level + * hypervisor sysfs file: + * + * https://bugs.freedesktop.org/show_bug.cgi?id=77271 */ + +r = detect_vm_xen(); if (r < 0) return r; if (r != VIRTUALIZATION_NONE) ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/2] detect-virt: detect in best-heuristic order
On Wed, Nov 04, 2015 at 03:54:45PM +0300, Andrei Borzenkov wrote: > 04.11.2015 00:04, Andrew Jones пишет: > >afaict, this will fix a regression caused by commit 75f86906c5. > >Where we used to report "kvm" before that patch, without this patch, > >we would only report "qemu". > > Are you sure it is regression? QEMU is a program (platform) while KVM is > technology. Modern VirtualBox can use KVM as PV interface but it still > remains VirtualBox. QEMU may use KVM as PV interface but it still remains > QEMU. Sounds like VirtualBox should override the hypervisor cpuid leaf with it's own signature, like kvmtool does. > > Where does it matter? Is anything broken because of this change? It's true that programs shouldn't change their behavior when detecting "kvm" vs. "qemu", as "kvm" just means accelerated "qemu", but "shouldn't" isn't something we should count on. Changing a behavior that some users may now expect is a regression. Thanks, drew > > >The reason is because cpuid detection > >must come before dmi detection. Also, both can safely come before > >other xen heuristics. > >--- > > src/basic/virt.c | 16 +--- > > 1 file changed, 9 insertions(+), 7 deletions(-) > > > >diff --git a/src/basic/virt.c b/src/basic/virt.c > >index fb181e5b55ee5..1e10fc755f201 100644 > >--- a/src/basic/virt.c > >+++ b/src/basic/virt.c > >@@ -267,12 +267,7 @@ int detect_vm(void) { > > if (cached_found >= 0) > > return cached_found; > > > >-/* Try xen capabilities file first, if not found try > >- * high-level hypervisor sysfs file: > >- * > >- * https://bugs.freedesktop.org/show_bug.cgi?id=77271 */ > >- > >-r = detect_vm_xen(); > >+r = detect_vm_cpuid(); > > if (r < 0) > > return r; > > if (r != VIRTUALIZATION_NONE) > >@@ -284,7 +279,14 @@ int detect_vm(void) { > > if (r != VIRTUALIZATION_NONE) > > goto finish; > > > >-r = detect_vm_cpuid(); > >+/* x86 xen will most likely be detected by cpuid. If not (most > >likely > >+ * because we're not an x86 guest), then we should try the xen > >capabilities > >+ * file next. If that's not found, then we check for the high-level > >+ * hypervisor sysfs file: > >+ * > >+ * https://bugs.freedesktop.org/show_bug.cgi?id=77271 */ > >+ > >+r = detect_vm_xen(); > > if (r < 0) > > return r; > > if (r != VIRTUALIZATION_NONE) > > > ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/2] detect-virt: detect in best-heuristic order
On Wed, 04.11.15 15:54, Andrei Borzenkov (arvidj...@gmail.com) wrote: > 04.11.2015 00:04, Andrew Jones пишет: > >afaict, this will fix a regression caused by commit 75f86906c5. > >Where we used to report "kvm" before that patch, without this patch, > >we would only report "qemu". > > Are you sure it is regression? QEMU is a program (platform) while KVM is > technology. Modern VirtualBox can use KVM as PV interface but it still > remains VirtualBox. QEMU may use KVM as PV interface but it still remains > QEMU. > > Where does it matter? Is anything broken because of this change? I am pretty sure that vbox should be reported as vbox even if it uses kvm as backend. qemu-kvm should be reported as kvm, and any other qemu as qemu. Yeah, it's not fully symmetric, but I am pretty sure that's what most people would expect. Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/2] detect-virt: detect in best-heuristic order
On Wed, Nov 4, 2015 at 3:52 PM, Lennart Poetteringwrote: > On Wed, 04.11.15 15:54, Andrei Borzenkov (arvidj...@gmail.com) wrote: > > > 04.11.2015 00:04, Andrew Jones пишет: > > >afaict, this will fix a regression caused by commit 75f86906c5. > > >Where we used to report "kvm" before that patch, without this patch, > > >we would only report "qemu". > > > > Are you sure it is regression? QEMU is a program (platform) while KVM is > > technology. Modern VirtualBox can use KVM as PV interface but it still > > remains VirtualBox. QEMU may use KVM as PV interface but it still remains > > QEMU. > > > > Where does it matter? Is anything broken because of this change? > > I am pretty sure that vbox should be reported as vbox even if it uses > kvm as backend. qemu-kvm should be reported as kvm, and any other qemu > as qemu. > As I understand it, VirtualBox doesn't use KVM as *backend*; it only exposes a KVM-like paravirt interface to *guests*. -- Mantas Mikulėnas ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 1/2] detect-virt: detect in best-heuristic order
afaict, this will fix a regression caused by commit 75f86906c5. Where we used to report "kvm" before that patch, without this patch, we would only report "qemu". The reason is because cpuid detection must come before dmi detection. Also, both can safely come before other xen heuristics. --- src/basic/virt.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/basic/virt.c b/src/basic/virt.c index fb181e5b55ee5..1e10fc755f201 100644 --- a/src/basic/virt.c +++ b/src/basic/virt.c @@ -267,12 +267,7 @@ int detect_vm(void) { if (cached_found >= 0) return cached_found; -/* Try xen capabilities file first, if not found try - * high-level hypervisor sysfs file: - * - * https://bugs.freedesktop.org/show_bug.cgi?id=77271 */ - -r = detect_vm_xen(); +r = detect_vm_cpuid(); if (r < 0) return r; if (r != VIRTUALIZATION_NONE) @@ -284,7 +279,14 @@ int detect_vm(void) { if (r != VIRTUALIZATION_NONE) goto finish; -r = detect_vm_cpuid(); +/* x86 xen will most likely be detected by cpuid. If not (most likely + * because we're not an x86 guest), then we should try the xen capabilities + * file next. If that's not found, then we check for the high-level + * hypervisor sysfs file: + * + * https://bugs.freedesktop.org/show_bug.cgi?id=77271 */ + +r = detect_vm_xen(); if (r < 0) return r; if (r != VIRTUALIZATION_NONE) -- 2.4.3 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel